Commits

Anonymous committed 7703c50

we had a couple tests that weren't quite correct that only passed due to our weird handling of null

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

Comments (0)

Files changed (5)

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

                         Object value = OgnlRuntime.getProperty(ognlContext, o, name);
 
                         //Ognl.getValue(OgnlUtil.compile((String) name), context, o);
-                        if (value != null) {
-                            Evaluation currentEvaluation = ognlContext.getCurrentEvaluation();
-                            SimpleNode node = currentEvaluation.getNode();
-                            currentEvaluation.setSource(o);
-                            ognlContext.pushEvaluation(new Evaluation(node, o));
-
-                            return value;
-                        }
+                        Evaluation currentEvaluation = ognlContext.getCurrentEvaluation();
+                        SimpleNode node = currentEvaluation.getNode();
+                        currentEvaluation.setSource(o);
+                        ognlContext.pushEvaluation(new Evaluation(node, o));
+
+                        return value;
                     }
                 } catch (OgnlException e) {
                     if (e.getReason() != null) {

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

         }
 
         if (tc == null) {
-            if (toClass.equals(String.class) && !(value.getClass().equals(String.class) || value.getClass().equals(String[].class))) {
+            if (toClass.equals(String.class) && value != null && !(value.getClass().equals(String.class) || value.getClass().equals(String[].class))) {
                 // when converting to a string, use the source target's class's converter
                 if (defaultMappings.containsKey(value.getClass().getName())) {
                     tc = (TypeConverter) defaultMappings.get(value.getClass().getName());

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

         try {
             ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy("", "Foo", extraContext);
             proxy.execute();
-            assertEquals("this is blah", proxy.getInvocation().getStack().findValue("blah"));
+            assertEquals("this is blah", proxy.getInvocation().getStack().findValue("[1].blah"));
         } catch (Exception e) {
             e.printStackTrace();
             fail();

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

 
     public static final String COMMAND_RETURN_CODE = "com.opensymphony.xwork.SimpleAction.CommandInvoked";
 
+    public SimpleAction() {
+        System.out.println("hi");
+    }
+
     //~ Instance fields ////////////////////////////////////////////////////////
 
     private ArrayList someList = new ArrayList();

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

         try {
             ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy("/does/not/exist", "Foo", extraContext);
             proxy.execute();
-            assertEquals("this is blah", proxy.getInvocation().getStack().findValue("blah"));
+            assertEquals("this is blah", proxy.getInvocation().getStack().findValue("[1].blah"));
         } catch (Exception e) {
             e.printStackTrace();
             fail();