diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ContentDescriptionManager.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ContentDescriptionManager.java index 7cbb44cb57a..c4c28024be6 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ContentDescriptionManager.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ContentDescriptionManager.java @@ -502,15 +502,22 @@ private static String getCurrentPlatformState() { if (bundleContext == null) { return ""; //$NON-NLS-1$ } - String ID = Arrays.stream(bundleContext.getBundles()) - .map(bundle -> String.format("%d %s %s", bundle.getBundleId(), bundle.getSymbolicName(), //$NON-NLS-1$ - bundle.getVersion())) + String state = Arrays.stream(bundleContext.getBundles()) + .map(ContentDescriptionManager::toStateEntry) .sorted().collect(Collectors.joining(System.lineSeparator())); + return hash(state); + } + + private static String toStateEntry(Bundle bundle) { + return bundle.getBundleId() + " " + bundle.getSymbolicName() + " " + bundle.getVersion(); //$NON-NLS-1$ //$NON-NLS-2$ + } + + private static String hash(String value) { try { MessageDigest digest = MessageDigest.getInstance("SHA-256"); //$NON-NLS-1$ - return HexFormat.of().formatHex(digest.digest(ID.getBytes(StandardCharsets.UTF_8))); + return HexFormat.of().formatHex(digest.digest(value.getBytes(StandardCharsets.UTF_8))); } catch (NoSuchAlgorithmException e) { - return Integer.toHexString(ID.hashCode()); + return Integer.toHexString(value.hashCode()); } }