Java Code Examples for com.sun.tools.javac.file.ZipArchive.ZipFileObject

The following examples show how to use com.sun.tools.javac.file.ZipArchive.ZipFileObject. These examples are extracted from open source projects. 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 Project: TencentKona-8   Source File: T6705935.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void run() throws Exception {
    File java_home = new File(System.getProperty("java.home"));
    if (java_home.getName().equals("jre"))
        java_home = java_home.getParentFile();

    JavaCompiler c = ToolProvider.getSystemJavaCompiler();
    StandardJavaFileManager fm = c.getStandardFileManager(null, null, null);
    //System.err.println("platform class path: " + asList(fm.getLocation(StandardLocation.PLATFORM_CLASS_PATH)));

    for (JavaFileObject fo: fm.list(StandardLocation.PLATFORM_CLASS_PATH,
                                    "java.lang",
                                    Collections.singleton(JavaFileObject.Kind.CLASS),
                                    false)) {
        test++;

        if (!(fo instanceof ZipFileObject || fo instanceof ZipFileIndexFileObject)) {
            System.out.println("Skip " + fo.getClass().getSimpleName() + " " + fo.getName());
            skip++;
            continue;
        }

        //System.err.println(fo.getName());
        String p = fo.getName();
        int bra = p.indexOf("(");
        int ket = p.indexOf(")");
        //System.err.println(bra + "," + ket + "," + p.length());
        if (bra == -1 || ket != p.length() -1)
            throw new Exception("unexpected path: " + p + "[" + bra + "," + ket + "," + p.length());
        String part1 = p.substring(0, bra);
        String part2 = p.substring(bra + 1, ket);
        //System.err.println("[" + part1 + "|" + part2 + "]" + " " + java_home);
        if (part1.equals(part2) || !part1.startsWith(java_home.getPath()))
            throw new Exception("bad path: " + p);

    }

    if (test == 0)
        throw new Exception("no files found");

    if (skip == 0)
        System.out.println(test + " files found");
    else
        System.out.println(test + " files found, " + skip + " files skipped");

    if (test == skip)
        System.out.println("Warning: all files skipped; no platform classes found in zip files.");
}
 
Example 2
Source Project: jdk8u60   Source File: T6705935.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void run() throws Exception {
    File java_home = new File(System.getProperty("java.home"));
    if (java_home.getName().equals("jre"))
        java_home = java_home.getParentFile();

    JavaCompiler c = ToolProvider.getSystemJavaCompiler();
    StandardJavaFileManager fm = c.getStandardFileManager(null, null, null);
    //System.err.println("platform class path: " + asList(fm.getLocation(StandardLocation.PLATFORM_CLASS_PATH)));

    for (JavaFileObject fo: fm.list(StandardLocation.PLATFORM_CLASS_PATH,
                                    "java.lang",
                                    Collections.singleton(JavaFileObject.Kind.CLASS),
                                    false)) {
        test++;

        if (!(fo instanceof ZipFileObject || fo instanceof ZipFileIndexFileObject)) {
            System.out.println("Skip " + fo.getClass().getSimpleName() + " " + fo.getName());
            skip++;
            continue;
        }

        //System.err.println(fo.getName());
        String p = fo.getName();
        int bra = p.indexOf("(");
        int ket = p.indexOf(")");
        //System.err.println(bra + "," + ket + "," + p.length());
        if (bra == -1 || ket != p.length() -1)
            throw new Exception("unexpected path: " + p + "[" + bra + "," + ket + "," + p.length());
        String part1 = p.substring(0, bra);
        String part2 = p.substring(bra + 1, ket);
        //System.err.println("[" + part1 + "|" + part2 + "]" + " " + java_home);
        if (part1.equals(part2) || !part1.startsWith(java_home.getPath()))
            throw new Exception("bad path: " + p);

    }

    if (test == 0)
        throw new Exception("no files found");

    if (skip == 0)
        System.out.println(test + " files found");
    else
        System.out.println(test + " files found, " + skip + " files skipped");

    if (test == skip)
        System.out.println("Warning: all files skipped; no platform classes found in zip files.");
}
 
