author | chegar |
Wed, 03 Dec 2014 14:22:58 +0000 | |
changeset 27565 | 729f9700483a |
parent 6314 | 8ab691ddb904 |
permissions | -rw-r--r-- |
6314
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
1 |
/* |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
2 |
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
4 |
* |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
8 |
* |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
13 |
* accompanied this code). |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
14 |
* |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
18 |
* |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
21 |
* questions. |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
22 |
*/ |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
23 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
24 |
/* |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
25 |
* A collection of useful global utilities commonly used. |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
26 |
*/ |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
27 |
package sun.tools.pack.verify; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
28 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
29 |
import java.io.*; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
30 |
import java.util.*; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
31 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
32 |
/* |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
33 |
* @author ksrini |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
34 |
*/ |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
35 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
36 |
class Globals { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
37 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
38 |
private static int errors = 0; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
39 |
private static PrintWriter _pw = null; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
40 |
private static String _logFileName = null; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
41 |
private static final String DEFAULT_LOG_FILE = "verifier.log"; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
42 |
private static boolean _verbose = true; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
43 |
private static boolean _ignoreJarDirectories = false; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
44 |
private static boolean _checkJarClassOrdering = true; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
45 |
private static boolean _bitWiseClassCompare = false; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
46 |
// Ignore Deprecated, SourceFile and Synthetic |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
47 |
private static boolean _ignoreCompileAttributes = false; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
48 |
// Ignore Debug Attributes LocalVariableTable, LocalVariableType,LineNumberTable |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
49 |
private static boolean _ignoreDebugAttributes = false; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
50 |
private static boolean _ignoreUnknownAttributes = false; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
51 |
private static boolean _validateClass = true; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
52 |
private static Globals _instance = null; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
53 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
54 |
static Globals getInstance() { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
55 |
if (_instance == null) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
56 |
_instance = new Globals(); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
57 |
_verbose = (System.getProperty("sun.tools.pack.verify.verbose") == null) |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
58 |
? false : true; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
59 |
_ignoreJarDirectories = (System.getProperty("ignoreJarDirectories") == null) |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
60 |
? false : true; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
61 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
62 |
return _instance; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
63 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
64 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
65 |
static boolean ignoreCompileAttributes() { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
66 |
return _ignoreCompileAttributes; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
67 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
68 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
69 |
static boolean ignoreDebugAttributes() { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
70 |
return _ignoreDebugAttributes; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
71 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
72 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
73 |
static boolean ignoreUnknownAttributes() { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
74 |
return _ignoreUnknownAttributes; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
75 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
76 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
77 |
static boolean ignoreJarDirectories() { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
78 |
return _ignoreJarDirectories; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
79 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
80 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
81 |
static boolean validateClass() { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
82 |
return _validateClass; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
83 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
84 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
85 |
static void setCheckJarClassOrdering(boolean flag) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
86 |
_checkJarClassOrdering = flag; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
87 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
88 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
89 |
static boolean checkJarClassOrdering() { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
90 |
return _checkJarClassOrdering; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
91 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
92 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
93 |
static boolean bitWiseClassCompare() { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
94 |
return _bitWiseClassCompare; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
95 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
96 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
97 |
static boolean setBitWiseClassCompare(boolean flag) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
98 |
return _bitWiseClassCompare = flag; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
99 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
100 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
101 |
public static boolean setIgnoreCompileAttributes(boolean flag) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
102 |
return _ignoreCompileAttributes = flag; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
103 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
104 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
105 |
static boolean setIgnoreDebugAttributes(boolean flag) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
106 |
return _ignoreDebugAttributes = flag; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
107 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
108 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
109 |
static boolean setIgnoreUnknownAttributes(boolean flag) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
110 |
return _ignoreUnknownAttributes = flag; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
111 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
112 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
113 |
static boolean setValidateClass(boolean flag) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
114 |
return _validateClass = flag; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
115 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
116 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
117 |
static int getErrors() { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
118 |
return errors; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
119 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
120 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
121 |
static void trace(String s) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
122 |
if (_verbose) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
123 |
println(s); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
124 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
125 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
126 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
127 |
static void print(String s) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
128 |
_pw.print(s); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
129 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
130 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
131 |
static void println(String s) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
132 |
_pw.println(s); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
133 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
134 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
135 |
static void log(String s) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
136 |
errors++; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
137 |
_pw.println("ERROR:" + s); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
138 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
139 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
140 |
static void lognoln(String s) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
141 |
errors++; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
142 |
_pw.print(s); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
143 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
144 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
145 |
private static PrintWriter openFile(String fileName) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
146 |
//Lets create the directory if it does not exist. |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
147 |
File f = new File(fileName); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
148 |
File baseDir = f.getParentFile(); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
149 |
if (baseDir != null && baseDir.exists() == false) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
150 |
baseDir.mkdirs(); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
151 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
152 |
try { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
153 |
return new PrintWriter(new FileWriter(f), true); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
154 |
} catch (Exception e) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
155 |
throw new RuntimeException(e); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
156 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
157 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
158 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
159 |
private static void closeFile() { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
160 |
_pw.flush(); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
161 |
_pw.close(); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
162 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
163 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
164 |
static void printPropsToLog() { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
165 |
println("Log started " + new Date(System.currentTimeMillis())); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
166 |
print(System.getProperty("java.vm.version")); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
167 |
println("\t" + System.getProperty("java.vm.name")); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
168 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
169 |
println("System properties"); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
170 |
println("\tjava.home=" + System.getProperty("java.home")); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
171 |
println("\tjava.class.version=" + System.getProperty("java.class.version")); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
172 |
println("\tjava.class.path=" + System.getProperty("java.class.path")); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
173 |
println("\tos.name=" + System.getProperty("os.name")); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
174 |
println("\tos.arch=" + System.getProperty("os.arch")); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
175 |
println("\tos.version=" + System.getProperty("os.version")); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
176 |
println("\tuser.name=" + System.getProperty("user.name")); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
177 |
println("\tuser.home=" + System.getProperty("user.home")); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
178 |
println("\tuser.dir=" + System.getProperty("user.dir")); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
179 |
println("\tLocale.getDefault=" + Locale.getDefault()); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
180 |
println("System properties end"); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
181 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
182 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
183 |
static void openLog(String s) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
184 |
_logFileName = (s != null) ? s : "." + File.separator + DEFAULT_LOG_FILE; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
185 |
_logFileName = (new File(_logFileName).isDirectory()) |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
186 |
? _logFileName + File.separator + DEFAULT_LOG_FILE : _logFileName; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
187 |
_pw = openFile(_logFileName); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
188 |
printPropsToLog(); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
189 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
190 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
191 |
static void closeLog() { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
192 |
closeFile(); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
193 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
194 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
195 |
static String getLogFileName() { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
196 |
return _logFileName; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
197 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
198 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
199 |
static void diffCharData(String s1, String s2) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
200 |
boolean diff = false; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
201 |
char[] c1 = s1.toCharArray(); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
202 |
char[] c2 = s2.toCharArray(); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
203 |
if (c1.length != c2.length) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
204 |
diff = true; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
205 |
Globals.log("Length differs: " + (c1.length - c2.length)); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
206 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
207 |
// Take the smaller of the two arrays to prevent Array...Exception |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
208 |
int minlen = (c1.length < c2.length) ? c1.length : c2.length; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
209 |
for (int i = 0; i < c1.length; i++) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
210 |
if (c1[i] != c2[i]) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
211 |
diff = true; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
212 |
Globals.lognoln("\t idx[" + i + "] 0x" + Integer.toHexString(c1[i]) + "<>" + "0x" + Integer.toHexString(c2[i])); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
213 |
Globals.log(" -> " + c1[i] + "<>" + c2[i]); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
214 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
215 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
216 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
217 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
218 |
static void diffByteData(String s1, String s2) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
219 |
boolean diff = false; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
220 |
byte[] b1 = s1.getBytes(); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
221 |
byte[] b2 = s2.getBytes(); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
222 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
223 |
if (b1.length != b2.length) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
224 |
diff = true; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
225 |
//(+) b1 is greater, (-) b2 is greater |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
226 |
Globals.log("Length differs diff: " + (b1.length - b2.length)); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
227 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
228 |
// Take the smaller of the two array to prevent Array...Exception |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
229 |
int minlen = (b1.length < b2.length) ? b1.length : b2.length; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
230 |
for (int i = 0; i < b1.length; i++) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
231 |
if (b1[i] != b2[i]) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
232 |
diff = true; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
233 |
Globals.log("\t" + "idx[" + i + "] 0x" + Integer.toHexString(b1[i]) + "<>" + "0x" + Integer.toHexString(b2[i])); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
234 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
235 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
236 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
237 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
238 |
static void dumpToHex(String s) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
239 |
try { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
240 |
dumpToHex(s.getBytes("UTF-8")); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
241 |
} catch (UnsupportedEncodingException uce) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
242 |
throw new RuntimeException(uce); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
243 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
244 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
245 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
246 |
static void dumpToHex(byte[] buffer) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
247 |
int linecount = 0; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
248 |
byte[] b = new byte[16]; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
249 |
for (int i = 0; i < buffer.length; i += 16) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
250 |
if (buffer.length - i > 16) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
251 |
System.arraycopy(buffer, i, b, 0, 16); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
252 |
print16Bytes(b, linecount); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
253 |
linecount += 16; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
254 |
} else { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
255 |
System.arraycopy(buffer, i, b, 0, buffer.length - i); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
256 |
for (int n = buffer.length - (i + 1); n < 16; n++) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
257 |
b[n] = 0; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
258 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
259 |
print16Bytes(b, linecount); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
260 |
linecount += 16; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
261 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
262 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
263 |
Globals.log("-----------------------------------------------------------------"); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
264 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
265 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
266 |
static void print16Bytes(byte[] buffer, int linecount) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
267 |
final int MAX = 4; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
268 |
Globals.lognoln(paddedHexString(linecount, 4) + " "); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
269 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
270 |
for (int i = 0; i < buffer.length; i += 2) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
271 |
int iOut = pack2Bytes2Int(buffer[i], buffer[i + 1]); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
272 |
Globals.lognoln(paddedHexString(iOut, 4) + " "); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
273 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
274 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
275 |
Globals.lognoln("| "); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
276 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
277 |
StringBuilder sb = new StringBuilder(new String(buffer)); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
278 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
279 |
for (int i = 0; i < buffer.length; i++) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
280 |
if (Character.isISOControl(sb.charAt(i))) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
281 |
sb.setCharAt(i, '.'); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
282 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
283 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
284 |
Globals.log(sb.toString()); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
285 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
286 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
287 |
static int pack2Bytes2Int(byte b1, byte b2) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
288 |
int out = 0x0; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
289 |
out += b1; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
290 |
out <<= 8; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
291 |
out &= 0x0000ffff; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
292 |
out |= 0x000000ff & b2; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
293 |
return out; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
294 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
295 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
296 |
static String paddedHexString(int n, int max) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
297 |
char[] c = Integer.toHexString(n).toCharArray(); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
298 |
char[] out = new char[max]; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
299 |
|
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
300 |
for (int i = 0; i < max; i++) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
301 |
out[i] = '0'; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
302 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
303 |
int offset = (max - c.length < 0) ? 0 : max - c.length; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
304 |
for (int i = 0; i < c.length; i++) { |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
305 |
out[offset + i] = c[i]; |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
306 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
307 |
return new String(out); |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
308 |
} |
8ab691ddb904
6966737: (pack200) the pack200 regression tests need to be more robust.
ksrini
parents:
diff
changeset
|
309 |
} |