[seam-issues] [JBoss JIRA] Commented: (JBSEAM-3770) MockHttpServletRequest.getHeaders(String) breaks for nonexistent headers

Richard Stanford (JIRA) jira-events at lists.jboss.org
Tue Dec 8 11:29:29 EST 2009


    [ https://jira.jboss.org/jira/browse/JBSEAM-3770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12498824#action_12498824 ] 

Richard Stanford commented on JBSEAM-3770:
------------------------------------------

This also appears to affect 2.2.0.GA - we ran into it by having an @RequestParameter annotation on a Stateless bean that was being called during an email rendering.

In MockHttpServletRequest, the following method breaks:

   public Enumeration getHeaders(String header)
   {
      return new IteratorEnumeration( Arrays.asList( headers.get(header) ).iterator() );
   }

due to the missing header.  The return is being checked for null in Parameters.java:53 (convertMultiValueRequestParameter), but its actually throwing an NPE which is uncaught.  It appears that MHSR should be expanded similar to the getHeader(String) method above it:

   public Enumeration getHeaders(String header)
   {
      String[] values = headers.get(header);
      return values==null || values.length==0 ? null : new IteratorEnumeration( Arrays.asList( values ).iterator() );
   }


> MockHttpServletRequest.getHeaders(String) breaks for nonexistent headers
> ------------------------------------------------------------------------
>
>                 Key: JBSEAM-3770
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3770
>             Project: Seam
>          Issue Type: Bug
>          Components: Test Harness
>    Affects Versions: 2.0.3.CR1, 2.1.1.CR1
>            Reporter: Matt Drees
>            Assignee: Matt Drees
>            Priority: Minor
>
> Checked against 2.0.3.CR1
> java.lang.NullPointerException
> 	at java.util.Arrays$ArrayList.<init>(Arrays.java:3357)
> 	at java.util.Arrays.asList(Arrays.java:3343)
> 	at org.jboss.seam.mock.MockHttpServletRequest.getHeaders(MockHttpServletRequest.java:100)
> 	at org.uscm.crs.filter.MojarraBugWorkaroundFilter.doFilter(MojarraBugWorkaroundFilter.java:60)
> ...
> I didn't check against trunk, but from a glance over the source code, it looks like it'll break there too.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list