harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r474653 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/net/URLClassLoader.java test/java/org/apache/harmony/luni/tests/java/lang/ClassTest.java
Date Tue, 14 Nov 2006 04:56:32 GMT
Author: varlax
Date: Mon Nov 13 20:56:32 2006
New Revision: 474653

URL: http://svn.apache.org/viewvc?view=rev&rev=474653
Log:
HARMONY-2162 [luni-kernel] Class.forName throws IllegalArgumentException while classname includes
'%'

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLClassLoader.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLClassLoader.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLClassLoader.java?view=diff&rev=474653&r1=474652&r2=474653
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLClassLoader.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLClassLoader.java
Mon Nov 13 20:56:32 2006
@@ -1054,7 +1054,12 @@
                                     name).toString();
                         }
 
-                        filename = URLDecoder.decode(filename, "UTF-8");
+                        //Just return null for caller to throw ClassNotFoundException.
+                        try {
+                            filename = URLDecoder.decode(filename, "UTF-8");
+                        } catch (IllegalArgumentException e) {
+                            return null;
+                        }
 
                         File file = new File(filename);
                         // Don't throw exceptions for speed

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassTest.java?view=diff&rev=474653&r1=474652&r2=474653
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassTest.java
Mon Nov 13 20:56:32 2006
@@ -148,6 +148,13 @@
             fail();
         } catch (ClassNotFoundException e) {
         }
+        
+        //regression test for JIRA 2162
+        try {
+            Class.forName("%");
+            fail("should throw ClassNotFoundException.");
+        } catch (ClassNotFoundException e) {
+        }
     }
 
     /**



Mime
View raw message