java.util.jar.Pack200.Packer Java Examples

The following examples show how to use java.util.jar.Pack200.Packer. 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 vote down vote up
/**
 * @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: DefaultPack200Tool.java    From webstart with MIT License 5 votes vote down vote up
@Override
public File packJar( File jarFile, boolean gzip, List<String> passFiles )
        throws IOException
{
    final String extension = gzip ? PACK_GZ_EXTENSION : PACK_EXTENSION;

    File pack200Jar = new File( jarFile.getParentFile(), jarFile.getName() + extension );

    deleteFile( pack200Jar );

    Map<String, String> propMap = new HashMap<>();
    // Work around a JDK bug affecting large JAR files, see MWEBSTART-125
    propMap.put( Pack200.Packer.SEGMENT_LIMIT, String.valueOf( -1 ) );

    // set passFiles if available
    if ( passFiles != null && !passFiles.isEmpty() )
    {
        for ( int j = 0; j < passFiles.size(); j++ )
        {
            propMap.put( Packer.PASS_FILE_PFX + j, passFiles.get( j ) );
        }
    }

    pack( jarFile, pack200Jar, propMap, gzip );
    setLastModified( pack200Jar, jarFile.lastModified() );
    return pack200Jar;
}
 
Example #3
Source File: DefaultPack200Tool.java    From webstart with MIT License 5 votes vote down vote up
@Override
public void packJars( File directory, FileFilter jarFileFilter, boolean gzip, List<String> passFiles )
        throws IOException
{
    // getLog().debug( "packJars for " + directory );
    File[] jarFiles = directory.listFiles( jarFileFilter );
    for ( File jarFile1 : jarFiles )
    {
        // getLog().debug( "packJars: " + jarFiles[i] );

        final String extension = gzip ? PACK_GZ_EXTENSION : PACK_EXTENSION;

        File jarFile = jarFile1;

        File pack200Jar = new File( jarFile.getParentFile(), jarFile.getName() + extension );

        deleteFile( pack200Jar );

        Map<String, String> propMap = new HashMap<>();
        // Work around a JDK bug affecting large JAR files, see MWEBSTART-125
        propMap.put( Pack200.Packer.SEGMENT_LIMIT, String.valueOf( -1 ) );

        // set passFiles if available
        if ( passFiles != null && !passFiles.isEmpty() )
        {
            for ( int j = 0; j < passFiles.size(); j++ )
            {
                propMap.put( Packer.PASS_FILE_PFX + j, passFiles.get( j ) );
            }
        }

        pack( jarFile, pack200Jar, propMap, gzip );
        setLastModified( pack200Jar, jarFile.lastModified() );
    }
}
 
Example #4
Source File: Pack200Props.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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 jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
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: Reflect.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    printMethods(Pack200.Packer.class);
    printMethods(Pack200.Unpacker.class);
    printMethods(Pack200.newPacker().getClass());
    printMethods(Pack200.newUnpacker().getClass());
}
 
Example #7
Source File: Pack200Props.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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: Reflect.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    printMethods(Pack200.Packer.class);
    printMethods(Pack200.Unpacker.class);
    printMethods(Pack200.newPacker().getClass());
    printMethods(Pack200.newUnpacker().getClass());
}
 
Example #9
Source File: Pack200Props.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
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 #10
Source File: Reflect.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    printMethods(Pack200.Packer.class);
    printMethods(Pack200.Unpacker.class);
    printMethods(Pack200.newPacker().getClass());
    printMethods(Pack200.newUnpacker().getClass());
}
 
Example #11
Source File: Pack200Props.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
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: Reflect.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    printMethods(Pack200.Packer.class);
    printMethods(Pack200.Unpacker.class);
    printMethods(Pack200.newPacker().getClass());
    printMethods(Pack200.newUnpacker().getClass());
}
 
Example #13
Source File: Pack200Props.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
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: Reflect.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    printMethods(Pack200.Packer.class);
    printMethods(Pack200.Unpacker.class);
    printMethods(Pack200.newPacker().getClass());
    printMethods(Pack200.newUnpacker().getClass());
}
 
Example #15
Source File: Pack200Props.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
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: Reflect.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    printMethods(Pack200.Packer.class);
    printMethods(Pack200.Unpacker.class);
    printMethods(Pack200.newPacker().getClass());
    printMethods(Pack200.newUnpacker().getClass());
}
 
Example #17
Source File: Reflect.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    printMethods(Pack200.Packer.class);
    printMethods(Pack200.Unpacker.class);
    printMethods(Pack200.newPacker().getClass());
    printMethods(Pack200.newUnpacker().getClass());
}
 
Example #18
Source File: Reflect.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    printMethods(Pack200.Packer.class);
    printMethods(Pack200.Unpacker.class);
    printMethods(Pack200.newPacker().getClass());
    printMethods(Pack200.newUnpacker().getClass());
}
 
Example #19
Source File: Pack200Props.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
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 #20
Source File: Pack.java    From ramus with GNU General Public License v3.0 4 votes vote down vote up
private static void pack(Packer packer, File inputDirectory,
                         File outputDirectory) throws IOException, FileNotFoundException {
    File[] files = inputDirectory.listFiles();

    for (int i = 0; i < files.length; i++) {
        File file = files[i];
        if (file.isFile()) {
            if (file.getName().endsWith(".jar")) {

                String fn = file.getName().substring(0,
                        file.getName().length() - 4)
                        + ".pack";

                JarFile input = new JarFile(file);
                String fileName = outputDirectory.getAbsolutePath()
                        + File.separator + fn;
                OutputStream stream = new FileOutputStream(fileName);

                System.out
                        .println(file.getAbsolutePath() + "->" + fileName);
                packer.pack(input, stream);
            } else {
                FileInputStream fis = new FileInputStream(file);
                FileOutputStream fos = new FileOutputStream(new File(
                        outputDirectory, file.getName()));
                byte[] buff = new byte[1024 * 64];
                int r;
                while ((r = fis.read(buff)) > 0) {
                    fos.write(buff, 0, r);
                }
                fis.close();
                fos.close();
            }
        } else if (file.isDirectory()) {
            File outputDirectory2 = new File(outputDirectory, file
                    .getName());
            outputDirectory2.mkdir();
            pack(packer, file, outputDirectory2);
        }
    }
}
 
Example #21
Source File: Pack200Props.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
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 #22
Source File: Reflect.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    printMethods(Pack200.Packer.class);
    printMethods(Pack200.Unpacker.class);
    printMethods(Pack200.newPacker().getClass());
    printMethods(Pack200.newUnpacker().getClass());
}
 
Example #23
Source File: Pack200Props.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
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 #24
Source File: Reflect.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    printMethods(Pack200.Packer.class);
    printMethods(Pack200.Unpacker.class);
    printMethods(Pack200.newPacker().getClass());
    printMethods(Pack200.newUnpacker().getClass());
}
 
Example #25
Source File: Pack200Props.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
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 #26
Source File: Reflect.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    printMethods(Pack200.Packer.class);
    printMethods(Pack200.Unpacker.class);
    printMethods(Pack200.newPacker().getClass());
    printMethods(Pack200.newUnpacker().getClass());
}
 
Example #27
Source File: Pack200Props.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
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 #28
Source File: Reflect.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    printMethods(Pack200.Packer.class);
    printMethods(Pack200.Unpacker.class);
    printMethods(Pack200.newPacker().getClass());
    printMethods(Pack200.newUnpacker().getClass());
}
 
Example #29
Source File: Pack200Props.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
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");
    }
}