< prev index next >

test/jdk/java/net/URLClassLoader/NullURLTest.java

Print this page
8198810: URLClassLoader does not specify behavior when URL array contains null
Reviewed-by: alanb, darcy, dholmes

@@ -69,18 +69,18 @@
             System.err.println("URLClassLoader(null) did not throw NPE");
             failures++;
         } catch (NullPointerException e) {
             // expected
         }
-        // This section should be uncommented if 8026517 is fixed.
-//        try {
-//            loader = new URLClassLoader(invalidURLArray);
-//            System.err.println("URLClassLoader(invalidURLArray) did not throw NPE");
-//            failures++;
-//        } catch (NullPointerException e) {
-//            // expected
-//        }
+
+        try {
+            loader = new URLClassLoader(invalidURLArray);
+            System.err.println("URLClassLoader(invalidURLArray) did not throw NPE");
+            failures++;
+        } catch (NullPointerException e) {
+            // expected
+        }
 
         try {
             loader = new URLClassLoader(validURLArray, null);
         } catch (Throwable t) {
             System.err.println("URLClassLoader(validURLArray, null) threw " + t);

@@ -91,18 +91,18 @@
             System.err.println("URLClassLoader(null, null) did not throw NPE");
             failures++;
         } catch (NullPointerException e) {
             // expected
         }
-        // This section should be uncommented if 8026517 is fixed.
-//        try {
-//            loader = new URLClassLoader(invalidURLArray, null);
-//            System.err.println("URLClassLoader(invalidURLArray, null) did not throw NPE");
-//            failures++;
-//        } catch (NullPointerException e) {
-//            // expected
-//        }
+
+        try {
+            loader = new URLClassLoader(invalidURLArray, null);
+            System.err.println("URLClassLoader(invalidURLArray, null) did not throw NPE");
+            failures++;
+        } catch (NullPointerException e) {
+            // expected
+        }
 
         try {
             loader = new URLClassLoader(validURLArray, null, null);
         } catch (Throwable t) {
             System.err.println("URLClassLoader(validURLArray, null, null) threw " + t);

@@ -113,18 +113,18 @@
             System.err.println("URLClassLoader(null, null, null) did not throw NPE");
             failures++;
         } catch (NullPointerException e) {
             // expected
         }
-        // This section should be uncommented if 8026517 is fixed.
-//        try {
-//            loader = new URLClassLoader(invalidURLArray, null, null);
-//            System.err.println("URLClassLoader(invalidURLArray, null, null) did not throw NPE");
-//            failures++;
-//        } catch (NullPointerException e) {
-//            // expected
-//        }
+
+        try {
+            loader = new URLClassLoader(invalidURLArray, null, null);
+            System.err.println("URLClassLoader(invalidURLArray, null, null) did not throw NPE");
+            failures++;
+        } catch (NullPointerException e) {
+            // expected
+        }
 
         try {
             loader = URLClassLoader.newInstance(validURLArray);
         } catch (Throwable t) {
             System.err.println("URLClassLoader.newInstance(validURLArray) threw " + t);

@@ -135,18 +135,18 @@
             System.err.println("URLClassLoader.newInstance(null) did not throw NPE");
             failures++;
         } catch (NullPointerException e) {
             // expected
         }
-        // This section should be uncommented if 8026517 is fixed.
-//        try {
-//            loader = URLClassLoader.newInstance(invalidURLArray);
-//            System.err.println("URLClassLoader.newInstance(invalidURLArray) did not throw NPE");
-//            failures++;
-//        } catch (NullPointerException e) {
-//            // expected
-//        }
+
+        try {
+            loader = URLClassLoader.newInstance(invalidURLArray);
+            System.err.println("URLClassLoader.newInstance(invalidURLArray) did not throw NPE");
+            failures++;
+        } catch (NullPointerException e) {
+            // expected
+        }
 
         try {
             loader = URLClassLoader.newInstance(validURLArray, null);
         } catch (Throwable t) {
             System.err.println("URLClassLoader.newInstance(validURLArray, null) threw " + t);

@@ -157,18 +157,18 @@
             System.err.println("URLClassLoader.newInstance(null, null) did not throw NPE");
             failures++;
         } catch (NullPointerException e) {
             // expected
         }
-        // This section should be uncommented if 8026517 is fixed.
-//        try {
-//            loader = URLClassLoader.newInstance(invalidURLArray, null);
-//            System.err.println("URLClassLoader.newInstance(invalidURLArray, null) did not throw NPE");
-//            failures++;
-//        } catch (NullPointerException e) {
-//            // expected
-//        }
+
+        try {
+            loader = URLClassLoader.newInstance(invalidURLArray, null);
+            System.err.println("URLClassLoader.newInstance(invalidURLArray, null) did not throw NPE");
+            failures++;
+        } catch (NullPointerException e) {
+            // expected
+        }
 
         if (failures != 0) {
             throw new Exception("URLClassLoader NullURLTest had "+failures+" failures!");
         }
     }
< prev index next >