64 System.out.println(" Info: memory diff = " + diff + "K"); 65 if ( diff > LEAK_TOLERANCE) { 66 throw new Exception("memory leak detected " + diff); 67 } 68 } 69 70 private static void doPackUnpack() throws IOException { 71 for (File in : jarList) { 72 JarOutputStream javaUnpackerStream = null; 73 JarOutputStream nativeUnpackerStream = null; 74 JarFile jarFile = null; 75 try { 76 jarFile = new JarFile(in); 77 78 // Write out to a jtreg scratch area 79 File packFile = new File(in.getName() + Utils.PACK_FILE_EXT); 80 81 System.out.println("Packing [" + in.toString() + "]"); 82 // Call the packer 83 Utils.pack(jarFile, packFile); 84 jarFile.close(); 85 leakCheck(); 86 87 System.out.println(" Unpacking using java unpacker"); 88 File javaUnpackedJar = new File("java-" + in.getName()); 89 // Write out to current directory, jtreg will setup a scratch area 90 javaUnpackerStream = new JarOutputStream( 91 new FileOutputStream(javaUnpackedJar)); 92 Utils.unpackj(packFile, javaUnpackerStream); 93 javaUnpackerStream.close(); 94 System.out.println(" Testing...java unpacker"); 95 leakCheck(); 96 // Ok we have unpacked the file, lets test it. 97 Utils.doCompareVerify(in.getAbsoluteFile(), javaUnpackedJar); 98 99 System.out.println(" Unpacking using native unpacker"); 100 // Write out to current directory 101 File nativeUnpackedJar = new File("native-" + in.getName()); 102 nativeUnpackerStream = new JarOutputStream( 103 new FileOutputStream(nativeUnpackedJar)); 104 Utils.unpackn(packFile, nativeUnpackerStream); | 64 System.out.println(" Info: memory diff = " + diff + "K"); 65 if ( diff > LEAK_TOLERANCE) { 66 throw new Exception("memory leak detected " + diff); 67 } 68 } 69 70 private static void doPackUnpack() throws IOException { 71 for (File in : jarList) { 72 JarOutputStream javaUnpackerStream = null; 73 JarOutputStream nativeUnpackerStream = null; 74 JarFile jarFile = null; 75 try { 76 jarFile = new JarFile(in); 77 78 // Write out to a jtreg scratch area 79 File packFile = new File(in.getName() + Utils.PACK_FILE_EXT); 80 81 System.out.println("Packing [" + in.toString() + "]"); 82 // Call the packer 83 Utils.pack(jarFile, packFile); 84 System.out.println("Done Packing [" + in.toString() + "]"); 85 jarFile.close(); 86 System.out.println("Start leak check"); 87 leakCheck(); 88 89 System.out.println(" Unpacking using java unpacker"); 90 File javaUnpackedJar = new File("java-" + in.getName()); 91 // Write out to current directory, jtreg will setup a scratch area 92 javaUnpackerStream = new JarOutputStream( 93 new FileOutputStream(javaUnpackedJar)); 94 Utils.unpackj(packFile, javaUnpackerStream); 95 javaUnpackerStream.close(); 96 System.out.println(" Testing...java unpacker"); 97 leakCheck(); 98 // Ok we have unpacked the file, lets test it. 99 Utils.doCompareVerify(in.getAbsoluteFile(), javaUnpackedJar); 100 101 System.out.println(" Unpacking using native unpacker"); 102 // Write out to current directory 103 File nativeUnpackedJar = new File("native-" + in.getName()); 104 nativeUnpackerStream = new JarOutputStream( 105 new FileOutputStream(nativeUnpackedJar)); 106 Utils.unpackn(packFile, nativeUnpackerStream); |