PriyaranjanMohapatra / rest-client

Automatically exported from code.google.com/p/rest-client
Apache License 2.0
0 stars 0 forks source link

Executing fail() in test script for CLI results in Exception in CLI #88

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Create a request file w/ a test script that will cause a fail() to execute. 

What is the expected output? What do you see instead?
You get this:

What version of the product are you using? On what operating system?

org.wiztools.restclient.XMLException
    at org.wiztools.restclient.XMLUtil.response2XML(XMLUtil.java:429)
    at org.wiztools.restclient.XMLUtil.writeResponseXML(XMLUtil.java:567)
    at org.wiztools.restclient.cli.CliMain$CliView.doResponse(CliMain.java:75)
    at
org.wiztools.restclient.HTTPClientRequestExecuter.execute(HTTPClientRequestExecu
ter.java:320)
    at org.wiztools.restclient.cli.CliMain.main(CliMain.java:132)
Caused by: java.lang.NullPointerException
    at org.wiztools.restclient.XMLUtil.response2XML(XMLUtil.java:402)
    ... 4 more

Please provide any additional information below.
I fixed it locally. It looks like a simple copy/paste bug. Change line 400
of XMLUtil to say "if (testResult.getErrorCount() > 0)" and NOT :if
(testResult.getFailureCount() > 0)"

I can submit a patch if you like.

Original issue reported on code.google.com by jgu...@gmail.com on 17 May 2009 at 3:17

GoogleCodeExporter commented 8 years ago
Please attach the patch. Will run rudimentary tests and apply the patch in the 
trunk.

Original comment by subwiz on 17 May 2009 at 11:54

GoogleCodeExporter commented 8 years ago
A patch for XMLUtil.java is attached, along with a simple RCQ file that forces 
a test
failure. On an unpatched file, the CLI will exit with a stacktrace; with a 
patched
file it will exit properly and report a test failure.

The patch file should work for you (I generated it w/ IntelliJ, and it looks 
fine).
It's a trivial change at any rate.

Thanks!

Original comment by jgu...@gmail.com on 18 May 2009 at 12:37

Attachments:

GoogleCodeExporter commented 8 years ago
Revision 432 has the fix. Thanks a lot for sharing this :-)

Original comment by subwiz on 18 May 2009 at 5:25

GoogleCodeExporter commented 8 years ago
This change does not seem to have persisted into 2.3.3.  I am getting the 
original error when I attempt to save a response that caused fail() to execute.

Original comment by sbutle...@gmail.com on 23 Aug 2011 at 1:16

GoogleCodeExporter commented 8 years ago

Original comment by subwiz on 28 Aug 2011 at 2:36

GoogleCodeExporter commented 8 years ago
r511 has the fix. Thanks for pointing this out: the original trunk has been 
moved to an experimental branch---that caused this regression.

Original comment by subwiz on 28 Aug 2011 at 2:49