[gatein-issues] [JBoss JIRA] (GTNPORTAL-2790) Potential NPE with Tomcat 7 in developing mode

Hai Nguyen (JIRA) jira-events at lists.jboss.org
Mon Jan 7 04:15:08 EST 2013


     [ https://issues.jboss.org/browse/GTNPORTAL-2790?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hai Nguyen updated GTNPORTAL-2790:
----------------------------------

    Description: 
In tomcat 7, the wars does not locate at "appBase" which is not unpacked. 
https://issues.apache.org/bugzilla/show_bug.cgi?id=51294

But in ServletResourceResolver.isModified, we used ServletContext.getRealPath to get absolute path's file resource which will return NULL. Due to the WAR was not upacked.

We should use URLConnection.getLastModified instead of use getRealPath and File api

Step to reproduce:

- Move webapps/portal.war to wars/portal.war
- Replace docBase to '${catalina.home}/wars/portal.war' in conf/Catalina/localhost/portal.xml
- Start bin/gatein-dev.sh run

And go to home page, the NPE occurs:
java.lang.NullPointerException
	at java.io.File.<init>(File.java:222)
	at org.exoplatform.resolver.ServletResourceResolver.isModified(ServletResourceResolver.java:77)
	at org.exoplatform.webui.core.lifecycle.Lifecycle.renderTemplate(Lifecycle.java:106)
	at org.exoplatform.portal.webui.workspace.UIPortalApplicationLifecycle.processRender(UIPortalApplicationLifecycle.java:124)
...............


  was:
In tomcat 7, the wars does not locate at "appBase" which is not unpacked. 
https://issues.apache.org/bugzilla/show_bug.cgi?id=51294

But in ServletResourceResolver.isModified, we used ServletContext.getRealPath to get absolute path's file resource which will return NULL. Due to the WAR was not upacked.

We should use URLConnection.getLastModified instead of use getRealPath and File api



    
> Potential NPE with Tomcat 7 in developing mode
> ----------------------------------------------
>
>                 Key: GTNPORTAL-2790
>                 URL: https://issues.jboss.org/browse/GTNPORTAL-2790
>             Project: GateIn Portal
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 3.5.0.Final
>            Reporter: Hai Nguyen
>            Assignee: Hai Nguyen
>
> In tomcat 7, the wars does not locate at "appBase" which is not unpacked. 
> https://issues.apache.org/bugzilla/show_bug.cgi?id=51294
> But in ServletResourceResolver.isModified, we used ServletContext.getRealPath to get absolute path's file resource which will return NULL. Due to the WAR was not upacked.
> We should use URLConnection.getLastModified instead of use getRealPath and File api
> Step to reproduce:
> - Move webapps/portal.war to wars/portal.war
> - Replace docBase to '${catalina.home}/wars/portal.war' in conf/Catalina/localhost/portal.xml
> - Start bin/gatein-dev.sh run
> And go to home page, the NPE occurs:
> java.lang.NullPointerException
> 	at java.io.File.<init>(File.java:222)
> 	at org.exoplatform.resolver.ServletResourceResolver.isModified(ServletResourceResolver.java:77)
> 	at org.exoplatform.webui.core.lifecycle.Lifecycle.renderTemplate(Lifecycle.java:106)
> 	at org.exoplatform.portal.webui.workspace.UIPortalApplicationLifecycle.processRender(UIPortalApplicationLifecycle.java:124)
> ...............

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the gatein-issues mailing list