Forum Discussion

snoll's avatar
snoll
Occasional Contributor
12 years ago

[Resolved] NPE when a matrix parameter is empty

I discovered a new bug when trying to run my soapUI 4.0.1 based test project in the new 4.5.1 nightly build.
It’s a null pointer exception that occurs when a matrix parameter is left empty:

java.lang.NullPointerException
at java.net.URLDecoder.decode(Unknown Source)
at com.eviware.soapui.impl.wsdl.submit.filters.HttpRequestFilter.isAlreadyEncoded(HttpRequestFilter.java:511)
at com.eviware.soapui.impl.wsdl.submit.filters.HttpRequestFilter.getEncodedValue(HttpRequestFilter.java:489)
at com.eviware.soapui.impl.wsdl.submit.filters.HttpRequestFilter.filterHttpRequest(HttpRequestFilter.java:187)
at com.eviware.soapui.impl.wsdl.submit.filters.RestRequestFilter.filterRestRequest(RestRequestFilter.java:39)
at com.eviware.soapui.impl.wsdl.submit.filters.AbstractRequestFilter.filterAbstractHttpRequest(AbstractRequestFilter.java:39)
at com.eviware.soapui.impl.wsdl.submit.filters.AbstractRequestFilter.filterRequest(AbstractRequestFilter.java:31)
at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:177)
at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:123)
at com.eviware.soapui.impl.wsdl.WsdlSubmit.submitRequest(WsdlSubmit.java:76)
at com.eviware.soapui.impl.rest.RestRequest.submit(RestRequest.java:209)
at com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep.run(RestTestRequestStep.java:898)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:239)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:48)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:148)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:43)
at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:135)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

For your convenience I attach a project file to reproduce the error.
Please start the mock service first, then run the test case. Step 1 will work ok, because all parameters are set. Step 2 will produce the exception, it shows up in the error log.

Please also see viewtopic.php?f=2&t=13126&p=43112#p43111

Regards,
Stephan

5 Replies

  • snoll's avatar
    snoll
    Occasional Contributor
    Problem still exists in SoapUI pro 4.5.2
    Please verify with attached project file in previous message.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    Thanks for reporting this bug... this is a known bug, the ID in our tracking system is: SOAPUI-4631
    We will fix this as soon as possible. If this is important for your tests and you can't find a work-around, please watch our Nightly-builds, we may release this fix very soon.

    Regards,

    Renato Athaydes
    SmartBear Software
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    While we work on fixing this issue, here's a work-around that should work for most cases!

    Paste the following Groovy script into the "Setup Script" of each TestSuite where you have this problem:


    testSuite.testCaseList.each { tc ->
    tc.testStepList.each { step ->
    step.properties.each { _, prop ->
    if ( prop.class.name.endsWith( 'RestTestStepProperty' ) && prop.value == null ) {
    prop.value = ''
    }
    }
    }
    }


    Regards,

    Renato Athaydes
    SmartBear Software