-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the conflict of bundle when updating. #385
Conversation
|
||
private static BundleInfo getBundleInfo(String bundleLocation) throws IOException { | ||
JarFile jarFile = new JarFile(bundleLocation); | ||
Manifest manifest = jarFile.getManifest(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to check if manifest != null
} | ||
|
||
return new BundleInfo(bundleVersion, symbolicName); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static BundleInfo getBundleInfo(String bundleLocation) throws IOException {
try (JarFile jarFile = new JarFile(bundleLocation)){
Manifest manifest = jarFile.getManifest();
if (manifest != null) {
Attributes mainAttributes = manifest.getMainAttributes();
String bundleVersion = mainAttributes.getValue(Constants.BUNDLE_VERSION);
String symbolicName = mainAttributes.getValue(Constants.BUNDLE_SYMBOLICNAME);
if (StringUtils.isNotBlank(symbolicName) && symbolicName.indexOf(";") >= 0) {
symbolicName = symbolicName.substring(0, symbolicName.indexOf(";"));
}
return new BundleInfo(bundleVersion, symbolicName);
}
}
return null;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternatively, throw IOException instead of returning null
@@ -57,17 +84,27 @@ public static void loadBundles(Collection<String> bundleLocations) throws CoreEx | |||
|
|||
String location = getBundleLocation(bundleLocation, true); | |||
|
|||
Bundle bundle = context.getBundle(location); | |||
boolean needInstall = true; | |||
BundleInfo bundleInfo = getBundleInfo(bundleLocation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if bundleInfo is null?
Other than making getBundleInfo(...) more robust, this PR looks good. We'll include it in the next release. |
871a841
to
fb150a3
Compare
Signed-off-by: Yaohai Zheng <[email protected]>
fb150a3
to
b68aa62
Compare
Update the changes. |
Merged as 7dc20a2 (after adding a null check on bundle version) |
Signed-off-by: Yaohai Zheng [email protected]
Fix the issue: microsoft/vscode-java-debug#54
In this change, it makes sure the extension symbolic name is unique and doesn't support multiple version of bundles. These limitation should not be problems for jdt.ls extensions.
@fbricon @gorkem @tsmaeder