[#1304] Catch exception in call to getBaseURL()

The call causes a MissingResourceException, since EMF does not find a
plugin.properties in xtext.utils. Fixes the regression that arised from
Xtend to Java refactoring. The old code catched the exception and
returned null.

Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
This commit is contained in:
Karsten Thoms 2019-11-28 12:00:05 +01:00
parent e1161dbe03
commit 85510e8157

View file

@ -93,7 +93,12 @@ public class XtextVersion {
}
private static String readVersionFromManifest() {
URL baseURL = XtextVersion.Plugin.INSTANCE.getBaseURL();
URL baseURL = null;
try {
baseURL = XtextVersion.Plugin.INSTANCE.getBaseURL();
} catch (Exception e) {
return null;
}
try (InputStream is = new URL (baseURL + "META-INF/MANIFEST.MF").openStream()) {
Manifest manifest = new Manifest(is);
String version = manifest.getMainAttributes().getValue("Maven-Version");