Commits

Anonymous committed d7da027

Comments (0)

Files changed (19)

src/java/com/opensymphony/xwork/DefaultActionInvocation.java

 
         // get a new List so we don't get problems with the iterator if someone changes the list
         List interceptorList = new ArrayList(proxy.getConfig().getInterceptors());
-
-        if (interceptorList != null) {
-            interceptors = interceptorList.iterator();
-        }
+        interceptors = interceptorList.iterator();
     }
 
     private String invokeAction(Action action, ActionConfig actionConfig) throws Exception {
-        LOG.debug("Executing action method = " + actionConfig.getMethodName());
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Executing action method = " + actionConfig.getMethodName());
+        }
 
         try {
             Method method = actionConfig.getMethod();

src/java/com/opensymphony/xwork/ObjectFactory.java

          *            Action mapping or InterceptorStack definition
          */
     public Interceptor buildInterceptor(InterceptorConfig interceptorConfig, Map interceptorRefParams) throws ConfigurationException {
-        Interceptor interceptor = null;
         String interceptorClassName = interceptorConfig.getClassName();
-        String message;
         Map thisInterceptorClassParams = interceptorConfig.getParams();
         Map params = (thisInterceptorClassParams == null) ? new HashMap() : new HashMap(thisInterceptorClassParams);
         params.putAll(interceptorRefParams);
 
+        String message;
+
         try {
-            interceptor = (Interceptor) buildBean(interceptorClassName);
+            Interceptor interceptor = (Interceptor) buildBean(interceptorClassName);
             OgnlUtil.setProperties(params, interceptor);
             interceptor.init();
 

src/java/com/opensymphony/xwork/config/ConfigurationManager.java

 package com.opensymphony.xwork.config;
 
 import com.opensymphony.util.FileManager;
+
 import com.opensymphony.xwork.config.impl.DefaultConfiguration;
 import com.opensymphony.xwork.config.providers.XmlConfigurationProvider;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
     public static void clearConfigurationProviders() {
         synchronized (configurationProviders) {
             for (Iterator iterator = configurationProviders.iterator();
-                 iterator.hasNext();) {
+                    iterator.hasNext();) {
                 ConfigurationProvider provider = (ConfigurationProvider) iterator.next();
                 provider.destroy();
             }
                 reload = false;
 
                 for (Iterator iterator = getConfigurationProviders().iterator();
-                     iterator.hasNext();) {
+                        iterator.hasNext();) {
                     ConfigurationProvider provider = (ConfigurationProvider) iterator.next();
 
                     if (provider.needsReload()) {

src/java/com/opensymphony/xwork/config/entities/ActionConfig.java

 import com.opensymphony.xwork.interceptor.Interceptor;
 
 import java.io.Serializable;
+
 import java.lang.reflect.Method;
+
 import java.util.*;
 
 
             return method;
         }
 
-        Class clazz = null;
+        Class clazz;
 
         try {
             ActionConfig actionConfig = new ActionConfig(null, getClassName(), null, null, null);
                 }
             }
         } else // return default execute() method if method name is not specified
-        {
+         {
             method = clazz.getMethod("execute", new Class[0]);
         }
 

src/java/com/opensymphony/xwork/config/impl/DefaultConfiguration.java

 import com.opensymphony.xwork.config.entities.PackageConfig;
 import com.opensymphony.xwork.config.entities.ResultTypeConfig;
 import com.opensymphony.xwork.config.providers.InterceptorBuilder;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
         packageContexts.clear();
 
         for (Iterator iterator = ConfigurationManager.getConfigurationProviders().iterator();
-             iterator.hasNext();) {
+                iterator.hasNext();) {
             ConfigurationProvider provider = (ConfigurationProvider) iterator.next();
             provider.init(this);
         }
 
         if (toBeRemoved != null) {
             for (Iterator iterator = packageContexts.values().iterator();
-                 iterator.hasNext();) {
+                    iterator.hasNext();) {
                 PackageConfig packageContext = (PackageConfig) iterator.next();
                 packageContext.removeParent(toBeRemoved);
             }
         Map namespaceActionConfigs = new HashMap();
 
         for (Iterator iterator = packageContexts.values().iterator();
-             iterator.hasNext();) {
+                iterator.hasNext();) {
             PackageConfig packageContext = (PackageConfig) iterator.next();
 
             if (!packageContext.isAbstract()) {
                 Map actionConfigs = packageContext.getAllActionConfigs();
 
                 for (Iterator actionIterator = actionConfigs.keySet().iterator();
-                     actionIterator.hasNext();) {
+                        actionIterator.hasNext();) {
                     String actionName = (String) actionIterator.next();
                     ActionConfig baseConfig = (ActionConfig) actionConfigs.get(actionName);
                     configs.put(actionName, buildFullActionConfig(packageContext, baseConfig));
         String defaultResult = packageContext.getFullDefaultResultType();
 
         for (Iterator iterator = results.entrySet().iterator();
-             iterator.hasNext();) {
+                iterator.hasNext();) {
             Map.Entry entry = (Map.Entry) iterator.next();
 
             if (entry.getValue() == null) {
             StringBuffer buff = new StringBuffer("RuntimeConfiguration - actions are\n");
 
             for (Iterator iterator = namespaceActionConfigs.keySet().iterator();
-                 iterator.hasNext();) {
+                    iterator.hasNext();) {
                 String namespace = (String) iterator.next();
                 Map actionConfigs = (Map) namespaceActionConfigs.get(namespace);
 
                 for (Iterator iterator2 = actionConfigs.keySet().iterator();
-                     iterator2.hasNext();) {
+                        iterator2.hasNext();) {
                     buff.append(namespace + "/" + iterator2.next() + "\n");
                 }
             }

src/java/com/opensymphony/xwork/interceptor/AroundInterceptor.java

 package com.opensymphony.xwork.interceptor;
 
 import com.opensymphony.xwork.ActionInvocation;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 

src/java/com/opensymphony/xwork/interceptor/component/DefaultComponentManager.java

 package com.opensymphony.xwork.interceptor.component;
 
 import com.opensymphony.xwork.ObjectFactory;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import java.io.Serializable;
+
 import java.util.*;
 
 
             Map resources = getResourceDependencies(clazz);
 
             for (Iterator iterator = resources.entrySet().iterator();
-                 iterator.hasNext();) {
+                    iterator.hasNext();) {
                 Map.Entry mapEntry = (Map.Entry) iterator.next();
                 Class depResource = (Class) mapEntry.getKey();
                 DefaultComponentManager newDcm = (DefaultComponentManager) mapEntry.getValue();
         }
 
         try {
-            enabler.getMethods()[0].invoke(resource, new Object[]{newResource});
+            enabler.getMethods()[0].invoke(resource, new Object[] {newResource});
         } catch (Exception e) {
             e.printStackTrace();
 

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

 package com.opensymphony.xwork.util;
 
 import com.opensymphony.xwork.ObjectFactory;
+
 import ognl.NullHandler;
 import ognl.Ognl;
 import ognl.OgnlContext;
 import ognl.OgnlRuntime;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
         try {
             Class clazz = null;
             Object o = target;
+
             if (target instanceof CompoundRoot) {
                 CompoundRoot root = (CompoundRoot) target;
+
                 for (Iterator iterator = root.iterator(); iterator.hasNext();) {
                     o = iterator.next();
+
                     if (OgnlRuntime.hasSetProperty((OgnlContext) context, o, property.toString())) {
                         clazz = OgnlRuntime.getPropertyDescriptor(o.getClass(), property.toString()).getPropertyType();
+
                         break;
                     }
                 }
             Object param = createObject(clazz, o, property.toString());
 
             Ognl.setValue(property.toString(), context, o, 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);

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

 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.io.ObjectStreamException;
 import java.io.Serializable;
 
 import java.util.Enumeration;
         ((OgnlContext) context).setKeepLastEvaluation(true);
     }
 
-    private Object readResolve() throws ObjectStreamException {
+    private Object readResolve() {
         OgnlValueStack aStack = new OgnlValueStack();
         aStack.setRoot(this.root);
 

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

 package com.opensymphony.xwork.util;
 
 import com.opensymphony.util.FileManager;
+
 import com.opensymphony.xwork.ActionContext;
 import com.opensymphony.xwork.ObjectFactory;
+
 import ognl.DefaultTypeConverter;
 import ognl.Evaluation;
 import ognl.OgnlContext;
 import ognl.TypeConverter;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import java.io.InputStream;
+
 import java.lang.reflect.Member;
+
 import java.util.*;
 
 
         }
     }
 
-    protected Object getConverter(Class clazz, String property) {
-        if (!noMapping.contains(clazz)) {
-            try {
-                Map mapping = (Map) mappings.get(clazz);
-
-                if (mapping == null) {
-                    mapping = buildConverterMapping(clazz);
-                } else {
-                    mapping = conditionalReload(clazz, mapping);
-                }
-
-                return mapping.get(property);
-            } catch (Throwable t) {
-                noMapping.add(clazz);
-            }
-        }
-
-        return null;
-    }
-
     /**
      * Looks for a TypeConverter in the default mappings.
      *
         return lookup(clazz.getName());
     }
 
+    protected Object getConverter(Class clazz, String property) {
+        if (!noMapping.contains(clazz)) {
+            try {
+                Map mapping = (Map) mappings.get(clazz);
+
+                if (mapping == null) {
+                    mapping = buildConverterMapping(clazz);
+                } else {
+                    mapping = conditionalReload(clazz, mapping);
+                }
+
+                return mapping.get(property);
+            } catch (Throwable t) {
+                noMapping.add(clazz);
+            }
+        }
+
+        return null;
+    }
+
     protected void handleConversionException(Map context, String property, Object value, Object object) {
         if ((context.get(REPORT_CONVERSION_ERRORS) == Boolean.TRUE)) {
             String realProperty = property;
         props.load(is);
 
         for (Iterator iterator = props.entrySet().iterator();
-             iterator.hasNext();) {
+                iterator.hasNext();) {
             Map.Entry entry = (Map.Entry) iterator.next();
             String key = (String) entry.getKey();
 

src/java/com/opensymphony/xwork/validator/ActionValidatorManager.java

             if (validator instanceof ShortCircuitableValidator && ((ShortCircuitableValidator) validator).isShortCircuit()) {
                 // get number of existing errors
                 List errs = null;
+
                 if (fValidator != null) {
                     if (validatorContext.hasFieldErrors()) {
                         Collection fieldErrors = (Collection) validatorContext.getFieldErrors().get(fValidator.getFieldName());

src/test/com/opensymphony/xwork/SimpleAction.java

     }
 
     public boolean[] getBools() {
-        boolean[] b = new boolean[]{true, false, false, true};
+        boolean[] b = new boolean[] {true, false, false, true};
 
         return b;
     }

src/test/com/opensymphony/xwork/config/ConfigurationTest.java

 import com.opensymphony.xwork.*;
 import com.opensymphony.xwork.config.providers.MockConfigurationProvider;
 import com.opensymphony.xwork.config.providers.XmlConfigurationProvider;
+
 import junit.framework.TestCase;
 
 import java.util.HashMap;

src/test/com/opensymphony/xwork/config/providers/XmlConfigurationProviderMultilevelTest.java

 import com.opensymphony.xwork.config.entities.PackageConfig;
 import com.opensymphony.xwork.config.entities.ResultConfig;
 import com.opensymphony.xwork.interceptor.ParametersInterceptor;
+
 import junit.framework.Assert;
 
 

src/test/com/opensymphony/xwork/interceptor/component/ComponentConfigurationTest.java

 package com.opensymphony.xwork.interceptor.component;
 
 import junit.framework.TestCase;
+
 import org.xml.sax.SAXException;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
+
 import java.util.ArrayList;
 
 

src/test/com/opensymphony/xwork/util/Cat.java

     //~ Instance fields ////////////////////////////////////////////////////////
 
     Foo foo;
-    String name;
     List kittens;
+    String name;
 
     //~ Methods ////////////////////////////////////////////////////////////////
 
         return foo;
     }
 
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getName() {
-        return name;
+    public void setKittens(List kittens) {
+        this.kittens = kittens;
     }
 
     public List getKittens() {
         return kittens;
     }
 
-    public void setKittens(List kittens) {
-        this.kittens = kittens;
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
     }
 }

src/test/com/opensymphony/xwork/util/InstantiatingNullHandlerTest.java

+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
 package com.opensymphony.xwork.util;
 
 import junit.framework.TestCase;
+
 import ognl.OgnlContext;
 
 import java.util.List;
 import java.util.Map;
 
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
 public class InstantiatingNullHandlerTest extends TestCase {
+    //~ Methods ////////////////////////////////////////////////////////////////
+
     public void testInheritance() {
         Tiger t = new Tiger();
         CompoundRoot root = new CompoundRoot();
 
         Map context = new OgnlContext();
         context.put(InstantiatingNullHandler.CREATE_NULL_OBJECTS, Boolean.TRUE);
+
         InstantiatingNullHandler nh = new InstantiatingNullHandler();
 
         Object dogList = nh.nullPropertyValue(context, root, "dogs");
         assertNotNull(dogList);
         assertTrue(dogList instanceof List);
 
-
         Object kittenList = nh.nullPropertyValue(context, root, "kittens");
         clazz = nh.getCollectionType(Tiger.class, "kittens");
         assertEquals(Cat.class, clazz);

src/test/com/opensymphony/xwork/util/OgnlValueStackTest.java

 import com.opensymphony.xwork.ActionContext;
 import com.opensymphony.xwork.SimpleAction;
 import com.opensymphony.xwork.TestBean;
+
 import junit.framework.TestCase;
 
 import java.io.*;
+
 import java.math.BigDecimal;
+
 import java.util.HashMap;
 import java.util.Map;
 
         Dog dog = new Dog();
         dog.setAge(12);
         dog.setName("Rover");
-        dog.setChildAges(new int[]{1, 2});
+        dog.setChildAges(new int[] {1, 2});
 
         vs.push(dog);
         assertEquals("1, 2", vs.findValue("childAges", String.class));
         OgnlValueStack vs = new OgnlValueStack();
         vs.push(foo);
 
-        vs.setValue("strings", new String[]{"one", "two"});
+        vs.setValue("strings", new String[] {"one", "two"});
 
         assertNotNull(foo.getStrings());
         assertEquals("one", foo.getStrings().get(0));
         Dog dog = new Dog();
         dog.setAge(12);
         dog.setName("Rover");
-        dog.setChildAges(new int[]{1, 2});
+        dog.setChildAges(new int[] {1, 2});
         dog.setHates(cat);
 
         vs.push(dog);
 
         // relatives
         Foo fooA = new Foo();
-        foo.setRelatives(new Foo[]{fooA});
+        foo.setRelatives(new Foo[] {fooA});
 
         Foo fooB = new Foo();
-        foo2.setRelatives(new Foo[]{fooB});
+        foo2.setRelatives(new Foo[] {fooB});
 
         Foo fooC = new Foo();
-        foo3.setRelatives(new Foo[]{fooC});
+        foo3.setRelatives(new Foo[] {fooC});
 
         // the bar
         Bar bar = new Bar();

src/test/com/opensymphony/xwork/util/Tiger.java

+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
 package com.opensymphony.xwork.util;
 
 import java.util.List;
 
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
 public class Tiger extends Cat {
+    //~ Instance fields ////////////////////////////////////////////////////////
+
     List dogs;
 
-    public List getDogs() {
-        return dogs;
-    }
+    //~ Methods ////////////////////////////////////////////////////////////////
 
     public void setDogs(List dogs) {
         this.dogs = dogs;
     }
+
+    public List getDogs() {
+        return dogs;
+    }
 }