|
14 | 14 | import java.io.File; |
15 | 15 | import java.io.IOException; |
16 | 16 | import java.net.URI; |
| 17 | +import java.net.URISyntaxException; |
17 | 18 | import java.nio.file.Files; |
18 | 19 | import java.util.Arrays; |
19 | 20 | import java.util.Comparator; |
@@ -61,11 +62,18 @@ private static File getWTPExtensionCatalog() { |
61 | 62 | .flatMap(element -> Arrays.stream(element.getChildren("system"))) |
62 | 63 | .forEach(element -> { |
63 | 64 | String namespace = element.getAttribute("systemId"); |
64 | | - String uri = element.getAttribute("uri"); |
65 | | - if (!URI.create(uri).isAbsolute()) { |
| 65 | + URI uri = URI.create(element.getAttribute("uri")); |
| 66 | + if (!uri.isAbsolute()) { |
66 | 67 | try { |
67 | | - uri = FileLocator.toFileURL(FileLocator.find(Platform.getBundle(element.getContributor().getName()), Path.fromPortableString(uri.toString()))).toString(); |
68 | | - } catch (InvalidRegistryObjectException | IOException e) { |
| 68 | + uri = FileLocator.find(Platform.getBundle(element.getContributor().getName()), Path.fromPortableString(uri.toString())).toURI(); |
| 69 | + } catch (InvalidRegistryObjectException | URISyntaxException e) { |
| 70 | + Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e)); |
| 71 | + } |
| 72 | + } |
| 73 | + if (!"file".equals(uri.getScheme())) { // are some other scheme supported directly by LemMinX ? |
| 74 | + try { |
| 75 | + uri = FileLocator.toFileURL(uri.toURL()).toURI(); |
| 76 | + } catch (InvalidRegistryObjectException | IOException | URISyntaxException e) { |
69 | 77 | Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e)); |
70 | 78 | } |
71 | 79 | } |
|
0 commit comments