Example 3
Source Project: openjdk-jdk8u   Source File: T6705935.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void run() throws Exception {
    File java_home = new File(System.getProperty("java.home"));
    if (java_home.getName().equals("jre"))
        java_home = java_home.getParentFile();

    JavaCompiler c = ToolProvider.getSystemJavaCompiler();
    StandardJavaFileManager fm = c.getStandardFileManager(null, null, null);
    //System.err.println("platform class path: " + asList(fm.getLocation(StandardLocation.PLATFORM_CLASS_PATH)));

    for (JavaFileObject fo: fm.list(StandardLocation.PLATFORM_CLASS_PATH,
                                    "java.lang",
                                    Collections.singleton(JavaFileObject.Kind.CLASS),
                                    false)) {
        test++;

        if (!(fo instanceof ZipFileObject || fo instanceof ZipFileIndexFileObject)) {
            System.out.println("Skip " + fo.getClass().getSimpleName() + " " + fo.getName());
            skip++;
            continue;
        }

        //System.err.println(fo.getName());
        String p = fo.getName();
        int bra = p.indexOf("(");
        int ket = p.indexOf(")");
        //System.err.println(bra + "," + ket + "," + p.length());
        if (bra == -1 || ket != p.length() -1)
            throw new Exception("unexpected path: " + p + "[" + bra + "," + ket + "," + p.length());
        String part1 = p.substring(0, bra);
        String part2 = p.substring(bra + 1, ket);
        //System.err.println("[" + part1 + "|" + part2 + "]" + " " + java_home);
        if (part1.equals(part2) || !part1.startsWith(java_home.getPath()))
            throw new Exception("bad path: " + p);

    }

    if (test == 0)
        throw new Exception("no files found");

    if (skip == 0)
        System.out.println(test + " files found");
    else
        System.out.println(test + " files found, " + skip + " files skipped");

    if (test == skip)
        System.out.println("Warning: all files skipped; no platform classes found in zip files.");
}
 
Example 4
public void run() throws Exception {
    File java_home = new File(System.getProperty("java.home"));
    if (java_home.getName().equals("jre"))
        java_home = java_home.getParentFile();

    JavaCompiler c = ToolProvider.getSystemJavaCompiler();
    StandardJavaFileManager fm = c.getStandardFileManager(null, null, null);
    //System.err.println("platform class path: " + asList(fm.getLocation(StandardLocation.PLATFORM_CLASS_PATH)));

    for (JavaFileObject fo: fm.list(StandardLocation.PLATFORM_CLASS_PATH,
                                    "java.lang",
                                    Collections.singleton(JavaFileObject.Kind.CLASS),
                                    false)) {
        test++;

        if (!(fo instanceof ZipFileObject || fo instanceof ZipFileIndexFileObject)) {
            System.out.println("Skip " + fo.getClass().getSimpleName() + " " + fo.getName());
            skip++;
            continue;
        }

        //System.err.println(fo.getName());
        String p = fo.getName();
        int bra = p.indexOf("(");
        int ket = p.indexOf(")");
        //System.err.println(bra + "," + ket + "," + p.length());
        if (bra == -1 || ket != p.length() -1)
            throw new Exception("unexpected path: " + p + "[" + bra + "," + ket + "," + p.length());
        String part1 = p.substring(0, bra);
        String part2 = p.substring(bra + 1, ket);
        //System.err.println("[" + part1 + "|" + part2 + "]" + " " + java_home);
        if (part1.equals(part2) || !part1.startsWith(java_home.getPath()))
            throw new Exception("bad path: " + p);

    }

    if (test == 0)
        throw new Exception("no files found");

    if (skip == 0)
        System.out.println(test + " files found");
    else
        System.out.println(test + " files found, " + skip + " files skipped");

    if (test == skip)
        System.out.println("Warning: all files skipped; no platform classes found in zip files.");
}
 
Example 5
Source Project: hottub   Source File: T6705935.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void run() throws Exception {
    File java_home = new File(System.getProperty("java.home"));
    if (java_home.getName().equals("jre"))
        java_home = java_home.getParentFile();

    JavaCompiler c = ToolProvider.getSystemJavaCompiler();
    StandardJavaFileManager fm = c.getStandardFileManager(null, null, null);
    //System.err.println("platform class path: " + asList(fm.getLocation(StandardLocation.PLATFORM_CLASS_PATH)));

    for (JavaFileObject fo: fm.list(StandardLocation.PLATFORM_CLASS_PATH,
                                    "java.lang",
                                    Collections.singleton(JavaFileObject.Kind.CLASS),
                                    false)) {
        test++;

        if (!(fo instanceof ZipFileObject || fo instanceof ZipFileIndexFileObject)) {
            System.out.println("Skip " + fo.getClass().getSimpleName() + " " + fo.getName());
            skip++;
            continue;
        }

        //System.err.println(fo.getName());
        String p = fo.getName();
        int bra = p.indexOf("(");
        int ket = p.indexOf(")");
        //System.err.println(bra + "," + ket + "," + p.length());
        if (bra == -1 || ket != p.length() -1)
            throw new Exception("unexpected path: " + p + "[" + bra + "," + ket + "," + p.length());
        String part1 = p.substring(0, bra);
        String part2 = p.substring(bra + 1, ket);
        //System.err.println("[" + part1 + "|" + part2 + "]" + " " + java_home);
        if (part1.equals(part2) || !part1.startsWith(java_home.getPath()))
            throw new Exception("bad path: " + p);

    }

    if (test == 0)
        throw new Exception("no files found");

    if (skip == 0)
        System.out.println(test + " files found");
    else
        System.out.println(test + " files found, " + skip + " files skipped");

    if (test == skip)
        System.out.println("Warning: all files skipped; no platform classes found in zip files.");
}
 
