Commits

Anonymous committed 4e9cf24

Minor fixes discovered during Struts 2 recoding
XW-566

git-svn-id: http://svn.opensymphony.com/svn/xwork/branches/no-statics@1607e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits a8cf58f
  • Branches no-statics

Comments (0)

Files changed (8)

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

         builder.factory(ValueStackFactory.class, OgnlValueStackFactory.class, Scope.SINGLETON);
         builder.factory(XWorkConverter.class, Scope.SINGLETON);
         builder.factory(XWorkBasicConverter.class, Scope.SINGLETON);
-        builder.factory(TextProvider.class, DefaultTextProvider.class, Scope.SINGLETON);
+        builder.factory(TextProvider.class, "system", DefaultTextProvider.class, Scope.SINGLETON);
         builder.factory(ObjectTypeDeterminer.class, DefaultObjectTypeDeterminer.class, Scope.SINGLETON);
         builder.factory(PropertyAccessor.class, CompoundRoot.class.getName(), CompoundRootAccessor.class, Scope.SINGLETON);
         builder.factory(OgnlUtil.class, Scope.SINGLETON);

src/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java

 import com.opensymphony.xwork2.ognl.accessor.ObjectAccessor;
 import com.opensymphony.xwork2.ognl.accessor.ObjectProxyPropertyAccessor;
 import com.opensymphony.xwork2.ognl.accessor.XWorkCollectionPropertyAccessor;
-import com.opensymphony.xwork2.ognl.accessor.XWorkEnumerationAcccessor;
+import com.opensymphony.xwork2.ognl.accessor.XWorkEnumerationAccessor;
 import com.opensymphony.xwork2.ognl.accessor.XWorkIteratorPropertyAccessor;
 import com.opensymphony.xwork2.ognl.accessor.XWorkListPropertyAccessor;
 import com.opensymphony.xwork2.ognl.accessor.XWorkMapPropertyAccessor;
                .factory(PropertyAccessor.class, CompoundRoot.class.getName(), CompoundRootAccessor.class, Scope.SINGLETON)
                .factory(PropertyAccessor.class, Object.class.getName(), ObjectAccessor.class, Scope.SINGLETON)
                .factory(PropertyAccessor.class, Iterator.class.getName(), XWorkIteratorPropertyAccessor.class, Scope.SINGLETON)
-               .factory(PropertyAccessor.class, Enumeration.class.getName(), XWorkEnumerationAcccessor.class, Scope.SINGLETON)
+               .factory(PropertyAccessor.class, Enumeration.class.getName(), XWorkEnumerationAccessor.class, Scope.SINGLETON)
                
                // silly workarounds for ognl since there is no way to flush its caches
                .factory(PropertyAccessor.class, List.class.getName(), XWorkListPropertyAccessor.class, Scope.SINGLETON)
                .factory(NullHandler.class, Object.class.getName(), InstantiatingNullHandler.class, Scope.SINGLETON)
                .factory(ActionValidatorManager.class, AnnotationActionValidatorManager.class, Scope.SINGLETON)
                .factory(ActionValidatorManager.class, "no-annotations", DefaultActionValidatorManager.class, Scope.SINGLETON)
-               .factory(TextProvider.class, DefaultTextProvider.class, Scope.SINGLETON)
+               .factory(TextProvider.class, "system", DefaultTextProvider.class, Scope.SINGLETON)
                .factory(OgnlUtil.class, Scope.SINGLETON)
                .factory(XWorkBasicConverter.class, Scope.SINGLETON);
         props.setProperty("devMode", Boolean.FALSE.toString());

src/java/com/opensymphony/xwork2/ognl/OgnlValueStack.java

         Container cont = ac.getContainer();
         XWorkConverter xworkConverter = cont.getInstance(XWorkConverter.class);
         CompoundRootAccessor accessor = (CompoundRootAccessor) cont.getInstance(PropertyAccessor.class, CompoundRoot.class.getName());
