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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to