You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by al...@g2x.com on 2003/10/21 19:16:46 UTC
Problem with external javascript while parsing responce
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.
RE: Problem with external javascript while parsing responce
Posted by Vincent Massol <vm...@pivolis.com>.
Hi Aleksey,
Are you sure you're including the js.jar jar in your client side
classpath?
Thanks
-Vincent
> -----Original Message-----
> From: aleksey.korolev@g2x.com [mailto:aleksey.korolev@g2x.com]
> Sent: 21 October 2003 19:17
> To: cactus-user@jakarta.apache.org
> Subject: Problem with external javascript while parsing responce
>
> 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.UserSyncPrefActionHandler
Te
> st)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
:2
> 69)
> at
> com.meterware.httpunit.ParsedHTML.access$600(ParsedHTML.java:37)
> at
>
com.meterware.httpunit.ParsedHTML$ScriptFactory.recordElement(ParsedHTML
.j
> ava:404)
> at
>
com.meterware.httpunit.ParsedHTML$2.processElement(ParsedHTML.java:556)
> at
>
com.meterware.httpunit.NodeUtils$PreOrderTraversal.perform(NodeUtils.jav
a:
> 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.endActionUserSyncPrefE
di
> t(UserSyncPrefActionHandlerTest.java:97)
> at
>
org.apache.cactus.internal.client.WebClientTestCaseDelegate.callGenericE
nd
>
Method(WebClientTestCaseDelegate.java;org/apache/cactus/util/log/LogAspe
ct
> .aj[1k]:189)
> at
>
org.apache.cactus.internal.client.WebClientTestCaseDelegate.dispatch75_c
al
>
lEndMethod(WebClientTestCaseDelegate.java;org/apache/cactus/util/log/Log
As
> pect.aj[1k]:244)
> at
>
org.apache.cactus.internal.client.WebClientTestCaseDelegate.around75_cal
lE
>
ndMethod(WebClientTestCaseDelegate.java;org/apache/cactus/util/log/LogAs
pe
> ct.aj[1k]:1240)
> at
>
org.apache.cactus.internal.client.WebClientTestCaseDelegate.callEndMetho
d(
>
WebClientTestCaseDelegate.java;org/apache/cactus/util/log/LogAspect.aj[1
k]
> :240)
> at
>
org.apache.cactus.internal.client.WebClientTestCaseDelegate.runGenericTe
st
>
(WebClientTestCaseDelegate.java;org/apache/cactus/util/log/LogAspect.aj[
1k
> ]:285)
> at
>
org.apache.cactus.internal.client.WebClientTestCaseDelegate.runTest(WebC
li
>
entTestCaseDelegate.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.