Java Code Examples for java.util.jar.Pack200#newPacker()
The following examples show how to use
java.util.jar.Pack200#newPacker() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Pack.java From ramus with GNU General Public License v3.0 | 6 votes |
/** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { if (args.length != 2) { System.err.println("command unput-directory output-directory"); System.exit(1); } Packer packer = Pack200.newPacker(); Map p = packer.properties(); p.put(Packer.EFFORT, "9"); p.put(Packer.SEGMENT_LIMIT, "-1"); p.put(Packer.KEEP_FILE_ORDER, Packer.FALSE); p.put(Packer.MODIFICATION_TIME, Packer.LATEST); p.put(Packer.DEFLATE_HINT, Packer.FALSE); p.put(Packer.CODE_ATTRIBUTE_PFX + "LineNumberTable", Packer.STRIP); p.put(Packer.UNKNOWN_ATTRIBUTE, Packer.ERROR); File inputDirectory = new File(args[0]); File outputDirectory = new File(args[1]); pack(packer, inputDirectory, outputDirectory); }
Example 2
Source File: RepackJars.java From EclipseCodeFormatter with Apache License 2.0 | 6 votes |
private Map<String, String> properties() { // Create the Packer object Pack200.Packer packer = Pack200.newPacker(); Map<String, String> p = packer.properties(); p.put(Pack200.Packer.EFFORT, "9"); // default is "5" p.put(Pack200.Packer.SEGMENT_LIMIT, "-1"); p.put(Pack200.Packer.KEEP_FILE_ORDER, Pack200.Packer.FALSE); p.put(Pack200.Packer.MODIFICATION_TIME, Pack200.Packer.LATEST); p.put(Pack200.Packer.DEFLATE_HINT, Pack200.Packer.TRUE); // compression enabled // p.put("com.sun.java.util.jar.pack.verbose", Pack200.Packer.FALSE); // p.put("com.sun.java.util.jar.pack.nolog", Pack200.Packer.TRUE); String[] attributes = { UNKNOWN_ATTRIBUTE, CLASS_ATTRIBUTE_PFX, FIELD_ATTRIBUTE_PFX, METHOD_ATTRIBUTE_PFX, CODE_ATTRIBUTE_PFX, }; String[] stripCodeAttributes = { "SourceFile", "LineNumberTable", "LocalVariableTable", "Deprecated" }; for (String attribute : attributes) { for (String attributeName : stripCodeAttributes) { p.put(attribute + attributeName, Pack200.Packer.STRIP); } } p.put(Pack200.Packer.UNKNOWN_ATTRIBUTE, Pack200.Packer.STRIP); return p; }
Example 3
Source File: Pack200Props.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private static void verifyDefaults() { Map<String, String> expectedDefaults = new HashMap<>(); Packer p = Pack200.newPacker(); expectedDefaults.put("com.sun.java.util.jar.pack.default.timezone", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.disable.native", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.verbose", "0"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "CompilationID", "RUH"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "SourceID", "RUH"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CharacterRangeTable", "NH[PHPOHIIH]"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CoverageTable", "NH[PHHII]"); expectedDefaults.put(p.DEFLATE_HINT, p.KEEP); expectedDefaults.put(p.EFFORT, "5"); expectedDefaults.put(p.KEEP_FILE_ORDER, p.TRUE); expectedDefaults.put(p.MODIFICATION_TIME, p.KEEP); expectedDefaults.put(p.SEGMENT_LIMIT, "-1"); expectedDefaults.put(p.UNKNOWN_ATTRIBUTE, p.PASS); Map<String, String> props = p.properties(); int errors = 0; for (String key : expectedDefaults.keySet()) { String def = expectedDefaults.get(key); String x = props.get(key); if (x == null) { System.out.println("Error: key not found:" + key); errors++; } else { if (!def.equals(x)) { System.out.println("Error: key " + key + "\n value expected: " + def + "\n value obtained: " + x); errors++; } } } if (errors > 0) { throw new RuntimeException(errors + " error(s) encountered in default properties verification"); } }
Example 4
Source File: Pack200Props.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private static void verifyDefaults() { Map<String, String> expectedDefaults = new HashMap<>(); Packer p = Pack200.newPacker(); expectedDefaults.put("com.sun.java.util.jar.pack.default.timezone", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.disable.native", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.verbose", "0"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "CompilationID", "RUH"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "SourceID", "RUH"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CharacterRangeTable", "NH[PHPOHIIH]"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CoverageTable", "NH[PHHII]"); expectedDefaults.put(p.DEFLATE_HINT, p.KEEP); expectedDefaults.put(p.EFFORT, "5"); expectedDefaults.put(p.KEEP_FILE_ORDER, p.TRUE); expectedDefaults.put(p.MODIFICATION_TIME, p.KEEP); expectedDefaults.put(p.SEGMENT_LIMIT, "-1"); expectedDefaults.put(p.UNKNOWN_ATTRIBUTE, p.PASS); Map<String, String> props = p.properties(); int errors = 0; for (String key : expectedDefaults.keySet()) { String def = expectedDefaults.get(key); String x = props.get(key); if (x == null) { System.out.println("Error: key not found:" + key); errors++; } else { if (!def.equals(x)) { System.out.println("Error: key " + key + "\n value expected: " + def + "\n value obtained: " + x); errors++; } } } if (errors > 0) { throw new RuntimeException(errors + " error(s) encountered in default properties verification"); } }
Example 5
Source File: Pack200Props.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private static void verifyDefaults() { Map<String, String> expectedDefaults = new HashMap<>(); Packer p = Pack200.newPacker(); expectedDefaults.put("com.sun.java.util.jar.pack.default.timezone", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.disable.native", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.verbose", "0"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "CompilationID", "RUH"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "SourceID", "RUH"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CharacterRangeTable", "NH[PHPOHIIH]"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CoverageTable", "NH[PHHII]"); expectedDefaults.put(p.DEFLATE_HINT, p.KEEP); expectedDefaults.put(p.EFFORT, "5"); expectedDefaults.put(p.KEEP_FILE_ORDER, p.TRUE); expectedDefaults.put(p.MODIFICATION_TIME, p.KEEP); expectedDefaults.put(p.SEGMENT_LIMIT, "-1"); expectedDefaults.put(p.UNKNOWN_ATTRIBUTE, p.PASS); Map<String, String> props = p.properties(); int errors = 0; for (String key : expectedDefaults.keySet()) { String def = expectedDefaults.get(key); String x = props.get(key); if (x == null) { System.out.println("Error: key not found:" + key); errors++; } else { if (!def.equals(x)) { System.out.println("Error: key " + key + "\n value expected: " + def + "\n value obtained: " + x); errors++; } } } if (errors > 0) { throw new RuntimeException(errors + " error(s) encountered in default properties verification"); } }
Example 6
Source File: Pack200Props.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private static void verifyDefaults() { Map<String, String> expectedDefaults = new HashMap<>(); Packer p = Pack200.newPacker(); expectedDefaults.put("com.sun.java.util.jar.pack.default.timezone", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.disable.native", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.verbose", "0"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "CompilationID", "RUH"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "SourceID", "RUH"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CharacterRangeTable", "NH[PHPOHIIH]"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CoverageTable", "NH[PHHII]"); expectedDefaults.put(p.DEFLATE_HINT, p.KEEP); expectedDefaults.put(p.EFFORT, "5"); expectedDefaults.put(p.KEEP_FILE_ORDER, p.TRUE); expectedDefaults.put(p.MODIFICATION_TIME, p.KEEP); expectedDefaults.put(p.SEGMENT_LIMIT, "-1"); expectedDefaults.put(p.UNKNOWN_ATTRIBUTE, p.PASS); Map<String, String> props = p.properties(); int errors = 0; for (String key : expectedDefaults.keySet()) { String def = expectedDefaults.get(key); String x = props.get(key); if (x == null) { System.out.println("Error: key not found:" + key); errors++; } else { if (!def.equals(x)) { System.out.println("Error: key " + key + "\n value expected: " + def + "\n value obtained: " + x); errors++; } } } if (errors > 0) { throw new RuntimeException(errors + " error(s) encountered in default properties verification"); } }
Example 7
Source File: Pack200Props.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private static void verifyDefaults() { Map<String, String> expectedDefaults = new HashMap<>(); Packer p = Pack200.newPacker(); expectedDefaults.put("com.sun.java.util.jar.pack.default.timezone", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.disable.native", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.verbose", "0"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "CompilationID", "RUH"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "SourceID", "RUH"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CharacterRangeTable", "NH[PHPOHIIH]"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CoverageTable", "NH[PHHII]"); expectedDefaults.put(p.DEFLATE_HINT, p.KEEP); expectedDefaults.put(p.EFFORT, "5"); expectedDefaults.put(p.KEEP_FILE_ORDER, p.TRUE); expectedDefaults.put(p.MODIFICATION_TIME, p.KEEP); expectedDefaults.put(p.SEGMENT_LIMIT, "-1"); expectedDefaults.put(p.UNKNOWN_ATTRIBUTE, p.PASS); Map<String, String> props = p.properties(); int errors = 0; for (String key : expectedDefaults.keySet()) { String def = expectedDefaults.get(key); String x = props.get(key); if (x == null) { System.out.println("Error: key not found:" + key); errors++; } else { if (!def.equals(x)) { System.out.println("Error: key " + key + "\n value expected: " + def + "\n value obtained: " + x); errors++; } } } if (errors > 0) { throw new RuntimeException(errors + " error(s) encountered in default properties verification"); } }
Example 8
Source File: SecurityTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public static void main(String... args) { System.setSecurityManager(new SecurityManager()); Pack200.newPacker(); Pack200.newUnpacker(); }
Example 9
Source File: Pack200Props.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private static void verifyDefaults() { log.info("start"); Map<String, String> expectedDefaults = new HashMap<>(); Packer p = Pack200.newPacker(); expectedDefaults.put("com.sun.java.util.jar.pack.disable.native", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.verbose", "0"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "CompilationID", "RUH"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "SourceID", "RUH"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CharacterRangeTable", "NH[PHPOHIIH]"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CoverageTable", "NH[PHHII]"); expectedDefaults.put(p.DEFLATE_HINT, p.KEEP); expectedDefaults.put(p.EFFORT, "5"); expectedDefaults.put(p.KEEP_FILE_ORDER, p.TRUE); expectedDefaults.put(p.MODIFICATION_TIME, p.KEEP); expectedDefaults.put(p.SEGMENT_LIMIT, "-1"); expectedDefaults.put(p.UNKNOWN_ATTRIBUTE, p.PASS); Map<String, String> props = p.properties(); int errors = 0; for (String key : expectedDefaults.keySet()) { String def = expectedDefaults.get(key); String x = props.get(key); if (x == null) { System.out.println("Error: key not found:" + key); errors++; } else { if (!def.equals(x)) { System.out.println("Error: key " + key + "\n value expected: " + def + "\n value obtained: " + x); errors++; } } } log.info("fini"); if (errors > 0) { throw new RuntimeException(errors + " error(s) encountered in default properties verification"); } }
Example 10
Source File: Pack200Props.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private static void verifyDefaults() { Map<String, String> expectedDefaults = new HashMap<>(); Packer p = Pack200.newPacker(); expectedDefaults.put("com.sun.java.util.jar.pack.default.timezone", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.disable.native", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.verbose", "0"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "CompilationID", "RUH"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "SourceID", "RUH"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CharacterRangeTable", "NH[PHPOHIIH]"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CoverageTable", "NH[PHHII]"); expectedDefaults.put(p.DEFLATE_HINT, p.KEEP); expectedDefaults.put(p.EFFORT, "5"); expectedDefaults.put(p.KEEP_FILE_ORDER, p.TRUE); expectedDefaults.put(p.MODIFICATION_TIME, p.KEEP); expectedDefaults.put(p.SEGMENT_LIMIT, "-1"); expectedDefaults.put(p.UNKNOWN_ATTRIBUTE, p.PASS); Map<String, String> props = p.properties(); int errors = 0; for (String key : expectedDefaults.keySet()) { String def = expectedDefaults.get(key); String x = props.get(key); if (x == null) { System.out.println("Error: key not found:" + key); errors++; } else { if (!def.equals(x)) { System.out.println("Error: key " + key + "\n value expected: " + def + "\n value obtained: " + x); errors++; } } } if (errors > 0) { throw new RuntimeException(errors + " error(s) encountered in default properties verification"); } }
Example 11
Source File: Pack200Props.java From hottub with GNU General Public License v2.0 | 4 votes |
private static void verifyDefaults() { Map<String, String> expectedDefaults = new HashMap<>(); Packer p = Pack200.newPacker(); expectedDefaults.put("com.sun.java.util.jar.pack.default.timezone", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.disable.native", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.verbose", "0"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "CompilationID", "RUH"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "SourceID", "RUH"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CharacterRangeTable", "NH[PHPOHIIH]"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CoverageTable", "NH[PHHII]"); expectedDefaults.put(p.DEFLATE_HINT, p.KEEP); expectedDefaults.put(p.EFFORT, "5"); expectedDefaults.put(p.KEEP_FILE_ORDER, p.TRUE); expectedDefaults.put(p.MODIFICATION_TIME, p.KEEP); expectedDefaults.put(p.SEGMENT_LIMIT, "-1"); expectedDefaults.put(p.UNKNOWN_ATTRIBUTE, p.PASS); Map<String, String> props = p.properties(); int errors = 0; for (String key : expectedDefaults.keySet()) { String def = expectedDefaults.get(key); String x = props.get(key); if (x == null) { System.out.println("Error: key not found:" + key); errors++; } else { if (!def.equals(x)) { System.out.println("Error: key " + key + "\n value expected: " + def + "\n value obtained: " + x); errors++; } } } if (errors > 0) { throw new RuntimeException(errors + " error(s) encountered in default properties verification"); } }
Example 12
Source File: Pack200Props.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private static void verifyDefaults() { Map<String, String> expectedDefaults = new HashMap<>(); Packer p = Pack200.newPacker(); expectedDefaults.put("com.sun.java.util.jar.pack.default.timezone", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.disable.native", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.verbose", "0"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "CompilationID", "RUH"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "SourceID", "RUH"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CharacterRangeTable", "NH[PHPOHIIH]"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CoverageTable", "NH[PHHII]"); expectedDefaults.put(p.DEFLATE_HINT, p.KEEP); expectedDefaults.put(p.EFFORT, "5"); expectedDefaults.put(p.KEEP_FILE_ORDER, p.TRUE); expectedDefaults.put(p.MODIFICATION_TIME, p.KEEP); expectedDefaults.put(p.SEGMENT_LIMIT, "-1"); expectedDefaults.put(p.UNKNOWN_ATTRIBUTE, p.PASS); Map<String, String> props = p.properties(); int errors = 0; for (String key : expectedDefaults.keySet()) { String def = expectedDefaults.get(key); String x = props.get(key); if (x == null) { System.out.println("Error: key not found:" + key); errors++; } else { if (!def.equals(x)) { System.out.println("Error: key " + key + "\n value expected: " + def + "\n value obtained: " + x); errors++; } } } if (errors > 0) { throw new RuntimeException(errors + " error(s) encountered in default properties verification"); } }
Example 13
Source File: Pack200Props.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private static void verifyDefaults() { Map<String, String> expectedDefaults = new HashMap<>(); Packer p = Pack200.newPacker(); expectedDefaults.put("com.sun.java.util.jar.pack.default.timezone", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.disable.native", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.verbose", "0"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "CompilationID", "RUH"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "SourceID", "RUH"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CharacterRangeTable", "NH[PHPOHIIH]"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CoverageTable", "NH[PHHII]"); expectedDefaults.put(p.DEFLATE_HINT, p.KEEP); expectedDefaults.put(p.EFFORT, "5"); expectedDefaults.put(p.KEEP_FILE_ORDER, p.TRUE); expectedDefaults.put(p.MODIFICATION_TIME, p.KEEP); expectedDefaults.put(p.SEGMENT_LIMIT, "-1"); expectedDefaults.put(p.UNKNOWN_ATTRIBUTE, p.PASS); Map<String, String> props = p.properties(); int errors = 0; for (String key : expectedDefaults.keySet()) { String def = expectedDefaults.get(key); String x = props.get(key); if (x == null) { System.out.println("Error: key not found:" + key); errors++; } else { if (!def.equals(x)) { System.out.println("Error: key " + key + "\n value expected: " + def + "\n value obtained: " + x); errors++; } } } if (errors > 0) { throw new RuntimeException(errors + " error(s) encountered in default properties verification"); } }
Example 14
Source File: Pack200Props.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private static void verifyDefaults() { Map<String, String> expectedDefaults = new HashMap<>(); Packer p = Pack200.newPacker(); expectedDefaults.put("com.sun.java.util.jar.pack.default.timezone", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.disable.native", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.verbose", "0"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "CompilationID", "RUH"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "SourceID", "RUH"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CharacterRangeTable", "NH[PHPOHIIH]"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CoverageTable", "NH[PHHII]"); expectedDefaults.put(p.DEFLATE_HINT, p.KEEP); expectedDefaults.put(p.EFFORT, "5"); expectedDefaults.put(p.KEEP_FILE_ORDER, p.TRUE); expectedDefaults.put(p.MODIFICATION_TIME, p.KEEP); expectedDefaults.put(p.SEGMENT_LIMIT, "-1"); expectedDefaults.put(p.UNKNOWN_ATTRIBUTE, p.PASS); Map<String, String> props = p.properties(); int errors = 0; for (String key : expectedDefaults.keySet()) { String def = expectedDefaults.get(key); String x = props.get(key); if (x == null) { System.out.println("Error: key not found:" + key); errors++; } else { if (!def.equals(x)) { System.out.println("Error: key " + key + "\n value expected: " + def + "\n value obtained: " + x); errors++; } } } if (errors > 0) { throw new RuntimeException(errors + " error(s) encountered in default properties verification"); } }
Example 15
Source File: Pack200Props.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private static void verifyDefaults() { Map<String, String> expectedDefaults = new HashMap<>(); Packer p = Pack200.newPacker(); expectedDefaults.put("com.sun.java.util.jar.pack.default.timezone", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.disable.native", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.verbose", "0"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "CompilationID", "RUH"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "SourceID", "RUH"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CharacterRangeTable", "NH[PHPOHIIH]"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CoverageTable", "NH[PHHII]"); expectedDefaults.put(p.DEFLATE_HINT, p.KEEP); expectedDefaults.put(p.EFFORT, "5"); expectedDefaults.put(p.KEEP_FILE_ORDER, p.TRUE); expectedDefaults.put(p.MODIFICATION_TIME, p.KEEP); expectedDefaults.put(p.SEGMENT_LIMIT, "-1"); expectedDefaults.put(p.UNKNOWN_ATTRIBUTE, p.PASS); Map<String, String> props = p.properties(); int errors = 0; for (String key : expectedDefaults.keySet()) { String def = expectedDefaults.get(key); String x = props.get(key); if (x == null) { System.out.println("Error: key not found:" + key); errors++; } else { if (!def.equals(x)) { System.out.println("Error: key " + key + "\n value expected: " + def + "\n value obtained: " + x); errors++; } } } if (errors > 0) { throw new RuntimeException(errors + " error(s) encountered in default properties verification"); } }
Example 16
Source File: Pack200Props.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
private static void verifyDefaults() { Map<String, String> expectedDefaults = new HashMap<>(); Packer p = Pack200.newPacker(); expectedDefaults.put("com.sun.java.util.jar.pack.default.timezone", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.disable.native", p.FALSE); expectedDefaults.put("com.sun.java.util.jar.pack.verbose", "0"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "CompilationID", "RUH"); expectedDefaults.put(p.CLASS_ATTRIBUTE_PFX + "SourceID", "RUH"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CharacterRangeTable", "NH[PHPOHIIH]"); expectedDefaults.put(p.CODE_ATTRIBUTE_PFX + "CoverageTable", "NH[PHHII]"); expectedDefaults.put(p.DEFLATE_HINT, p.KEEP); expectedDefaults.put(p.EFFORT, "5"); expectedDefaults.put(p.KEEP_FILE_ORDER, p.TRUE); expectedDefaults.put(p.MODIFICATION_TIME, p.KEEP); expectedDefaults.put(p.SEGMENT_LIMIT, "-1"); expectedDefaults.put(p.UNKNOWN_ATTRIBUTE, p.PASS); Map<String, String> props = p.properties(); int errors = 0; for (String key : expectedDefaults.keySet()) { String def = expectedDefaults.get(key); String x = props.get(key); if (x == null) { System.out.println("Error: key not found:" + key); errors++; } else { if (!def.equals(x)) { System.out.println("Error: key " + key + "\n value expected: " + def + "\n value obtained: " + x); errors++; } } } if (errors > 0) { throw new RuntimeException(errors + " error(s) encountered in default properties verification"); } }