|
19 | 19 | import java.nio.file.Files; |
20 | 20 | import java.util.Arrays; |
21 | 21 | import java.util.Comparator; |
| 22 | +import java.util.Objects; |
22 | 23 | import java.util.Set; |
23 | 24 | import java.util.TreeSet; |
24 | 25 |
|
@@ -126,10 +127,17 @@ private static URI createURI(IConfigurationElement element) { |
126 | 127 | URI uri = URI.create(element.getAttribute("uri")); |
127 | 128 | if (!uri.isAbsolute()) { |
128 | 129 | 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), |
130 | 132 | 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 | + |
133 | 141 | } catch (InvalidRegistryObjectException | URISyntaxException e) { |
134 | 142 | Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e)); |
135 | 143 | } |
|
0 commit comments