remm        2004/04/10 16:39:40

  Modified:    catalina/src/share/org/apache/catalina/util
                        ExtensionValidator.java
  Log:
  - Remove the hadcoding of the extension validator.
  - I think all the JARs from the common and shared CLs should be added to it.
  
  Revision  Changes    Path
  1.11      +55 -43    
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/ExtensionValidator.java
  
  Index: ExtensionValidator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/ExtensionValidator.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ExtensionValidator.java   5 Apr 2004 20:32:34 -0000       1.10
  +++ ExtensionValidator.java   10 Apr 2004 23:39:40 -0000      1.11
  @@ -102,30 +102,9 @@
               }
           }
   
  -        // get the files in the extensions directory
  -        String extensionsDir = System.getProperty("java.ext.dirs");
  -        if (extensionsDir != null) {
  -            StringTokenizer extensionsTok
  -                = new StringTokenizer(extensionsDir, File.pathSeparator);
  -            while (extensionsTok.hasMoreTokens()) {
  -                File targetDir = new File(extensionsTok.nextToken());
  -                if (!targetDir.exists() || !targetDir.isDirectory()) {
  -                    continue;
  -                }
  -                File[] files = targetDir.listFiles();
  -                for (int i = 0; i < files.length; i++) {
  -                    if (files[i].getName().toLowerCase().endsWith(".jar")) {
  -                        try {
  -                            addSystemResource(files[i]);
  -                        } catch (IOException e) {
  -                            log.error
  -                                (sm.getString
  -                                 ("extensionValidator.failload", files[i]), e);
  -                        }
  -                    }
  -                }
  -            }
  -        }
  +        // add specified folders to the list
  +        addFolderList("java.ext.dirs");
  +        addFolderList("catalina.ext.dirs");
   
       }
   
  @@ -223,6 +202,28 @@
       }
   
   
  +    /**
  +     * Checks to see if the given system JAR file contains a MANIFEST, and adds
  +     * it to the container's manifest resources.
  +     *
  +     * @param jarFile The system JAR whose manifest to add
  +     */
  +    public static void addSystemResource(File jarFile) throws IOException {
  +
  +        Manifest manifest = getManifest(new FileInputStream(jarFile));
  +        if (manifest != null)  {
  +            ManifestResource mre
  +                = new ManifestResource(jarFile.getAbsolutePath(),
  +                                       manifest,
  +                                       ManifestResource.SYSTEM);
  +            if (containerManifestResources == null) {
  +                containerManifestResources = new ArrayList();
  +            }
  +            containerManifestResources.add(mre);
  +        }
  +    }
  +
  +
       // -------------------------------------------------------- Private Methods
   
   
  @@ -384,28 +385,39 @@
   
           return manifest;
       }
  -    
  -    /*
  -     * Checks to see if the given system JAR file contains a MANIFEST, and adds
  -     * it to the container's manifest resources.
  -     *
  -     * @param jarFile The system JAR whose manifest to add
  +
  +
  +    /**
  +     * Add the JARs specified to the extension list.
        */
  -    private static void addSystemResource(File jarFile) throws IOException {
  +    private static void addFolderList(String property) {
   
  -        Manifest manifest = getManifest(new FileInputStream(jarFile));
  -        if (manifest != null)  {
  -            ManifestResource mre
  -                = new ManifestResource(jarFile.getAbsolutePath(),
  -                                       manifest,
  -                                       ManifestResource.SYSTEM);
  -            if (containerManifestResources == null) {
  -                containerManifestResources = new ArrayList();
  +        // get the files in the extensions directory
  +        String extensionsDir = System.getProperty(property);
  +        if (extensionsDir != null) {
  +            StringTokenizer extensionsTok
  +                = new StringTokenizer(extensionsDir, File.pathSeparator);
  +            while (extensionsTok.hasMoreTokens()) {
  +                File targetDir = new File(extensionsTok.nextToken());
  +                if (!targetDir.exists() || !targetDir.isDirectory()) {
  +                    continue;
  +                }
  +                File[] files = targetDir.listFiles();
  +                for (int i = 0; i < files.length; i++) {
  +                    if (files[i].getName().toLowerCase().endsWith(".jar")) {
  +                        try {
  +                            addSystemResource(files[i]);
  +                        } catch (IOException e) {
  +                            log.error
  +                                (sm.getString
  +                                 ("extensionValidator.failload", files[i]), e);
  +                        }
  +                    }
  +                }
               }
  -            containerManifestResources.add(mre);
           }
  -    }
   
  -}
  +    }
   
   
  +}
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to