Anonymous avatar Anonymous committed abe20e5

Cleanup - Jalopy and IDEA tweaks.

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

Comments (0)

Files changed (4)

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

 
         try {
             Class clazz = null;
-            Object o = target;
+            Object realTarget = target;
 
+            // find real target
             if (target instanceof CompoundRoot) {
                 CompoundRoot root = (CompoundRoot) target;
 
                 for (Iterator iterator = root.iterator(); iterator.hasNext();) {
-                    o = iterator.next();
+                    realTarget = iterator.next();
 
-                    if (OgnlRuntime.hasSetProperty((OgnlContext) context, o, property.toString())) {
-                        clazz = OgnlRuntime.getPropertyDescriptor(o.getClass(), property.toString()).getPropertyType();
+                    if (OgnlRuntime.hasSetProperty((OgnlContext) context, realTarget, property.toString())) {
+                        clazz = OgnlRuntime.getPropertyDescriptor(realTarget.getClass(), property.toString()).getPropertyType();
 
                         break;
                     }
                 }
             } else {
-                clazz = OgnlRuntime.getPropertyDescriptor(o.getClass(), property.toString()).getPropertyType();
+                clazz = OgnlRuntime.getPropertyDescriptor(realTarget.getClass(), property.toString()).getPropertyType();
             }
 
             if (clazz == null) {
                 return null;
             }
 
-            Object param = createObject(clazz, o, property.toString());
+            Object param = createObject(clazz, realTarget, property.toString());
 
-            Ognl.setValue(property.toString(), context, o, param);
+            Ognl.setValue(property.toString(), context, realTarget, param);
 
-            //OgnlRuntime.setProperty((OgnlContext) context, target, property.toString(), param);
-            //method.invoke(target, new Object[]{param});
             return param;
         } catch (Exception e) {
             LOG.error("Could not create and/or set value back on to object", e);
     }
 
     private Object createObject(Class clazz, Object target, String property) throws Exception {
-        if ((clazz == Collection.class) || (clazz == List.class)) {
+        if (Collection.class.isAssignableFrom(clazz)) {
             Class collectionType = getCollectionType(target.getClass(), property);
 
             if (collectionType == null) {

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

 
 
 /**
- *
+ * Default type converter for XWork.
  *
  * @author <a href="mailto:plightbo@cisco.com">Pat Lightbody</a>
- * @author $Author$
- * @version $Revision$
  */
 public class XWorkBasicConverter extends DefaultTypeConverter {
     //~ Methods ////////////////////////////////////////////////////////////////
             if (value instanceof Object[]) {
                 Object[] array = (Object[]) value;
 
-                if ((array != null) && (array.length >= 1)) {
+                if (array.length >= 1) {
                     value = array[0];
                 }
 
             List intArray = new ArrayList(x.length);
 
             for (int i = 0; i < x.length; i++) {
-                intArray.add(new Boolean(x[i]));
+                intArray.add(Boolean.valueOf(x[i]));
             }
 
             result = TextUtils.join(", ", intArray);

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

     }
 
     protected Object getConverter(Class clazz, String property) {
-        if (!noMapping.contains(clazz)) {
+        if ((property != null) && !noMapping.contains(clazz)) {
             try {
                 Map mapping = (Map) mappings.get(clazz);
 

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

         }
 
         boolean trim = false;
+
         if (index >= this.size()) {
             trim = true;
         }
+
         for (Iterator it = c.iterator(); it.hasNext(); index++) {
             add(index, it.next());
         }
+
         if (trim) {
             remove(this.size() - 1);
         }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.