You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by "Jon Hewitt (JIRA)" <ji...@apache.org> on 2009/05/08 14:53:45 UTC

[jira] Created: (ABDERA-231) NullPointerException in RequestOptions.addHeader() when no previous header with that name has been set

NullPointerException in RequestOptions.addHeader() when no previous header with that name has been set
------------------------------------------------------------------------------------------------------

                 Key: ABDERA-231
                 URL: https://issues.apache.org/jira/browse/ABDERA-231
             Project: Abdera
          Issue Type: Bug
    Affects Versions: 0.4.0
         Environment: All
            Reporter: Jon Hewitt


This code snippet recreates the problem.
        RequestOptions requestOptions = client.getDefaultRequestOptions();
	requestOptions.addHeader("Cookie", "anyNonNullValue");

Caused by: java.lang.NullPointerException
	at java.util.Arrays$ArrayList.<init>(Arrays.java:2370)
	at java.util.Arrays.asList(Arrays.java:2356)
	at org.apache.abdera.protocol.client.RequestOptions.addHeader(RequestOptions.java:272)
	at org.apache.abdera.protocol.client.RequestOptions.addHeader(RequestOptions.java:263)

It looks like that RequestOptions.addEncodedHeader() also has the same problem of calling Arrays.asList() before checking for returned null value from getHeaders().get(header)

One can workaround the problem by calling getHeader() to see if the header has previous values.  If it doesn't, just call setHeader().

This is a regression - addHeader() works fine in 0.2.2.

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


[jira] Resolved: (ABDERA-231) NullPointerException in RequestOptions.addHeader() when no previous header with that name has been set

Posted by "James M Snell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ABDERA-231?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James M Snell resolved ABDERA-231.
----------------------------------

    Resolution: Fixed

Fix checked into trunk


> NullPointerException in RequestOptions.addHeader() when no previous header with that name has been set
> ------------------------------------------------------------------------------------------------------
>
>                 Key: ABDERA-231
>                 URL: https://issues.apache.org/jira/browse/ABDERA-231
>             Project: Abdera
>          Issue Type: Bug
>    Affects Versions: 0.4.0
>         Environment: All
>            Reporter: Jon Hewitt
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> This code snippet recreates the problem.
>         RequestOptions requestOptions = client.getDefaultRequestOptions();
> 	requestOptions.addHeader("Cookie", "anyNonNullValue");
> Caused by: java.lang.NullPointerException
> 	at java.util.Arrays$ArrayList.<init>(Arrays.java:2370)
> 	at java.util.Arrays.asList(Arrays.java:2356)
> 	at org.apache.abdera.protocol.client.RequestOptions.addHeader(RequestOptions.java:272)
> 	at org.apache.abdera.protocol.client.RequestOptions.addHeader(RequestOptions.java:263)
> It looks like that RequestOptions.addEncodedHeader() also has the same problem of calling Arrays.asList() before checking for returned null value from getHeaders().get(header)
> One can workaround the problem by calling getHeader() to see if the header has previous values.  If it doesn't, just call setHeader().
> This is a regression - addHeader() works fine in 0.2.2.

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