From e6addcde3bcbb7a743cd78500ada0cf47387b0ec Mon Sep 17 00:00:00 2001 From: Agaricus Date: Sun, 3 Mar 2013 16:23:47 -0800 Subject: [PATCH] Exclude signature files (.DSA, .SF) from remapped jar The remapped jar is altered and will fail to validate against the included signatures from the original jar, if any. Normally not a problem, you can compile against the remapped jar as a library with no errors. However, when loading the jar from Maven (hit with the Forge jar), signature validation will fail. Stripping the signature files fixes this. --- src/main/java/net/md_5/specialsource/JarRemapper.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/md_5/specialsource/JarRemapper.java b/src/main/java/net/md_5/specialsource/JarRemapper.java index 646c711..dea2ab3 100644 --- a/src/main/java/net/md_5/specialsource/JarRemapper.java +++ b/src/main/java/net/md_5/specialsource/JarRemapper.java @@ -113,14 +113,18 @@ public class JarRemapper extends Remapper { try { byte[] data; if (name.endsWith(".class")) { + // remap classes name = name.substring(0, name.length() - CLASS_LEN); data = remapClassFile(is); String newName = map(name); entry = new JarEntry(newName == null ? name : newName + ".class"); - + } else if (name.endsWith(".DSA") || name.endsWith(".SF")) { + // skip signatures + continue; } else { + // copy other resources entry = new JarEntry(name); ByteArrayOutputStream buffer = new ByteArrayOutputStream();