Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/main/java/org/opengis/cite/wms13/CtlController.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
Expand Down Expand Up @@ -41,7 +42,7 @@ public CtlController() {
try (InputStream is = getClass().getResourceAsStream("ets.properties")) {
this.etsProperties.load(is);
String mainScriptPath = etsProperties.getProperty("main-script");
File ctlFile = findScriptFile(URI.create(mainScriptPath));
Object ctlFile = findScriptFile(URI.create(mainScriptPath));
setupOpts.addSource(ctlFile);
this.executor = new CtlExecutor(setupOpts);
}
Expand Down Expand Up @@ -115,7 +116,7 @@ public Source doTestRun(Document testRunArgs) throws Exception {
* @param uri An absolute or relative URI.
* @return A File object, or null if one could not be created.
*/
final File findScriptFile(URI uri) {
final Object findScriptFile(URI uri) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please check if a more specific data type can be used?

File ctlFile = null;
File baseDir = SetupOptions.getBaseConfigDirectory();
if (!uri.isAbsolute()) {
Expand All @@ -124,6 +125,12 @@ final File findScriptFile(URI uri) {
}
if (null == ctlFile || !ctlFile.isFile()) {
URL resource = getClass().getResource(uri.getPath());
if (resource.getProtocol().equals("jar")) {
// See https://github.com/opengeospatial/ets-wms13/issues/120 and
// https://github.com/opengeospatial/teamengine/issues/632
// will return an URL
return resource;
}
try {
ctlFile = new File(resource.toURI());
}
Expand Down