-        TextProvider prov = cont.getInstance(TextProvider.class);
+        TextProvider prov = cont.getInstance(TextProvider.class, "system");
         boolean allow = "true".equals(cont.getInstance(String.class, "allowStaticMethodAccess"));
         OgnlValueStack aStack = new OgnlValueStack(xworkConverter, accessor, prov, allow);
         aStack.setOgnlUtil(cont.getInstance(OgnlUtil.class));

src/java/com/opensymphony/xwork2/ognl/OgnlValueStackFactory.java

 import com.opensymphony.xwork2.ognl.accessor.ObjectAccessor;
 import com.opensymphony.xwork2.ognl.accessor.ObjectProxyPropertyAccessor;
 import com.opensymphony.xwork2.ognl.accessor.XWorkCollectionPropertyAccessor;
-import com.opensymphony.xwork2.ognl.accessor.XWorkEnumerationAcccessor;
+import com.opensymphony.xwork2.ognl.accessor.XWorkEnumerationAccessor;
 import com.opensymphony.xwork2.ognl.accessor.XWorkIteratorPropertyAccessor;
 import com.opensymphony.xwork2.ognl.accessor.XWorkListPropertyAccessor;
 import com.opensymphony.xwork2.ognl.accessor.XWorkMapPropertyAccessor;
         this.xworkConverter = conv;
     }
     
-    @Inject
+    @Inject("system")
     public void setTextProvider(TextProvider textProvider) {
         this.textProvider = textProvider;
     }

src/java/com/opensymphony/xwork2/ognl/accessor/XWorkEnumerationAcccessor.java

-/*
- * Copyright (c) 2002-2006 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork2.ognl.accessor;
-
-import ognl.EnumerationPropertyAccessor;
-import ognl.ObjectPropertyAccessor;
-import ognl.OgnlException;
-
-import java.util.Map;
-
-
-/**
- * @author plightbo
- */
-public class XWorkEnumerationAcccessor extends EnumerationPropertyAccessor {
-
-    ObjectPropertyAccessor opa = new ObjectPropertyAccessor();
-
-
-    public void setProperty(Map context, Object target, Object name, Object value) throws OgnlException {
-        opa.setProperty(context, target, name, value);
-    }
-}

src/java/com/opensymphony/xwork2/ognl/accessor/XWorkEnumerationAccessor.java

+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.ognl.accessor;
+
+import ognl.EnumerationPropertyAccessor;
+import ognl.ObjectPropertyAccessor;
+import ognl.OgnlException;
+
+import java.util.Map;
+
+
+/**
+ * @author plightbo
+ */
+public class XWorkEnumerationAccessor extends EnumerationPropertyAccessor {
+
+    ObjectPropertyAccessor opa = new ObjectPropertyAccessor();
+
+
+    public void setProperty(Map context, Object target, Object name, Object value) throws OgnlException {
+        opa.setProperty(context, target, name, value);
+    }
+}

src/test/com/opensymphony/xwork2/interceptor/ParametersInterceptorTest.java

         ValueStack stack = new OgnlValueStack(
                 container.getInstance(XWorkConverter.class),
                 (CompoundRootAccessor)container.getInstance(PropertyAccessor.class, CompoundRoot.class.getName()),
-                container.getInstance(TextProvider.class), true) {
+                container.getInstance(TextProvider.class, "system"), true) {
             public void setValue(String expr, Object value) {
                 actual.put(expr, value);
             }

src/test/com/opensymphony/xwork2/ognl/OgnlValueStackTest.java

         OgnlValueStack stack = new OgnlValueStack(
                 container.getInstance(XWorkConverter.class),
                 (CompoundRootAccessor)container.getInstance(PropertyAccessor.class, CompoundRoot.class.getName()),
-                container.getInstance(TextProvider.class), allowStaticMethodAccess);
+                container.getInstance(TextProvider.class, "system"), allowStaticMethodAccess);
         container.inject(stack);
         return stack;
     }
     public void testTopIsDefaultTextProvider() {
         OgnlValueStack vs = createValueStack();
 
-        assertEquals(container.getInstance(TextProvider.class), vs.findValue("top"));
+        assertEquals(container.getInstance(TextProvider.class, "system"), vs.findValue("top"));
     }
 
     public void testTwoDogs() {