Hello community!
I'm using jakarta-cactus-1.5-beta1 with httpunit-1.5.4 and experiencing
the following problem while parsing HTML responce with external
javascript:
There was 1 error:
1)
testActionUserSyncPrefEdit(com.g2x.agility.web.UserSyncPrefActionHandlerTest)java.lang.NullPointerException
at
com.meterware.httpunit.ParsedHTML.getIncludedScript(ParsedHTML.java:305)
at
com.meterware.httpunit.ParsedHTML.getScript(ParsedHTML.java:289)
at
com.meterware.httpunit.ParsedHTML.interpretScriptElement(ParsedHTML.java:269)
at
com.meterware.httpunit.ParsedHTML.access$600(ParsedHTML.java:37)
at
com.meterware.httpunit.ParsedHTML$ScriptFactory.recordElement(ParsedHTML.java:404)
at
com.meterware.httpunit.ParsedHTML$2.processElement(ParsedHTML.java:556)
at
com.meterware.httpunit.NodeUtils$PreOrderTraversal.perform(NodeUtils.java:169)
at
com.meterware.httpunit.ParsedHTML.loadElements(ParsedHTML.java:566)
at
com.meterware.httpunit.ParsedHTML.getElementWithID(ParsedHTML.java:225)
at
com.meterware.httpunit.ParsedHTML.getFormWithID(ParsedHTML.java:211)
at
com.meterware.httpunit.WebResponse.getFormWithID(WebResponse.java:329)
at
com.g2x.agility.web.UserSyncPrefActionHandlerTest.endActionUserSyncPrefEdit(UserSyncPrefActionHandlerTest.java:97)
at
org.apache.cactus.internal.client.WebClientTestCaseDelegate.callGenericEndMethod(WebClientTestCaseDelegate.java;org/apache/cactus/util/log/LogAspect.aj[1k]:189)
at
org.apache.cactus.internal.client.WebClientTestCaseDelegate.dispatch75_callEndMethod(WebClientTestCaseDelegate.java;org/apache/cactus/util/log/LogAspect.aj[1k]:244)
at
org.apache.cactus.internal.client.WebClientTestCaseDelegate.around75_callEndMethod(WebClientTestCaseDelegate.java;org/apache/cactus/util/log/LogAspect.aj[1k]:1240)
at
org.apache.cactus.internal.client.WebClientTestCaseDelegate.callEndMethod(WebClientTestCaseDelegate.java;org/apache/cactus/util/log/LogAspect.aj[1k]:240)
at
org.apache.cactus.internal.client.WebClientTestCaseDelegate.runGenericTest(WebClientTestCaseDelegate.java;org/apache/cactus/util/log/LogAspect.aj[1k]:285)
at
org.apache.cactus.internal.client.WebClientTestCaseDelegate.runTest(WebClientTestCaseDelegate.java;org/apache/cactus/util/log/LogAspect.aj[1k]:258)
at
org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:289)
at
org.apache.cactus.ServletTestCase.runBare(ServletTestCase.java:251)
at
com.intellij.rt.execution.junit.TextTestRunner.main(TextTestRunner.java:12)
Responce HTML being parsed looks like:
<html>
<head>
<link rel="stylesheet" type="text/css" href="../jsp/css_dom.css">
<link rel="stylesheet" type="text/css" href="../jsp/css_dom_sync.css">
<style type="text/css">
div.frm_subformSection {display: none}
</style>
<script language="JavaScript" src="../jsp/JSConstants.js"></script>
<script language="JavaScript" src="../jsp/js_lib.js"></script>
<script language="JavaScript" src="../jsp/validate.js"></script>
</head>
<body>
<form name="form0" action="../servlet/controller" method="post">
<!-- big form goes here -->
</form>
</body>
</html>
As you can see the exception occures in
com.meterware.httpunit.ParsedHTML.getIncludedScript which tries to call
method at WebWindow object which is not set (it is null).
Probably code in WebResponseObjectFactory.createHttpUnitWebResponse that
calls WebResponce.newResponce
weach leads to creting WebResponce with WebClient _client field equal to
null should be changed.
I had the same problem with jakarta-cactus-1.4.1 + httpunit-1.5.4
So the question is: is there any workaround for this?
Any help will be greately appreciated.
Aleksey.