List<File> findNonJdkJars() throws IOException, SAXException, XPathExpressionException, ParserConfigurationException {
        Enumeration<URL> manifests = LibraryVersions.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
        String javaHome = System.getProperty("java.home");
        List<File> ret = new LinkedList<File>();
        while (manifests.hasMoreElements()) {
            URL u = manifests.nextElement();
            // jar:file:/home/username/.m2/repository/org/slf4j/slf4j-jdk14/1.5.0/slf4j-jdk14-1.5.0.jar!/META-INF/MANIFEST.MF
            // we're not interested if it's not a jar, although how you'd have a MANIFEST.MF which wasn't in a jar?
            if (u.getProtocol().equals("jar")) {
                // file:/home/username/.m2/repository/com/betfair/tornjak/kpi/3.0-SNAPSHOT/kpi-3.0-SNAPSHOT.jar!/META-INF/MANIFEST.MF
                String file = u.getFile();
                // file:/home/username/.m2/repository/com/betfair/tornjak/kpi/3.0-SNAPSHOT/kpi-3.0-SNAPSHOT.jar
                file = file.substring(0, file.indexOf("!"));
                // /home/username/.m2/repository/com/betfair/tornjak/kpi/3.0-SNAPSHOT/kpi-3.0-SNAPSHOT.jar
                file = file.substring(5);
                // remove %20 etc
                file = URLDecoder.decode(file, "UTF-8");
                File f = new File(file);
                String canonicalPath = f.getCanonicalPath();
                if (!canonicalPath.startsWith(javaHome)) {
                    ret.add(f);
                }
            } else {
                logger.info("Can't include code in checksum which isn't in a JAR: " + u);
            }
        }
        return ret;
    }
List < File > findNonJdkJars ( ) throws IOException , SAXException , XPathExpressionException , ParserConfigurationException { Enumeration < URL > manifests = LibraryVersions . class . getClassLoader ( ) . getResources ( "META-INF/MANIFEST.MF" ) ; String javaHome = System . getProperty ( "java.home" ) ; List < File > ret = new LinkedList < File > ( ) ; while ( manifests . hasMoreElements ( ) ) { URL u = manifests . nextElement ( ) ; if ( u . getProtocol ( ) . equals ( "jar" ) ) { String file = u . getFile ( ) ; file = file . substring ( 0 , file . indexOf ( "!" ) ) ; file = file . substring ( 5 ) ; file = URLDecoder . decode ( file , "UTF-8" ) ; File f = new File ( file ) ; String canonicalPath = f . getCanonicalPath ( ) ; if ( ! canonicalPath . startsWith ( javaHome ) ) { ret . add ( f ) ; } } else { logger . info ( "Can't include code in checksum which isn't in a JAR: " + u ) ; } } return ret ; }
package private for testing purposes