[Webtest] [webtest][JIRA] Created: (WT-136) NumberFormatException when group is not specified in StoreRegEx

Ivan Rancati (JIRA) webtest@lists.canoo.com
Mon, 16 Jan 2006 18:40:55 +0100 (CET)


NumberFormatException when group is not specified in StoreRegEx
---------------------------------------------------------------

         Key: WT-136
         URL: http://webtest-community.canoo.com/jira/browse/WT-136
     Project: WebTest
        Type: Bug
    Versions: 1.7    
 Environment: SuSE 10.0
JDK 1.5.0
Ant 1.6.5
Webtest: R_1121
    Reporter: Ivan Rancati
 Attachments: add-serial.xml

This is a minor issue, and it's probably a documentation issue as opposite to a software bug.
According to http://webtest.canoo.com/webtest/manual/storeRegEx.html
the "group" parameter is optional.

However this step
<target name="add1SerialDisable">
	<webtest name="add1SerialDisable" description="add 1 s/n and disable it">
[omitted steps]
			<storeRegEx text=".*" property="generatedSerial" description="store the generated serial number" />
[more omitted steps]
		</steps>
	</webtest>
</target>

fails for me when I read in a response that is a simple text file, of 1 line, which looks like xxxxx-xxxxx-xxxxx

It works if I change it to 
		<storeRegEx text=".*" group="0" property="generatedSerial" description="store the generated serial number" />

The log is
  [webtest]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step: storeRegEx "store the generated serial number" (22/36)
  [webtest]  INFO (com.canoo.webtest.steps.Step) - Running with: Canoo Webtest: R_1121.
  [webtest]  INFO (com.canoo.webtest.steps.Step) - Exception thrown from this class: java.lang.NumberFormatException
  [webtest]  INFO (com.canoo.webtest.steps.Step) - Message was: null
  [webtest] ERROR (com.canoo.webtest.steps.Step) - Cannot handle unexpected exception in step StoreRegExMatch at /u/ivan/cvs/repository/internal/testing/mpuserdb/webtest/add-serial.xml:115:  with (text=".*", property="generatedSerial", description="store the generated serial number", stepType="storeRegEx")
  [webtest] java.lang.NumberFormatException: null
  [webtest]     at java.lang.Integer.parseInt(Integer.java:415)
  [webtest]     at java.lang.Integer.parseInt(Integer.java:497)
  [webtest]     at com.canoo.webtest.steps.store.StoreRegExMatch.verifyParameters(StoreRegExMatch.java:107)
  [webtest]     at com.canoo.webtest.steps.Step.execute(Step.java:146)
  [webtest]     at com.canoo.webtest.engine.Engine.executeSteps(Engine.java:28)
  [webtest]     at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:79)
  [webtest]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
  [webtest]     at org.apache.tools.ant.Task.perform(Task.java:364)
  [webtest]     at org.apache.tools.ant.Target.execute(Target.java:341)
  [webtest]     at org.apache.tools.ant.Target.performTasks(Target.java:369)
  [webtest]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
  [webtest]     at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
  [webtest]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
  [webtest]     at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
  [webtest]     at org.apache.tools.ant.Main.runBuild(Main.java:668)
  [webtest]     at org.apache.tools.ant.Main.startAnt(Main.java:187)
  [webtest]     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
  [webtest]     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
  [webtest]  INFO (com.canoo.webtest.ant.WebtestTask) - Test report successfully created.

BUILD FAILED
/u/ivan/cvs/repository/internal/testing/mpuserdb/webtest/add-serial.xml:97: Canoo Webtest: R_1121.
Test failed.
Exception raised: com.canoo.webtest.engine.StepExecutionException: Unexpected exception caught: java.lang.NumberFormatException: null, Step: StoreRegExMatch at /u/ivan/cvs/repository/internal/testing/mpuserdb/webtest/add-serial.xml:115:  with (text=".*", property="generatedSerial", description="store the generated serial number", stepType="storeRegEx")com.canoo.webtest.engine.StepExecutionException: Unexpected exception caught: java.lang.NumberFormatException: null, Step: StoreRegExMatch at /u/ivan/cvs/repository/internal/testing/mpuserdb/webtest/add-serial.xml:115:  with (text=".*", property="generatedSerial", description="store the generated serial number", stepType="storeRegEx")
        at com.canoo.webtest.steps.Step.handleUnexpectedException(Step.java:575)
        at com.canoo.webtest.steps.Step.execute(Step.java:150)
        at com.canoo.webtest.engine.Engine.executeSteps(Engine.java:28)
        at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:79)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)


Total time: 11 seconds


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://webtest-community.canoo.com/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira