|
Hi,
I want to write a testcase for my application with
HtmlUnit. Everytime when I make a request to first page of the application I get
this in log:
java.lang.NullPointerException
at org.apache.myfaces.renderkit.html.HtmlRendererUtils.selectContentType(HtmlRendererUtils.java:995) at org.apache.myfaces.renderkit.html.util.DefaultAddResource.writeResponse(DefaultAddResource.java:786) at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:142) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValvejava:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValvejava:178) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:831) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:652) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1203) at java.lang.Thread.run(Unknown Source) Because of this, there is an error 500 in the
response, so I cannot go on with my testcase.
I modified the HtmlRendererUtils source to test for
null and I can access my application from HtmlUnit.
So, I replaced this:
contentTypeListString =
(String)
context.getExternalContext().getRequestHeaderMap().get("Accept"); with this: if (context != null &&
context.getExternalContext() != null &&
context.getExternalContext().getRequestHeaderMap() != null)
{
contentTypeListString = (String) context.getExternalContext().getRequestHeaderMap().get("Accept"); } It is possible that I have an error in my jsps but
I think these tests with null should be also in Myfaces code.
If this is a problem in MyFaces, should I create a
JIRA issue?
Thanks,
Alin.
|
- problem that blocks tests with htmlunit Alin Dosoniu
- Re: problem that blocks tests with htmlunit Wayne Fay
- Re: problem that blocks tests with htmlunit John Fallows
- Re: problem that blocks tests with htmlunit Alin Dosoniu

