Skip to content

Commit eefc950

Browse files
authored
Fixed NPE loading XMLCatalogs
Fixed: NullPointer in Wild Web Developer causes POM editor to stop functioning after installing specific plugin #897
1 parent 50259a2 commit eefc950

File tree

1 file changed

+11
-3
lines changed
  • org.eclipse.wildwebdeveloper.xml/src/org/eclipse/wildwebdeveloper/xml/internal/ui/preferences

1 file changed

+11
-3
lines changed

org.eclipse.wildwebdeveloper.xml/src/org/eclipse/wildwebdeveloper/xml/internal/ui/preferences/XMLCatalogs.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.nio.file.Files;
2020
import java.util.Arrays;
2121
import java.util.Comparator;
22+
import java.util.Objects;
2223
import java.util.Set;
2324
import java.util.TreeSet;
2425

@@ -126,10 +127,17 @@ private static URI createURI(IConfigurationElement element) {
126127
URI uri = URI.create(element.getAttribute("uri"));
127128
if (!uri.isAbsolute()) {
128129
try {
129-
URL url = FileLocator.find(Platform.getBundle(element.getContributor().getName()),
130+
String contributorName = element.getContributor().getName();
131+
URL url = FileLocator.find(Platform.getBundle(contributorName),
130132
Path.fromPortableString(uri.toString()));
131-
// this constructor will ensure parts are URI encoded correctly
132-
uri = new URI(url.getProtocol(), url.getAuthority(), url.getPath(), null, null);
133+
if(Objects.nonNull(url)) {
134+
// this constructor will ensure parts are URI encoded correctly
135+
uri = new URI(url.getProtocol(), url.getAuthority(), url.getPath(), null, null);
136+
} else {
137+
Activator.getDefault().getLog().log(new Status(IStatus.WARNING, Activator.PLUGIN_ID,
138+
"A URL object was not found for the given URI "+uri+ " from "+contributorName));
139+
}
140+
133141
} catch (InvalidRegistryObjectException | URISyntaxException e) {
134142
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
135143
}

0 commit comments

Comments
 (0)