bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/JspUtil.java
public static List<String> expandClassPath(List<String>files) {

        for (int i = 0; i < files.size(); i++) {
            String file = files.get(i);
            if (! file.endsWith(".jar")) {
                continue;
            }
            Manifest manifest = manifestMap.get(file);
            JarFile jarfile = null;
            if (manifest == null) {
                try {
                    jarfile = new JarFile(file, false);
                    manifest = jarfile.getManifest();
                    if (manifest == null) {
                        // mark jar file as known to contain no manifest
                        manifestMap.put(file, nullManifest);
                        continue;
                    } else if (! file.contains("/WEB-INF")) {
                        // Don't cache any jars bundled with the app.
                        manifestMap.put(file, manifest);
                    }
                } catch (IOException ex) {
                    // Ignored
                    continue;
                } finally {
                    try {
                        if (jarfile != null)
                            jarfile.close();
                    } catch (IOException ex) {
                        // Ignored
                    }
                }
            } else if (manifest == nullManifest) {
                continue;
            }

            java.util.jar.Attributes attrs = manifest.getMainAttributes();
            String cp = (String) attrs.getValue("Class-Path");
            if (cp == null) {
                continue;
            }

            String[] paths = cp.split(" ");
            int lastIndex = file.lastIndexOf(File.separatorChar);
            String baseDir = "";
            if (lastIndex > 0) {
                baseDir = file.substring(0, lastIndex+1);
            }
            for (String path: paths) {
                String p;
                if (path.startsWith(File.separator)) {
                    p = path;
                } else {
                    p = baseDir + path;
                }
                if (! files.contains(p)) {
                    files.add(p);
                }
            }
        }
        return files;
    }
public static List<String> expandClassPath(List<String>files) {

        for (int i = 0; i < files.size(); i++) {
            String file = files.get(i);
            if (! file.endsWith(".jar")) {
                continue;
            }
            Manifest manifest = manifestMap.get(file);
            JarFile jarfile = null;
            if (manifest == null) {
                try {
                    jarfile = new JarFile(file, false);
                    manifest = jarfile.getManifest();
                    if (manifest == null) {
                        // mark jar file as known to contain no manifest
                        manifestMap.put(file, nullManifest);
                        continue;
                    } else if (! file.contains("/WEB-INF")) {
                        // Don't cache any jars bundled with the app.
                        manifestMap.put(file, manifest);
                    }
                } catch (IOException ex) {
                    // Ignored
                    continue;
                } finally {
                    try {
                        if (jarfile != null)
                            jarfile.close();
                    } catch (IOException ex) {
                        // Ignored
                    }
                }
            } else if (manifest == nullManifest) {
                continue;
            }

            java.util.jar.Attributes attrs = manifest.getMainAttributes();
            String cp = (String) attrs.getValue("Class-Path");
            if (cp == null) {
                continue;
            }

            String[] paths = cp.split(" ");
            int lastIndex = file.lastIndexOf(File.separatorChar);
            String baseDir = "";
            if (lastIndex > 0) {
                baseDir = file.substring(0, lastIndex+1);
            }
            for (String path: paths) {
                String p;
                if (path.startsWith(File.separator)) {
                    p = path;
                } else {
                    p = baseDir + path;
                }
                if (! files.contains(p)) {
                    files.add(p);
                }
            }
        }
        return files;
    }
public static List < String > expandClassPath ( List < String > files ) { for ( int i = 0 ; i < files . size ( ) ; i ++ ) { String file = files . get ( i ) ; if ( ! file . endsWith ( ".jar" ) ) { continue ; } Manifest manifest = manifestMap . get ( file ) ; JarFile jarfile = null ; if ( manifest == null ) { try { jarfile = new JarFile ( file , false ) ; manifest = jarfile . getManifest ( ) ; if ( manifest == null ) { // mark jar file as known to contain no manifest manifestMap . put ( file , nullManifest ) ; continue ; } else if ( ! file . contains ( "/WEB-INF" ) ) { // Don't cache any jars bundled with the app. manifestMap . put ( file , manifest ) ; } } catch ( IOException ex ) { // Ignored continue ; } finally { try { if ( jarfile != null ) jarfile . close ( ) ; } catch ( IOException ex ) { // Ignored } } } else if ( manifest == nullManifest ) { continue ; } java . util . jar . Attributes attrs = manifest . getMainAttributes ( ) ; String cp = ( String ) attrs . getValue ( "Class-Path" ) ; if ( cp == null ) { continue ; } String [ ] paths = cp . split ( " " ) ; int lastIndex = file . lastIndexOf ( File . separatorChar ) ; String baseDir = "" ; if ( lastIndex > 0 ) { baseDir = file . substring ( 0 , lastIndex + 1 ) ; } for ( String path : paths ) { String p ; if ( path . startsWith ( File . separator ) ) { p = path ; } else { p = baseDir + path ; } if ( ! files . contains ( p ) ) { files . add ( p ) ; } } } return files ; }
Given a list of jar files, their manifest attribute Class-path are
scanned, and jars specified there are added to the list.  This is
carried out recursively.
Note:  This is needed to work around the JDK bug 6725230.
Given a list of jar files their manifest attribute Class - path are scanned and jars specified there are added to the list . This is carried out recursively . Note : This is needed to work around the JDK bug 6725230 .