[ http://issues.apache.org/jira/browse/TRB-8?page=comments#action_12417494
]
Jürgen Hoffmann commented on TRB-8:
-----------------------------------
well the Problem I am adressing is the fact that the DefaultParameterParser
provides the function keySet() which looks like
public Set keySet()
{
return new CompositeSet(new Set[] { super.keySet(),
fileParameters.keySet() } );
}
as you can see this returns a CompositeSet made up of 2 seperate Sets,
TemplateURI makes use of this function within
protected void add(int type, ParameterParser pp)
{
for(Iterator it = pp.keySet().iterator(); it.hasNext();) <<----- here
is the call
{
String key = (String) it.next();
if (!key.equalsIgnoreCase(CGI_ACTION_PARAM) &&
!key.equalsIgnoreCase(CGI_SCREEN_PARAM) &&
!key.equalsIgnoreCase(CGI_TEMPLATE_PARAM))
{
String[] values = pp.getStrings(key); <---- this is causing the
problem though
if(values != null)
{
for (int i = 0; i < values.length; i++)
{
add(type, key, values[i]);
}
}
else
{
add(type, key, "");
}
}
}
}
getStrings is a Method defined in the BaseValueParser which does not know about
the fileParameters Map. get Strings calls
public String[] getStrings(String name)
{
return getParam(name);
}
which calls
protected String [] getParam(final String name)
{
String key = convert(name);
return (key != null) ? (String []) parameters.get(key) : null;
}
which does as you see not know about fileParameters Map.
So in my eyes as long as DefaultParameterParser.KeySet() returns the keys of
Both Maps, one would get a NPE if he is using TemplateURI.add(Integer,
ParameterParser) if he has uploaded a File before.
Hopefully this explanation shows the problem and why I think the problem is at
least to this extend a Prolem within TemplateURI
> 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, test-TRB-8.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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]