Skip to content

Commit 2decd24

Browse files
committed
Fix TargetWeaver.getDevProperties() to decode fgDevPropertiesURL
#1708
1 parent 4cb81af commit 2decd24

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/TargetWeaver.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import java.io.FileInputStream;
2222
import java.io.IOException;
2323
import java.io.InputStream;
24+
import java.net.URI;
25+
import java.net.URISyntaxException;
2426
import java.net.URL;
2527
import java.nio.file.Files;
2628
import java.nio.file.Path;
@@ -78,13 +80,10 @@ private static synchronized Properties getDevProperties() {
7880
fgDevProperties = new Properties();
7981
try {
8082
URL url = new URL(fgDevPropertiesURL);
81-
String path = url.getFile();
82-
if (path != null && path.length() > 0) {
83-
File file = new File(path);
84-
if (file.exists()) {
85-
try (InputStream stream = new FileInputStream(file)) {
86-
fgDevProperties.load(stream);
87-
}
83+
File file = toFile(url);
84+
if (file.exists()) {
85+
try (InputStream stream = new FileInputStream(file)) {
86+
fgDevProperties.load(stream);
8887
}
8988
}
9089
} catch (IOException e) {
@@ -217,4 +216,13 @@ private static Bundle findRunningPlatformBundle(String symbolicName, String vers
217216
}
218217
return Arrays.stream(platformBundles).filter(b -> b.getVersion().equals(version)).findAny().orElse(null);
219218
}
219+
220+
private static File toFile(URL url) {
221+
try {
222+
URI uri = url.toURI();
223+
return new File(uri);
224+
} catch (URISyntaxException e) {
225+
return new File(url.getFile());
226+
}
227+
}
220228
}

0 commit comments

Comments
 (0)