Date: 2004-11-07T02:30:36
Editor: ShinobuKawai <[EMAIL PROTECTED]>
Wiki: Jakarta-Velocity Wiki
Page: ArrayTool
URL: http://wiki.apache.org/jakarta-velocity/ArrayTool
no comment
Change Log:
------------------------------------------------------------------------------
@@ -124,13 +124,24 @@
*/
public Object get(Object array, int index)
{
+ if (array == null)
+ {
+ return null;
+ }
try
{
- return this.list(array).get(index);
+ if (array instanceof List)
+ {
+ return ((List) array).get(index);
+ }
+ if (array.getClass().isArray())
+ {
+ return Array.get(array, index);
+ }
}
- catch (RuntimeException e)
+ catch (IndexOutOfBoundsException e)
{
- // It wasn't an array, or the index was wrong.
+ // The index was wrong.
}
return null;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]