Httpunit tests fail against EAP 6 for custom error response codes

Solution Verified - Updated -

Issue

  • We use httpunit to run test cases against JBoss. All test cases worked against EAP 5, but with EAP 6, the test client fails if a test involves a response with a custom error response code (some untypical HTTP response 400 or greater):
Server returned HTTP response code: 453 for URL: http://localhost:8080/helloworld/453.jsp
java.io.IOException: Server returned HTTP response code: 453 for URL: http://localhost:8080/helloworld/453.jsp
    at sun.reflect.GeneratedConstructorAccessor1.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1458)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1452)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1106)
    at com.meterware.httpunit.HttpWebResponse.getInputStream(HttpWebResponse.java:88)
    at com.meterware.httpunit.HttpWebResponse.<init>(HttpWebResponse.java:61)
    at com.meterware.httpunit.HttpWebResponse.<init>(HttpWebResponse.java:68)
    at com.meterware.httpunit.WebConversation.newResponse(WebConversation.java:83)
    at com.meterware.httpunit.WebClient.createResponse(WebClient.java:647)
    at com.meterware.httpunit.WebWindow.getResource(WebWindow.java:220)
    at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:181)
    at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:158)
    at com.meterware.httpunit.WebClient.getResponse(WebClient.java:122)
    at ExampleTest.tryGetResponse(ExampleTest.java:49)
    at ExampleTest.testWelcomePage(ExampleTest.java:72)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at junit.textui.TestRunner.doRun(TestRunner.java:116)
    at junit.textui.TestRunner.doRun(TestRunner.java:109)
    at junit.textui.TestRunner.run(TestRunner.java:72)
    at ExampleTest.main(ExampleTest.java:17)
Caused by: java.io.IOException: Server returned HTTP response code: 453 for URL: http://localhost:8080/helloworld/453.jsp
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1403)
    at sun.net.www.protocol.http.HttpURLConnection.getHeaderFieldKey(HttpURLConnection.java:2267)
    at com.meterware.httpunit.HttpWebResponse.loadHeaders(HttpWebResponse.java:255)
    at com.meterware.httpunit.HttpWebResponse.readHeaders(HttpWebResponse.java:237)
    at com.meterware.httpunit.HttpWebResponse.<init>(HttpWebResponse.java:57)
    ... 25 more

Environment

  • JBoss Enterprise Application Platform (EAP) 6
  • Httpunit

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content