JdkCompat.java has two static declarations of itself, compat and jdkCompat. Which could be OK but getJdkCompat() returns jdkCompat while init() assigns a JdkCompat instance to compat. The side effect is the usage of JdkCompat fails and no webapps may run because of NPE.

Attached is a patch which removes all refs to compat and renames to jdkCompat. This patch also detabs the file.

Thanks Bill for getting this in!

-Tim

Index: JdkCompat.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/compat/JdkCompat.java,v
retrieving revision 1.2
diff -u -r1.2 JdkCompat.java
--- JdkCompat.java      4 Feb 2003 07:16:47 -0000       1.2
+++ JdkCompat.java      4 Feb 2003 13:47:32 -0000
@@ -86,10 +86,6 @@
     public static final String JDK14_CLASS = "org.apache.catalina.util.Jdk14Compat";
 
     // ------------------------------------------------------- Static Variables
-    /**
-     *  The static instance holder.
-     */
-    static JdkCompat jdkCompat;
 
     /**
      *  Commons logger wrapper
@@ -99,19 +95,19 @@
     /** Return java version as a string
      */
     public static String getJavaVersion() {
-       return javaVersion;
+        return javaVersion;
     }
 
     public static boolean isJava2() {
-       return java2;
-    } 
-   
+        return java2;
+    }
+
     public static boolean isJava14() {
-       return java14;
+        return java14;
     }
 
     // -------------------- Implementation --------------------
-    
+
     // from ant
     public static final String JAVA_1_0 = "1.0";
     public static final String JAVA_1_1 = "1.1";
@@ -122,15 +118,15 @@
     static String javaVersion;
     static boolean java2=false;
     static boolean java14=false;
-    static JdkCompat compat;
-    
+    static JdkCompat jdkCompat;
+
     static {
-       init();
+        init();
     }
 
     // class providing java2 support
     static final String JAVA14_SUPPORT=
-       "org.apache.tomcat.util.compat.Jdk14Compat";
+        "org.apache.tomcat.util.compat.Jdk14Compat";
 
     private static void init() {
         try {
@@ -138,27 +134,27 @@
             Class.forName("java.lang.Void");
             javaVersion = JAVA_1_1;
             Class.forName("java.lang.ThreadLocal");
-           java2=true;
+            java2=true;
             javaVersion = JAVA_1_2;
             Class.forName("java.lang.StrictMath");
             javaVersion = JAVA_1_3;
-           Class.forName("java.lang.CharSequence");
-           javaVersion = JAVA_1_4;
-           java14=true;
+            Class.forName("java.lang.CharSequence");
+            javaVersion = JAVA_1_4;
+            java14=true;
         } catch (ClassNotFoundException cnfe) {
             // swallow as we've hit the max class version that we have
         }
-       if( java14 ) {
-           try {
-               Class c=Class.forName(JAVA14_SUPPORT);
-               compat=(JdkCompat)c.newInstance();
-           } catch( Exception ex ) {
-               compat=new JdkCompat();
-           }
-       } else {
-           compat=new JdkCompat();
-           // Install jar handler if none installed
-       }
+        if( java14 ) {
+            try {
+                Class c=Class.forName(JAVA14_SUPPORT);
+                jdkCompat=(JdkCompat)c.newInstance();
+            } catch( Exception ex ) {
+                jdkCompat=new JdkCompat();
+            }
+        } else {
+            jdkCompat=new JdkCompat();
+            // Install jar handler if none installed
+        }
     }
 
     // ----------------------------------------------------------- Constructors

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

Reply via email to