Code with Finding: |
class AgiRequestImpl {
public synchronized String[] getArguments()
{
if (arguments != null)
{
return arguments.clone();
}
final Map<Integer, String> map = new HashMap<Integer, String>();
int maxIndex = 0;
for (Map.Entry<String, String> entry : request.entrySet())
{
if (! entry.getKey().startsWith("arg_"))
{
continue;
}
int index = Integer.valueOf(entry.getKey().substring(4));
if (index > maxIndex)
{
maxIndex = index;
}
map.put(index, entry.getValue());
}
arguments = new String[maxIndex];
for (int i = 0; i < maxIndex; i++)
{
arguments[i] = map.get(i + 1);
}
return arguments.clone();
}
}
|