mirror of
https://github.com/openjdk/jdk8u.git
synced 2025-12-11 14:00:23 -06:00
8240235: jdk.test.lib.util.JarUtils updates jar files incorrectly
Reviewed-by: andrew Backport-of: 2a791467919c9df9869e6fe1e57df0a5caa90d8f
This commit is contained in:
parent
b10963f0e8
commit
3c5942430b
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -216,7 +216,7 @@ public final class JarUtils {
|
|||||||
changes.remove(name);
|
changes.remove(name);
|
||||||
} else {
|
} else {
|
||||||
System.out.println(String.format("- Copy %s", name));
|
System.out.println(String.format("- Copy %s", name));
|
||||||
jos.putNextEntry(entry);
|
jos.putNextEntry(copyEntry(entry));
|
||||||
Utils.transferTo(srcJarFile.getInputStream(entry), jos);
|
Utils.transferTo(srcJarFile.getInputStream(entry), jos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -276,4 +276,17 @@ public final class JarUtils {
|
|||||||
.toString()
|
.toString()
|
||||||
.replace(File.separatorChar, '/');
|
.replace(File.separatorChar, '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static JarEntry copyEntry(JarEntry e1) {
|
||||||
|
JarEntry e2 = new JarEntry(e1.getName());
|
||||||
|
e2.setMethod(e1.getMethod());
|
||||||
|
e2.setTime(e1.getTime());
|
||||||
|
e2.setComment(e1.getComment());
|
||||||
|
e2.setExtra(e1.getExtra());
|
||||||
|
if (e1.getMethod() == JarEntry.STORED) {
|
||||||
|
e2.setSize(e1.getSize());
|
||||||
|
e2.setCrc(e1.getCrc());
|
||||||
|
}
|
||||||
|
return e2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user