JarDiffPatcher needs to support .old files.
When patching, Getdown will move foo.jar to foo.jar.old and then patch that file to create a new foo.jar. That results in foo.jar.old being passed into JarDiffPatcher as the source file, which it then inspects to determine whether it is a zip file or a jar file based on its file extension. Since that file extension has already changed to .xxx.old, we need to handle that. Closes #230.
This commit is contained in:
@@ -282,8 +282,11 @@ public class JarDiffPatcher implements JarDiffCodes
|
||||
throws IOException
|
||||
{
|
||||
FileOutputStream out = new FileOutputStream(target);
|
||||
if (source.getName().endsWith(".jar")) return new JarOutputStream(out);
|
||||
else if (source.getName().endsWith(".zip")) return new ZipOutputStream(out);
|
||||
String sourceName = source.getName();
|
||||
if (sourceName.endsWith(".jar") ||
|
||||
sourceName.endsWith(".jar.old")) return new JarOutputStream(out);
|
||||
else if (sourceName.endsWith(".zip") ||
|
||||
sourceName.endsWith(".zip.old")) return new ZipOutputStream(out);
|
||||
else throw new AssertionError("Unsupported source file '" + source + "'. Not a .jar or .zip?");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user