author | jwilhelm |
Fri, 03 Oct 2014 00:21:49 +0200 | |
changeset 26940 | b5b002c2980b |
parent 21348 | e30c5696b4c5 |
permissions | -rw-r--r-- |
21348
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
1 |
/* |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
4 |
* |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
8 |
* |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
13 |
* accompanied this code). |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
14 |
* |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
18 |
* |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
21 |
* questions. |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
22 |
*/ |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
23 |
|
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
24 |
|
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
25 |
/* |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
26 |
* @test |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
27 |
* @run main/timeout=600 TestNormal |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
28 |
* @bug 8020802 |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
29 |
* @summary Need an ability to create jar files that are invariant to the pack200 packing/unpacking |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
30 |
* @author Alexander Zuev |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
31 |
*/ |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
32 |
|
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
33 |
import java.io.*; |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
34 |
import java.util.Collections; |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
35 |
import java.util.Properties; |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
36 |
import java.util.jar.JarEntry; |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
37 |
import java.util.jar.JarFile; |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
38 |
|
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
39 |
public class TestNormal { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
40 |
private static String FS = File.separator; |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
41 |
|
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
42 |
public static void main(String args[]) throws Exception { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
43 |
Properties p = System.getProperties(); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
44 |
String java_home = p.getProperty("test.jdk"); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
45 |
String dtjar = java_home + File.separator + "lib" |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
46 |
+ File.separator + "dt.jar"; |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
47 |
|
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
48 |
File folder = new File("dt"); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
49 |
if (folder.exists()) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
50 |
delete(folder); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
51 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
52 |
folder.mkdir(); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
53 |
|
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
54 |
try { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
55 |
extractJar(new JarFile(dtjar), folder); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
56 |
execJavaCommand(java_home, "jar cnf normalized.jar -C dt ."); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
57 |
execJavaCommand(java_home, "jar cf original.jar -C dt ."); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
58 |
execJavaCommand(java_home, "pack200 -r repacked.jar original.jar"); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
59 |
compareJars(new JarFile("normalized.jar"), new JarFile("repacked.jar")); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
60 |
} finally { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
61 |
String[] cleanupList = {"dt", "normalized.jar", "original.jar", "repacked.jar"}; |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
62 |
for (String s : cleanupList) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
63 |
delete(new File(s)); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
64 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
65 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
66 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
67 |
|
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
68 |
public static void execJavaCommand(String java_home, String cmd) throws Exception { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
69 |
Process proc = Runtime.getRuntime().exec(java_home + FS + "bin" + FS + cmd); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
70 |
String s; |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
71 |
BufferedReader stdInput = |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
72 |
new BufferedReader(new InputStreamReader(proc.getInputStream())); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
73 |
BufferedReader stdError = |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
74 |
new BufferedReader(new InputStreamReader(proc.getErrorStream())); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
75 |
while ((s = stdInput.readLine()) != null) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
76 |
System.out.println(s); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
77 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
78 |
while ((s = stdError.readLine()) != null) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
79 |
System.err.println(s); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
80 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
81 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
82 |
|
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
83 |
public static void compareJars(JarFile jf1, JarFile jf2) throws Exception { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
84 |
try { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
85 |
if (jf1.size() != jf2.size()) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
86 |
throw new Exception("Jars " + jf1.getName() + " and " + jf2.getName() |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
87 |
+ " have different number of entries"); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
88 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
89 |
for (JarEntry elem1 : Collections.list(jf1.entries())) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
90 |
JarEntry elem2 = jf2.getJarEntry(elem1.getName()); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
91 |
if (elem2 == null) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
92 |
throw new Exception("Element " + elem1.getName() + " is missing from " + jf2.getName()); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
93 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
94 |
if (!elem1.isDirectory() && elem1.getCrc() != elem2.getCrc()) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
95 |
throw new Exception("The crc of " + elem1.getName() + " is different."); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
96 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
97 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
98 |
} finally { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
99 |
jf1.close(); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
100 |
jf2.close(); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
101 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
102 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
103 |
|
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
104 |
public static void extractJar(JarFile jf, File where) throws Exception { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
105 |
for (JarEntry file : Collections.list(jf.entries())) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
106 |
File out = new File(where, file.getName()); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
107 |
if (file.isDirectory()) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
108 |
out.mkdirs(); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
109 |
continue; |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
110 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
111 |
File parent = out.getParentFile(); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
112 |
if (parent != null && !parent.exists()) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
113 |
parent.mkdirs(); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
114 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
115 |
InputStream is = null; |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
116 |
OutputStream os = null; |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
117 |
try { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
118 |
is = jf.getInputStream(file); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
119 |
os = new FileOutputStream(out); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
120 |
while (is.available() > 0) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
121 |
os.write(is.read()); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
122 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
123 |
} finally { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
124 |
if (is != null) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
125 |
is.close(); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
126 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
127 |
if (os != null) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
128 |
os.close(); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
129 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
130 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
131 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
132 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
133 |
|
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
134 |
static void delete(File f) throws IOException { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
135 |
if (!f.exists()) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
136 |
return; |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
137 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
138 |
if (f.isDirectory()) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
139 |
for (File c : f.listFiles()) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
140 |
delete(c); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
141 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
142 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
143 |
if (!f.delete()) { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
144 |
throw new FileNotFoundException("Failed to delete file: " + f); |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
145 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
146 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
147 |
} |