Author: polx
Date: Mon Nov 10 13:48:02 2008
New Revision: 712845

URL: http://svn.apache.org/viewvc?rev=712845&view=rev
Log:
JELLY-274: use three-args Class.forName for JDK 1.6.
paul

Modified:
    
commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/tags/core/ArgTag.java
    
commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestArgTag.java

Modified: 
commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/tags/core/ArgTag.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/tags/core/ArgTag.java?rev=712845&r1=712844&r2=712845&view=diff
==============================================================================
--- 
commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/tags/core/ArgTag.java
 (original)
+++ 
commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/tags/core/ArgTag.java
 Mon Nov 10 13:48:02 2008
@@ -99,7 +99,9 @@
             assertNotNull(value);
         } else if(null != typeString) {
             try {
-              klass = getClassLoader().loadClass(typeString);
+              // klass = getClassLoader().loadClass(typeString);
+              // JELLY-274: rather use the three args static class-load-method
+              klass = Class.forName(typeString, false, getClassLoader());
             } catch (ClassNotFoundException e) {
                 throw new JellyTagException(e);
             }
@@ -113,7 +115,9 @@
             if (klass.equals(Class.class))
             {
                 try {
-                    value = getClassLoader().loadClass((String) value);
+                    //value = getClassLoader().loadClass((String) value);
+                    // JELLY-274: rather use three-args class.forName
+                    value = Class.forName((String) value, false, 
getClassLoader());
                 } catch (ClassNotFoundException e) {
                     throw new JellyTagException(e);
                 }

Modified: 
commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestArgTag.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestArgTag.java?rev=712845&r1=712844&r2=712845&view=diff
==============================================================================
--- 
commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestArgTag.java
 (original)
+++ 
commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestArgTag.java
 Mon Nov 10 13:48:02 2008
@@ -196,6 +196,24 @@
             assertNull(parentTag.getValue(i));
         }
     }
+    
+   
+    public void testToObjectArray() throws Exception {
+        argTag.setType(Object[].class.getName());
+        argTag.setValue(new Object[] {"testObjectArray"});
+        argTag.doTag(getXMLOutput());
+        assertEquals(Object[].class,parentTag.getType(0));
+        assertEquals("testObjectArray",((Object[]) parentTag.getValue(0))[0]);
+    }
+
+    public void testToObjectArrayClass() throws Exception {
+        argTag.setType(Class.class.getName());
+        argTag.setValue(Object[].class.getName());
+        argTag.doTag(getXMLOutput());
+        assertEquals(Class.class,parentTag.getType(0));
+        assertEquals(Object[].class,parentTag.getValue(0));
+    }
+
 
     private MockArgTagParent parentTag = null;
     private ArgTag argTag = null;


Reply via email to