You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tiles.apache.org by "Nicolas Le Bas (Commented) (JIRA)" <ji...@apache.org> on 2011/11/06 16:24:51 UTC

[jira] [Commented] (TREQ-10) NPE while reading the session scope when no session has been created

    [ https://issues.apache.org/jira/browse/TREQ-10?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13145020#comment-13145020 ] 

Nicolas Le Bas commented on TREQ-10:
------------------------------------

I have been a bit hasty indeed.
You patch looks great, except that Collections.emptyEnumeration() exists since 1.7, and Tiles is supposed to run on java 1.5 according to the POM. 
My solution is not ideal either, probably Collections.enumeration(Collections.<String>emptySet()) is best.
                
> NPE while reading the session scope when no session has been created
> --------------------------------------------------------------------
>
>                 Key: TREQ-10
>                 URL: https://issues.apache.org/jira/browse/TREQ-10
>             Project: Tiles Request
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Nicolas Le Bas
>            Priority: Minor
>         Attachments: TREQ-10.patch
>
>
> If no HttpSession has been created, the following code leads to an exception:
> Map<String, Object> scopes = new HashMap<String, Object>();
> Map<String, Object> data = request.getContext("session");
> scopes.putAll(data);
> java.lang.NullPointerException
> 	org.apache.tiles.request.util.RequestUtil.enumerationSize(RequestUtil.java:64)
> 	org.apache.tiles.request.collection.ReadOnlyEnumerationMap.size(ReadOnlyEnumerationMap.java:128)
> 	java.util.HashMap.putAll(HashMap.java:498)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira