harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r487310 - /harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassLoaderTest.java
Date Thu, 14 Dec 2006 19:15:41 GMT
Author: apetrenko
Date: Thu Dec 14 11:15:40 2006
New Revision: 487310

URL: http://svn.apache.org/viewvc?view=rev&rev=487310
Log:
Regression test for HARMONY-877 " [classlib][lang] compatibility: Harmony method ClassLoader.getResource(null)
returns null while RI throws NPE"

Modified:
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassLoaderTest.java

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassLoaderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassLoaderTest.java?view=diff&rev=487310&r1=487309&r2=487310
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassLoaderTest.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassLoaderTest.java Thu Dec 14
11:15:40 2006
@@ -684,25 +684,25 @@
             fail("Error10: " + e.toString());
         }
 
-        //    	// TEST CASE #8:
-        //    	try {
-        //    	    //Class c =
+        //      // TEST CASE #8:
+        //      try {
+        //          //Class c =
         // Class.forName("[[[Ljavax.imageio.plugins.jpeg.JPEGImageReadParam;",
         // true, tcl);
-        //    	    Class c =
+        //          Class c =
         // Class.forName("javax.imageio.plugins.jpeg.JPEGImageReadParamXXX",
         // true, tcl);
-        //    	    ///Class c =
+        //          ///Class c =
         // tcl.loadClass("#javax.imageio.plugins.jpeg.JPEGImageReadParam");
-        //        	System.out.println(c);
-        //        	tcl.findLoadedClass("javax.imageio.plugins.jpeg.JPEGImageReadParam");
-        //        	assertTrue("Error7",
+        //          System.out.println(c);
+        //          tcl.findLoadedClass("javax.imageio.plugins.jpeg.JPEGImageReadParam");
+        //          assertTrue("Error7",
         // tcl.findLoadedClass("javax.imageio.plugins.jpeg.JPEGImageReadParam").getName().equals("javax.imageio.plugins.jpeg.JPEGImageReadParam"));
-        //        	///fail("Error11");
-        //    	} catch (Throwable e) {
-        //        	fail("Error12: " + e.toString());
-        //    	}
-		
+        //          ///fail("Error11");
+        //      } catch (Throwable e) {
+        //          fail("Error12: " + e.toString());
+        //      }
+        
 
     }
 
@@ -920,7 +920,7 @@
         //new a3().main(new String[] { "" });
     }
 
-	
+    
     /**
      *  
      */
@@ -954,7 +954,7 @@
             fail("Error3");
         }
     }
-			
+            
     /**
      *  
      */
@@ -2005,11 +2005,11 @@
             //    Class.forName(longName).newInstance();
             //} catch (Exception ee) {
             //    System.out.println("Warning: "+ee.toString());
-            //	try {
-            //	    Class.forName("java.lang.ClassLoaderTest$3$LC1").newInstance();
+            //  try {
+            //      Class.forName("java.lang.ClassLoaderTest$3$LC1").newInstance();
             //    } catch (Exception eee) {
             //        System.out.println("Warning: "+eee.toString());
-            //	}
+            //  }
             //}
         } catch (Exception e) {
             fail("Error3: " + e.toString());
@@ -2096,9 +2096,9 @@
             //Class c =
             // Class.forName("[Ljavax.xml.transform.sax.SAXTransformerFactory;",
             // false, cl);
-            //	//try {
-            //	// Object o = c.newInstance(); // to be initialized
-            //	//} catch(Exception e) {System.out.println("Exception 2:"+e);}
+            //  //try {
+            //  // Object o = c.newInstance(); // to be initialized
+            //  //} catch(Exception e) {System.out.println("Exception 2:"+e);}
             //assertTrue("Error4:", c.desiredAssertionStatus() ==
             // c.desiredAssertionStatus() ); // "this method is not guaranteed
             // to return the actual assertion status"
@@ -2203,5 +2203,29 @@
         Number i[][][] = new Number[1][2][3];
         ClassLoader.getSystemClassLoader().setSigners(i.getClass(),
                 (Object[]) null);
+    }
+
+    /*
+     * Regression test for HARMONY-877
+     * [classlib][lang] compatibility: Harmony method 
+     * ClassLoader.getResource(null) returns null while RI throws NPE 
+     *
+     */
+    public void test_HARMONY_877() {
+        boolean et = false;
+        try { 
+            ClassLoader.getSystemClassLoader().getResource(null); 
+        } catch (NullPointerException e) {
+            et = true;
+        }
+        assertTrue("NullPointerException expected (case 1)", et);
+        et = false;
+
+        try {
+            ClassLoader.getSystemClassLoader().getResourceAsStream(null); 
+        } catch (NullPointerException e) { 
+            et = true;
+        }
+        assertTrue("NullPointerException expected (case 2)", et);
     }
 }



Mime
View raw message