commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r555616 - /jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/converters/ClassConverter.java
Date Thu, 12 Jul 2007 12:50:00 GMT
Author: niallp
Date: Thu Jul 12 05:49:59 2007
New Revision: 555616

URL: http://svn.apache.org/viewvc?view=rev&rev=555616
Log:
BEANUTILS-263 - Improve ClassConverter robustness - thanks to Alex Albu

Modified:
    jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/converters/ClassConverter.java

Modified: jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/converters/ClassConverter.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/converters/ClassConverter.java?view=diff&rev=555616&r1=555615&r2=555616
==============================================================================
--- jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/converters/ClassConverter.java
(original)
+++ jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/converters/ClassConverter.java
Thu Jul 12 05:49:59 2007
@@ -76,9 +76,17 @@
     protected Object convertToType(Class type, Object value) throws Throwable {
         ClassLoader classLoader =
             Thread.currentThread().getContextClassLoader();
-        if (classLoader == null) {
-            classLoader = ClassConverter.class.getClassLoader();
+        if (classLoader != null) {
+            try {
+                return (classLoader.loadClass(value.toString()));
+            } catch (ClassNotFoundException ex) {
+                // Don't fail, carry on and try this class's class loader
+                // (see issue# BEANUTILS-263)
+            }
         }
+
+        // Try this class's class loader
+        classLoader = ClassConverter.class.getClassLoader();
         return (classLoader.loadClass(value.toString()));
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message