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 Robert Koberg <ro...@koberg.com> on 2005/01/28 15:06:28 UTC
re: bug CACTUS-61 - Cactus doesn't properly integrate w/HttpUnit.
External Javascript generates NullPointerException
I have posted this bug to the HttpUnit mail list (twice) and received no
response. HttpUnit uses a base URL to resolve the file, so if you have:
<script src="http://blah.com/js.js"/>
You are out of luck. I looked at patching it but it requires quite a few
changes (throwing SAXExceptions for some reason).
Here is what i posted to the httpunit list:
I have some pages under test that have script tags with fully qualified
paths for the src attribute:
<script src="http://blah.com/js.js"/>
the base URL for the page is a different domain.
in ParsedHTML.getIncludedScript it tries to get the resource by sending
the base url and the src attribute string. This is causing a null
pointer in my test.
I tried to patch ParsedHTML with something like:
if (srcAttribute.startsWith("http://")) {
req = new GetMethodRequest( srcAttribute );
} else {
req = new GetMethodRequest( getBaseURL(), srcAttribute );
}
But this throws an IllegalStateException and asks me to use getResponse
instead of getResource. Doing this wants a SAXeception to be thrown
which would have to bubble up.
Any suggestions on how to parse a page with a script element like the
example above?
best,
-Rob