locked_region_code_injection: copy jar timestamp to output

Copy the input jar's timestamps to the output jar to ensure
deterministic results.

Test: m checkbuild
Change-Id: Ifdd3ddc36c35429a0396b968dd3dd20b8cc57793
This commit is contained in:
Colin Cross
2019-04-11 14:29:30 -07:00
parent a1759a9bd8
commit 00b6e025fb

View File

@@ -13,6 +13,9 @@
*/
package lockedregioncodeinjection;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import java.io.BufferedInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -24,8 +27,6 @@ import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
public class Main {
public static void main(String[] args) throws IOException {
@@ -74,6 +75,7 @@ public class Main {
while (srcEntries.hasMoreElements()) {
ZipEntry entry = srcEntries.nextElement();
ZipEntry newEntry = new ZipEntry(entry.getName());
newEntry.setTime(entry.getTime());
zos.putNextEntry(newEntry);
BufferedInputStream bis = new BufferedInputStream(zipSrc.getInputStream(entry));