struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [1/2] git commit: WW-4369 Solves problem with detecting primitives
Date Wed, 09 Jul 2014 19:06:41 GMT
Repository: struts
Updated Branches:
  refs/heads/develop fa814744d -> 2da93000d


WW-4369 Solves problem with detecting primitives


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/2b794d76
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/2b794d76
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/2b794d76

Branch: refs/heads/develop
Commit: 2b794d76e59c023348eec2d673d7d8b9abd8263b
Parents: fa81474
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Wed Jul 9 20:50:10 2014 +0200
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Wed Jul 9 20:50:10 2014 +0200

----------------------------------------------------------------------
 .../xwork2/conversion/impl/XWorkConverter.java           | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/2b794d76/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
----------------------------------------------------------------------
diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
b/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
index c0aa30b..a91ca1c 100644
--- a/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
+++ b/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
@@ -354,7 +354,7 @@ public class XWorkConverter extends DefaultTypeConverter {
      * @param className name of the class the TypeConverter must handle
      * @return a TypeConverter to handle the specified class or null if none can be found
      */
-    public TypeConverter lookup(String className) {
+    public TypeConverter lookup(String className, boolean isPrimitive) {
         if (converterHolder.containsUnknownMapping(className) && !converterHolder.containsDefaultMapping(className))
{
             return null;
         }
@@ -362,7 +362,7 @@ public class XWorkConverter extends DefaultTypeConverter {
         TypeConverter result = converterHolder.getDefaultMapping(className);
 
         //Looks for super classes
-        if (result == null) {
+        if (result == null && !isPrimitive) {
             Class clazz = null;
 
             try {
@@ -394,14 +394,17 @@ public class XWorkConverter extends DefaultTypeConverter {
      * @return a TypeConverter to handle the specified class or null if none can be found
      */
     public TypeConverter lookup(Class clazz) {
-        if (clazz.isPrimitive()) {
+        TypeConverter result = lookup(clazz.getName(), clazz.isPrimitive());
+
+        if (result == null && clazz.isPrimitive()) {
             /**
              * if it is primitive use default converter which allows to define different
converters per type
              * @see XWorkBasicConverter
              */
             return defaultTypeConverter;
         }
-        return lookup(clazz.getName());
+
+        return result;
     }
 
     protected Object getConverter(Class clazz, String property) {


Mime
View raw message