Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4672

StrutsApplicationResource incompatible with superclass PostfixedApplicationResource

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.5.2
    • Fix Version/s: None
    • Component/s: Plugin - Tiles
    • Labels:
      None

      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.

       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)
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jvali Joonas Vali

              Dates

              • Created:
                Updated:

                Issue deployment