You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by "Gunther Olesch (JIRA)" <ji...@apache.org> on 2005/11/01 12:01:55 UTC

[jira] Commented: (TRB-8) Incorrect handling of a null return value

    [ http://issues.apache.org/jira/browse/TRB-8?page=comments#action_12356495 ] 

Gunther Olesch commented on TRB-8:
----------------------------------

I have digged a little deeper into the problem as it seemed to me that there should never be a return value of null in the first place. Here is what I came up with:

Here is the Exception again 
org.apache.turbine.services.pull.tools.TemplateLink.addPathInfo threw Exception java.lang.NullPointerException at org.apache.turbine.util.uri.TemplateURI.add(TemplateURI.java:274)

So looking in TemplateURI's add Method, the first thing done is to call keySet() on the ParameterParser to retrieve all the Keys within the request. Then the Method getStrings is called for each Key within the KeySet on the ParameterParser Object. The ParameterParser is most certainly an Instance of the DefaultParameterParser which inherits from BaseValueParser.

If we do now have a form submission which contains an input field of type file, we have a problem because the ParameterParser maintains two maps internally one for fileItems and one for the other parameters. But keySet returns all the Keys that are within the request by returning a CompositeSet with the keys from both maps. BUT the Method getStrings just checks the Map without the fileItems. That is why the Key is never found, and null is returned.

Then I compared t2.3.2's source with t2.3.1's source and found that the Method keySet() there did not return a CompositeSet of the fileItems and the rest, but only the restKeys.

I hope i could get the problem across...

> Incorrect handling of a null return value
> -----------------------------------------
>
>          Key: TRB-8
>          URL: http://issues.apache.org/jira/browse/TRB-8
>      Project: Turbine
>         Type: Bug
>   Components: Core
>     Versions: Core 2.3.2
>     Reporter: Gunther Olesch
>     Priority: Minor
>  Attachments: npe_patch.txt, npe_patch.txt
>
> I have found a bug within turbine 2.3.2 which results in a NullPointer to be thrown within TemplateURI Line 274. 
> I found the Bug because I used $link.addPathInfo($data.getParameters()) which takes all keys within the request, and adds the Keys and their values to the link. The Problem is within getStrings(String key) which returns null of no values are found. TemplateURI does not check the return value for null. I have a patch ready.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org