struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukasz Lenart (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (WW-4672) StrutsApplicationResource incompatible with superclass PostfixedApplicationResource
Date Thu, 28 Jul 2016 17:35:20 GMT

     [ https://issues.apache.org/jira/browse/WW-4672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Lukasz Lenart updated WW-4672:
------------------------------
    Description: 
{{org.apache.struts2.tiles.StrutsApplicationResource}} constructor takes in a single parameter,
URL, and from this parameter getPath() is asked, which returns absolute path to a resource
on disk (usually?), and this is passed to the superclass as String. 

This logic is however incompatible with superclass {{org.apache.tiles.request.locale.PostfixedApplicationResource}}
which is built to deal with relative paths to the context root. e.g '/WEB-INF/tiles.xml'.

Previous creates issues with 'refreshing' enabled in (CachingLocaleUrlDefinitionDAO) superclass
{{org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO#refreshRequired()}} method, which
iterates over these resource paths and ultimately calls {{servletContext#getResource(path)}},
which always returns null on absolute paths. This results in the following NPE on next line
where {{resource.getLastModified()}} is asked. 

{noformat}
 java.lang.NullPointerException
	at org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO.refreshRequired(BaseLocaleUrlDefinitionDAO.java:120)
	at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinitions(CachingLocaleUrlDefinitionDAO.java:130)
	at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:105)
	at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:49)
	at org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory.getDefinition(UnresolvingLocaleDefinitionsFactory.java:89)
	at org.apache.tiles.impl.BasicTilesContainer.getDefinition(BasicTilesContainer.java:286)
	at org.apache.tiles.impl.BasicTilesContainer.isValidDefinition(BasicTilesContainer.java:273)
	at org.apache.tiles.TilesContainerWrapper.isValidDefinition(TilesContainerWrapper.java:88)
	at org.apache.tiles.impl.mgmt.CachingTilesContainer.isValidDefinition(CachingTilesContainer.java:100)
	at org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:139)
	at org.apache.struts2.result.StrutsResultSupport.execute(StrutsResultSupport.java:208)
{noformat}

  was:
org.apache.struts2.tiles.StrutsApplicationResource constructor takes in a single parameter,
URL, and from this parameter getPath() is asked, which returns absolute path to a resource
on disk (usually?), and this is passed to the superclass as String. 

This logic is however incompatible with superclass org.apache.tiles.request.locale.PostfixedApplicationResource
which is built to deal with relative paths to the context root. e.g '/WEB-INF/tiles.xml'.

Previous creates issues with 'refreshing' enabled in (CachingLocaleUrlDefinitionDAO) superclass
org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO#refreshRequired() method, which
iterates over these resource paths and ultimately calls servletContext#getResource(path),
which always returns null on absolute paths. This results in the following NPE on next line
where resource.getLastModified() is asked. 

 java.lang.NullPointerException
	at org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO.refreshRequired(BaseLocaleUrlDefinitionDAO.java:120)
	at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinitions(CachingLocaleUrlDefinitionDAO.java:130)
	at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:105)
	at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:49)
	at org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory.getDefinition(UnresolvingLocaleDefinitionsFactory.java:89)
	at org.apache.tiles.impl.BasicTilesContainer.getDefinition(BasicTilesContainer.java:286)
	at org.apache.tiles.impl.BasicTilesContainer.isValidDefinition(BasicTilesContainer.java:273)
	at org.apache.tiles.TilesContainerWrapper.isValidDefinition(TilesContainerWrapper.java:88)
	at org.apache.tiles.impl.mgmt.CachingTilesContainer.isValidDefinition(CachingTilesContainer.java:100)
	at org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:139)
	at org.apache.struts2.result.StrutsResultSupport.execute(StrutsResultSupport.java:208)




> StrutsApplicationResource incompatible with superclass PostfixedApplicationResource
> -----------------------------------------------------------------------------------
>
>                 Key: WW-4672
>                 URL: https://issues.apache.org/jira/browse/WW-4672
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tiles
>    Affects Versions: 2.5.2
>            Reporter: Joonas Vali
>            Priority: Minor
>
> {{org.apache.struts2.tiles.StrutsApplicationResource}} constructor takes in a single
parameter, URL, and from this parameter getPath() is asked, which returns absolute path to
a resource on disk (usually?), and this is passed to the superclass as String. 
> This logic is however incompatible with superclass {{org.apache.tiles.request.locale.PostfixedApplicationResource}}
which is built to deal with relative paths to the context root. e.g '/WEB-INF/tiles.xml'.
> Previous creates issues with 'refreshing' enabled in (CachingLocaleUrlDefinitionDAO)
superclass {{org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO#refreshRequired()}}
method, which iterates over these resource paths and ultimately calls {{servletContext#getResource(path)}},
which always returns null on absolute paths. This results in the following NPE on next line
where {{resource.getLastModified()}} is asked. 
> {noformat}
>  java.lang.NullPointerException
> 	at org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO.refreshRequired(BaseLocaleUrlDefinitionDAO.java:120)
> 	at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinitions(CachingLocaleUrlDefinitionDAO.java:130)
> 	at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:105)
> 	at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:49)
> 	at org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory.getDefinition(UnresolvingLocaleDefinitionsFactory.java:89)
> 	at org.apache.tiles.impl.BasicTilesContainer.getDefinition(BasicTilesContainer.java:286)
> 	at org.apache.tiles.impl.BasicTilesContainer.isValidDefinition(BasicTilesContainer.java:273)
> 	at org.apache.tiles.TilesContainerWrapper.isValidDefinition(TilesContainerWrapper.java:88)
> 	at org.apache.tiles.impl.mgmt.CachingTilesContainer.isValidDefinition(CachingTilesContainer.java:100)
> 	at org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:139)
> 	at org.apache.struts2.result.StrutsResultSupport.execute(StrutsResultSupport.java:208)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message