Skip to content

Commit 66af3ac

Browse files
authored
Fix JavaTestPlugin.getFileInPlugin(IPath) to handle not found file (#787)
Add null check in JavaTestPlugin.getFileInPlugin(IPath) to prevent NPE when path cannot be converted to a file Fixes : #786
1 parent f553d6e commit 66af3ac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/JavaTestPlugin.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,13 @@ public File getFileInPlugin(IPath path) {
9090
try {
9191
Bundle bundle = getDefault().getBundle();
9292
URL installURL = bundle.getEntry("/" + path.toString());
93+
if (installURL == null) {
94+
return null;
95+
}
9396
URL localURL= FileLocator.toFileURL(installURL);//Platform.asLocalURL(installURL);
97+
if (localURL == null) {
98+
return null;
99+
}
94100
return new File(localURL.getFile());
95101
} catch (IOException e) {
96102
return null;

0 commit comments

Comments
 (0)