You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-cvs@xml.apache.org by cu...@apache.org on 2002/06/20 21:59:24 UTC

cvs commit: xml-commons/java/src/org/apache/env WhichJar.java

curcuru     2002/06/20 12:59:24

  Modified:    java/src/org/apache/env WhichJar.java
  Log:
  Stop comparing .jar names as toLowerCase();
  update getClasspathInfo to catch exceptions with private worker method
  
  Revision  Changes    Path
  1.2       +25 -10    xml-commons/java/src/org/apache/env/WhichJar.java
  
  Index: WhichJar.java
  ===================================================================
  RCS file: /home/cvs/xml-commons/java/src/org/apache/env/WhichJar.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WhichJar.java	11 Dec 2001 17:42:50 -0000	1.1
  +++ WhichJar.java	20 Jun 2002 19:59:23 -0000	1.2
  @@ -83,11 +83,28 @@
        */
       public static void getClasspathInfo(Hashtable hash, String options)
       {
  +        logProperty(hash, "java.class.path");
  +        logProperty(hash, "sun.boot.class.path");
  +        logProperty(hash, "java.ext.dirs");
  +    }
   
  -        hash.put("java.class.path", System.getProperty("java.class.path"));
  -        hash.put("sun.boot.class.path",
  -                 System.getProperty("sun.boot.class.path"));
  -        hash.put("java.ext.dirs", System.getProperty("java.ext.dirs"));
  +    /**
  +     * Worker method to print System.getProperty without 
  +     * putting nulls and catching exceptions.
  +     *
  +     * @param hash to put information in
  +     * @param propName to log
  +     */
  +    private static void logProperty(Hashtable hash, String propertyName)
  +    {
  +        try
  +        {
  +            hash.put(propertyName, System.getProperty(propertyName));
  +        } 
  +        catch (Throwable t)
  +        {
  +            /* no-op: ignore */
  +        }
       }
   
       /** SERVICE_NAME.  */
  @@ -147,9 +164,7 @@
           while (st.hasMoreTokens())
           {
   
  -            // Compare as lower case to avoid case problems
  -            //  NOTE: we are case-insensitive!
  -            String jarURI = st.nextToken().toLowerCase();
  +            String jarURI = st.nextToken();
   
               // If a path entry contains our jarName, process it
               if (jarURI.indexOf(jarName) > -1)
  @@ -229,7 +244,7 @@
           // Search each dir and compile status
           while (st.hasMoreTokens())
           {
  -            String dir = st.nextToken().toLowerCase();
  +            String dir = st.nextToken();
   
               retVal = Math.max(retVal, searchDir(hash, dir, jarName, options));
           }