Example 6
Source Project: openjdk-8-source   Source File: T6705935.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void run() throws Exception {
    File java_home = new File(System.getProperty("java.home"));
    if (java_home.getName().equals("jre"))
        java_home = java_home.getParentFile();

    JavaCompiler c = ToolProvider.getSystemJavaCompiler();
    StandardJavaFileManager fm = c.getStandardFileManager(null, null, null);
    //System.err.println("platform class path: " + asList(fm.getLocation(StandardLocation.PLATFORM_CLASS_PATH)));

    for (JavaFileObject fo: fm.list(StandardLocation.PLATFORM_CLASS_PATH,
                                    "java.lang",
                                    Collections.singleton(JavaFileObject.Kind.CLASS),
                                    false)) {
        test++;

        if (!(fo instanceof ZipFileObject || fo instanceof ZipFileIndexFileObject)) {
            System.out.println("Skip " + fo.getClass().getSimpleName() + " " + fo.getName());
            skip++;
            continue;
        }

        //System.err.println(fo.getName());
        String p = fo.getName();
        int bra = p.indexOf("(");
        int ket = p.indexOf(")");
        //System.err.println(bra + "," + ket + "," + p.length());
        if (bra == -1 || ket != p.length() -1)
            throw new Exception("unexpected path: " + p + "[" + bra + "," + ket + "," + p.length());
        String part1 = p.substring(0, bra);
        String part2 = p.substring(bra + 1, ket);
        //System.err.println("[" + part1 + "|" + part2 + "]" + " " + java_home);
        if (part1.equals(part2) || !part1.startsWith(java_home.getPath()))
            throw new Exception("bad path: " + p);

    }

    if (test == 0)
        throw new Exception("no files found");

    if (skip == 0)
        System.out.println(test + " files found");
    else
        System.out.println(test + " files found, " + skip + " files skipped");

    if (test == skip)
        System.out.println("Warning: all files skipped; no platform classes found in zip files.");
}
 
Example 7
Source Project: openjdk-8   Source File: T6705935.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void run() throws Exception {
    File java_home = new File(System.getProperty("java.home"));
    if (java_home.getName().equals("jre"))
        java_home = java_home.getParentFile();

    JavaCompiler c = ToolProvider.getSystemJavaCompiler();
    StandardJavaFileManager fm = c.getStandardFileManager(null, null, null);
    //System.err.println("platform class path: " + asList(fm.getLocation(StandardLocation.PLATFORM_CLASS_PATH)));

    for (JavaFileObject fo: fm.list(StandardLocation.PLATFORM_CLASS_PATH,
                                    "java.lang",
                                    Collections.singleton(JavaFileObject.Kind.CLASS),
                                    false)) {
        test++;

        if (!(fo instanceof ZipFileObject || fo instanceof ZipFileIndexFileObject)) {
            System.out.println("Skip " + fo.getClass().getSimpleName() + " " + fo.getName());
            skip++;
            continue;
        }

        //System.err.println(fo.getName());
        String p = fo.getName();
        int bra = p.indexOf("(");
        int ket = p.indexOf(")");
        //System.err.println(bra + "," + ket + "," + p.length());
        if (bra == -1 || ket != p.length() -1)
            throw new Exception("unexpected path: " + p + "[" + bra + "," + ket + "," + p.length());
        String part1 = p.substring(0, bra);
        String part2 = p.substring(bra + 1, ket);
        //System.err.println("[" + part1 + "|" + part2 + "]" + " " + java_home);
        if (part1.equals(part2) || !part1.startsWith(java_home.getPath()))
            throw new Exception("bad path: " + p);

    }

    if (test == 0)
        throw new Exception("no files found");

    if (skip == 0)
        System.out.println(test + " files found");
    else
        System.out.println(test + " files found, " + skip + " files skipped");

    if (test == skip)
        System.out.println("Warning: all files skipped; no platform classes found in zip files.");
}