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

Scot Meyer updated TILES-134:
-----------------------------


Honestly without completly inspecting the code I assumed that there was good 
reason for container being null in startContext and it appeared that the 
componentContext was only initially retrieved from the container at this point. 
 So perhaps its really a check of the componentContext validity after the if in 
the startContext although putting it in doStartTag would effectively be the 
same assuming you checked after the startContext method call.

> NullPointer Exception when tiles servlet is not defined
> -------------------------------------------------------
>
>                 Key: TILES-134
>                 URL: https://issues.apache.org/struts/browse/TILES-134
>             Project: Tiles
>          Issue Type: Improvement
>          Components: tiles-jsp (jsp support)
>    Affects Versions: 2.0.2
>         Environment: Tomcat 5.5.20, jre1.5_06
>            Reporter: Scot Meyer
>         Assigned To: Antonio Petrelli
>
> When implementing a simple template and the tiles servlet is not defined in 
> the web.xml you get a NullPointer exception at line 144 when running.  This 
> can be difficult for the implementer to realize what they did wrong.  A 
> suggestion would be to throw and exception when the context is null.  It 
> might be better to throw a TilesException however the interface defines a 
> JspException so I used it.
> --- RenderTagSupport.java       2007-03-05 16:53:50.000000000 -0500
> +++ tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/RenderTagSupport.java 
>   2007-03-05 16:52:49.000000000 -0500
> @@ -136,13 +136,11 @@
>       *
>       * @param nestedTag the put tag desciendent.
>       */
> -    public void processNestedTag(PutAttributeTag nestedTag) throws 
> JspException {
> +    public void processNestedTag(PutAttributeTag nestedTag) {
>          ComponentAttribute attribute = new ComponentAttribute(
>              nestedTag.getValue(), nestedTag.getRole(),
>              nestedTag.getType());
> -        if (componentContext==null) throw new JspException("componentContext 
> is null.  Do you have the org.apache.tiles.servlet.TilesServlet defined in 
> the web.xml?");
> -
>          componentContext.putAttribute(
>              nestedTag.getName(),
>              attribute
> ~

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to