Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static synchronized Path generateClasspathJar(String[] classPaths) throws
// In jar manifest, the absolute path C:\a.jar should be converted to the url style file:///C:/a.jar
String classpathValue = String.join(" ", classpathUrls);
attributes.put(Attributes.Name.CLASS_PATH, classpathValue);
String baseName = "cp_" + getMd5(classpathValue);
String baseName = "cp_" + getSha256(classpathValue);
cleanupTempFiles(baseName, ".jar");
Path tempfile = createTempFile(baseName, ".jar");
JarOutputStream jar = new JarOutputStream(new FileOutputStream(tempfile.toFile()), manifest);
Expand Down Expand Up @@ -127,7 +127,7 @@ public static synchronized Path generateArgfile(String vmArgs, String[] classPat
}

argfile = argfile.replace("\\", "\\\\");
String baseName = "cp_" + getMd5(argfile);
String baseName = "cp_" + getSha256(argfile);
cleanupTempFiles(baseName, ".argfile");
Path tempfile = createTempFile(baseName, ".argfile");
Files.writeString(tempfile, argfile, encoding);
Expand Down Expand Up @@ -364,12 +364,15 @@ private static Path createTempFile(String baseName, String suffix) throws IOExce
}
}

private static String getMd5(String input) {
private static String getSha256(String input) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
MessageDigest md = MessageDigest.getInstance("SHA-256");
byte[] messageDigest = md.digest(input.getBytes());
BigInteger md5 = new BigInteger(1, messageDigest);
return md5.toString(Character.MAX_RADIX);
// Use only first 16 bytes to keep filename shorter
byte[] truncated = new byte[16];
System.arraycopy(messageDigest, 0, truncated, 0, 16);
BigInteger hash = new BigInteger(1, truncated);
return hash.toString(Character.MAX_RADIX);
} catch (NoSuchAlgorithmException e) {
return Integer.toString(input.hashCode(), Character.MAX_RADIX);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.platform.feature.group" version="0.0.0"/>
<repository location="https://download.eclipse.org/eclipse/updates/4.36-I-builds/"/>
<repository location="https://download.eclipse.org/eclipse/updates/4.37-I-builds/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.jdt.ls.core" version="0.0.0"/>
Expand Down