Commits

Anonymous committed 9572d23

* file upload example
* type converter will now stop if there is no need to convert

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@336e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits 7c10398

Comments (0)

Files changed (1)

src/java/com/opensymphony/xwork/util/XWorkBasicConverter.java

 package com.opensymphony.xwork.util;
 
 import com.opensymphony.util.TextUtils;
-
 import com.opensymphony.xwork.ActionContext;
 import com.opensymphony.xwork.XworkException;
-
 import ognl.DefaultTypeConverter;
 import ognl.Ognl;
 import ognl.TypeConverter;
 
 import java.lang.reflect.Array;
 import java.lang.reflect.Member;
-
 import java.math.BigDecimal;
 import java.math.BigInteger;
-
 import java.text.DateFormat;
 import java.text.NumberFormat;
 import java.text.ParseException;
-
 import java.util.*;
 
 
     public Object convertValue(Map context, Object o, Member member, String s, Object value, Class toType) {
         Object result = null;
 
+        if (value.getClass().isAssignableFrom(toType)) {
+            // no need to convert at all, right?
+            return value;
+        }
+
         if (toType == String.class) {
             result = doConvertToString(context, value);
         } else if (toType == boolean.class) {
     /**
      * Creates a Collection of the specified type.
      *
-     * @param toType the type of Collection to create
+     * @param toType     the type of Collection to create
      * @param memberType the type of object elements in this collection must be
-     * @param size the initial size of the collection (ignored if 0 or less)
+     * @param size       the initial size of the collection (ignored if 0 or less)
      * @return a Collection of the specified type
      */
     private Collection createCollection(Class toType, Class memberType, int size) {