Commits

mbogaert  committed e1db73a

- Fixed XW-171: NPE in XmlHelper.getParams when param tag is empty
- Added runtest target in order to be able to specify a single testcase using Ant

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

  • Participants
  • Parent commits b9ebffd

Comments (0)

Files changed (3)

             </fileset>
         </copy>
     </target>
+    
+	<target name="ensure-test-name" unless="test">
+    	<fail message="You must run this target with -Dtest=TestName"/>
+	</target>
+
+	<target name="runtest" description="Runs the test you specify on the command line with -Dtest=" depends="java, ensure-test-name">
+    	<junit printsummary="withOutAndErr" fork="yes"> 
+            <classpath>
+                <pathelement location="${build.test}"/>
+                <pathelement location="${build.java-test}"/>
+                <pathelement location="${src.etc}/test"/>
+                <pathelement location="${src.etc}"/>
+                <path refid="cp"/>
+            </classpath>
+        	<formatter type="plain" usefile="false"/>
+        	<batchtest>
+	            <fileset dir="${src.test}">
+    	            <include name="**/${test}.java"/>
+        	    </fileset>
+        	</batchtest>
+    	</junit>
+	</target>
 
     <target name="test" depends="format, java">
         <taskdef resource="clovertasks"/>

File src/java/com/opensymphony/xwork/config/providers/XmlHelper.java

             if ((childNode.getNodeType() == Node.ELEMENT_NODE) && "param".equals(childNode.getNodeName())) {
                 Element paramElement = (Element) childNode;
                 String paramName = paramElement.getAttribute("name");
-                String paramValue = paramElement.getChildNodes().item(0).getNodeValue();
-                params.put(paramName, paramValue);
+
+                if (paramElement.getChildNodes().item(0) != null) {
+                    String paramValue = paramElement.getChildNodes().item(0).getNodeValue();
+                    params.put(paramName, paramValue);
+                }
             }
         }
 

File src/test/com/opensymphony/xwork/config/providers/xwork-test-actions.xml

         <action name="Bar" class="com.opensymphony.xwork.SimpleAction">
             <param name="foo">17</param>
             <param name="bar">23</param>
+            <param name="testForXW171"></param>
         </action>
 
         <action name="Foo" class="com.opensymphony.xwork.SimpleAction">