You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Alin Dosoniu (JIRA)" <de...@myfaces.apache.org> on 2006/02/15 09:31:59 UTC

[jira] Created: (MYFACES-1125) problem that blocks tests with htmlunit

problem that blocks tests with htmlunit
---------------------------------------

         Key: MYFACES-1125
         URL: http://issues.apache.org/jira/browse/MYFACES-1125
     Project: MyFaces
        Type: Bug
  Components: Implementation  
    Versions: Nightly    
 Environment: JDK 1.5, Tomcat 5.5.12, application with MyFaces and Tiles
    Reporter: Alin Dosoniu


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.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MYFACES-1125) problem that blocks tests with htmlunit

Posted by "Alin Dosoniu (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/MYFACES-1125?page=comments#action_12367852 ] 

Alin Dosoniu commented on MYFACES-1125:
---------------------------------------

This issue is a duplicate of MYFACES-1121. The solution from that issue is the same as the solution for this problem. 
Please, close it and hope that someone will solve/find a solution for 1121.

> problem that blocks tests with htmlunit
> ---------------------------------------
>
>          Key: MYFACES-1125
>          URL: http://issues.apache.org/jira/browse/MYFACES-1125
>      Project: MyFaces Core
>         Type: Bug
>   Components: General
>     Versions: 1.1.2-SNAPSHOT
>  Environment: JDK 1.5, Tomcat 5.5.12, application with MyFaces and Tiles
>     Reporter: Alin Dosoniu

>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MYFACES-1125) problem that blocks tests with htmlunit

Posted by "Alin Dosoniu (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/MYFACES-1125?page=comments#action_12366454 ] 

Alin Dosoniu commented on MYFACES-1125:
---------------------------------------

Not certain, but I think the spec requires ExternalContext.getRequestHeaderMap() to return a non-null Map.

If so, the fix would probably be in the setup of ExternalContext rather than in each usage of ExternalContext.getRequestHeaderMap ().

Kind Regards,
John Fallows.


On 2/14/06, Wayne Fay <wa...@gmail.com> wrote:
On 2/14/06, Alin Dosoniu <ad...@hotmail.com> wrote:
> 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?
>

IIRC, this has come up before with someone else who was trying to use
HttpUnit on a MyFaces project site. Thus I think this must be MyFaces 
code bug, which you seem to have traced and solved. So I think you
should create a JIRA issue...

wf



> problem that blocks tests with htmlunit
> ---------------------------------------
>
>          Key: MYFACES-1125
>          URL: http://issues.apache.org/jira/browse/MYFACES-1125
>      Project: MyFaces
>         Type: Bug
>   Components: Implementation
>     Versions: Nightly
>  Environment: JDK 1.5, Tomcat 5.5.12, application with MyFaces and Tiles
>     Reporter: Alin Dosoniu

>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MYFACES-1125) problem that blocks tests with htmlunit

Posted by "Alin Dosoniu (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/MYFACES-1125?page=comments#action_12366455 ] 

Alin Dosoniu commented on MYFACES-1125:
---------------------------------------

I made a little more investigation and the problem is that the context is null. 
So, I think that only the test for context will solve the problem.


> problem that blocks tests with htmlunit
> ---------------------------------------
>
>          Key: MYFACES-1125
>          URL: http://issues.apache.org/jira/browse/MYFACES-1125
>      Project: MyFaces
>         Type: Bug
>   Components: Implementation
>     Versions: Nightly
>  Environment: JDK 1.5, Tomcat 5.5.12, application with MyFaces and Tiles
>     Reporter: Alin Dosoniu

>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (MYFACES-1125) problem that blocks tests with htmlunit

Posted by "Volker Weber (JIRA)" <de...@myfaces.apache.org>.
     [ http://issues.apache.org/jira/browse/MYFACES-1125?page=all ]
     
Volker Weber closed MYFACES-1125:
---------------------------------

    Resolution: Duplicate

Closed as dublicate of MYFACES-1121 on Alin Dosonius request.

> problem that blocks tests with htmlunit
> ---------------------------------------
>
>          Key: MYFACES-1125
>          URL: http://issues.apache.org/jira/browse/MYFACES-1125
>      Project: MyFaces Core
>         Type: Bug
>   Components: General
>     Versions: 1.1.2-SNAPSHOT
>  Environment: JDK 1.5, Tomcat 5.5.12, application with MyFaces and Tiles
>     Reporter: Alin Dosoniu

>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira