commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1104479 - /incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java
Date Tue, 17 May 2011 19:21:17 GMT
Author: simonetripodi
Date: Tue May 17 19:21:17 2011
New Revision: 1104479

URL: http://svn.apache.org/viewvc?rev=1104479&view=rev
Log:
fix for broken build # 51

Modified:
    incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java

Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java?rev=1104479&r1=1104478&r2=1104479&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java Tue
May 17 19:21:17 2011
@@ -18,8 +18,6 @@
  */
 package org.apache.commons.ognl;
 
-import static java.lang.String.format;
-
 import java.lang.reflect.Member;
 import java.util.Map;
 
@@ -35,20 +33,9 @@ public class DefaultTypeConverter
 
     public <T> T convertValue( Map context, Object value, Class<T> toType )
     {
-        Object ret = OgnlOps.convertValue( value, toType );
-
-        if ( ret == null )
-        {
-            return null;
-        }
-
-        if ( !toType.isAssignableFrom( ret.getClass() ) )
-        {
-            throw new ClassCastException( format( "value '%s' can not be coverted to class
'%s'",
-                                                  ( value != null ? value : "null" ), toType.getName()
) );
-        }
-
-        return toType.cast( ret );
+        @SuppressWarnings( "unchecked" ) // type checking performed in OgnlOps.convertValue(
value, toType )
+        T ret = (T) OgnlOps.convertValue( value, toType );
+        return ret;
     }
 
     /**



Mime
View raw message