You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/05/14 15:18:36 UTC

svn commit: r1103095 [15/24] - in /incubator/ognl/trunk/src: main/java/org/apache/commons/ognl/ main/java/org/apache/commons/ognl/enhance/ main/java/org/apache/commons/ognl/internal/ test/java/org/apache/commons/ognl/ test/java/org/apache/commons/ognl/...

Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlRuntime.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlRuntime.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlRuntime.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlRuntime.java Sat May 14 13:18:29 2011
@@ -60,28 +60,32 @@ import java.util.Set;
 
 /**
  * Utility class used by internal OGNL API to do various things like:
- *
  * <ul>
- * <li>Handles majority of reflection logic / caching. </li>
+ * <li>Handles majority of reflection logic / caching.</li>
  * <li>Utility methods for casting strings / various numeric types used by {@link OgnlExpressionCompiler}.</li.
- * <li>Core runtime configuration point for setting/using global {@link TypeConverter} / {@link OgnlExpressionCompiler} /
- * {@link NullHandler} instances / etc.. </li>
- *</ul>
- *
+ * <li>Core runtime configuration point for setting/using global {@link TypeConverter} / {@link OgnlExpressionCompiler}
+ * / {@link NullHandler} instances / etc..</li>
+ * </ul>
+ * 
  * @author Luke Blanshard (blanshlu@netscape.net)
  * @author Drew Davidson (drew@ognl.org)
  */
-public class OgnlRuntime {
+public class OgnlRuntime
+{
 
     /**
-     * Constant expression used to indicate that a given method / property couldn't be found
-     * during reflection operations.
+     * Constant expression used to indicate that a given method / property couldn't be found during reflection
+     * operations.
      */
     public static final Object NotFound = new Object();
+
     public static final List NotFoundList = new ArrayList();
+
     public static final Map NotFoundMap = new HashMap();
-    public static final Object[] NoArguments = new Object[]{};
-    public static final Class[] NoArgumentTypes = new Class[]{};
+
+    public static final Object[] NoArguments = new Object[] {};
+
+    public static final Class[] NoArgumentTypes = new Class[] {};
 
     /**
      * Token returned by TypeConverter for no conversion possible
@@ -92,10 +96,12 @@ public class OgnlRuntime {
      * Not an indexed property
      */
     public static int INDEXED_PROPERTY_NONE = 0;
+
     /**
      * JavaBeans IndexedProperty
      */
     public static int INDEXED_PROPERTY_INT = 1;
+
     /**
      * OGNL ObjectIndexedProperty
      */
@@ -110,10 +116,12 @@ public class OgnlRuntime {
      * Java beans standard set method prefix.
      */
     private static final String SET_PREFIX = "set";
+
     /**
      * Java beans standard get method prefix.
      */
     private static final String GET_PREFIX = "get";
+
     /**
      * Java beans standard is<Foo> boolean getter prefix.
      */
@@ -135,32 +143,51 @@ public class OgnlRuntime {
      * Used to store the result of determining if current jvm is 1.5 language compatible.
      */
     private static boolean _jdk15 = false;
+
     private static boolean _jdkChecked = false;
 
     static final ClassCache _methodAccessors = new ClassCacheImpl();
+
     static final ClassCache _propertyAccessors = new ClassCacheImpl();
+
     static final ClassCache _elementsAccessors = new ClassCacheImpl();
+
     static final ClassCache _nullHandlers = new ClassCacheImpl();
 
     static final ClassCache _propertyDescriptorCache = new ClassCacheImpl();
+
     static final ClassCache _constructorCache = new ClassCacheImpl();
+
     static final ClassCache _staticMethodCache = new ClassCacheImpl();
+
     static final ClassCache _instanceMethodCache = new ClassCacheImpl();
+
     static final ClassCache _invokePermissionCache = new ClassCacheImpl();
+
     static final ClassCache _fieldCache = new ClassCacheImpl();
+
     static final List _superclasses = new ArrayList(); /* Used by fieldCache lookup */
-    static final ClassCache[] _declaredMethods = new ClassCache[]{new ClassCacheImpl(), new ClassCacheImpl()};
 
-    static final Map _primitiveTypes = new HashMap(101);
+    static final ClassCache[] _declaredMethods = new ClassCache[] { new ClassCacheImpl(), new ClassCacheImpl() };
+
+    static final Map _primitiveTypes = new HashMap( 101 );
+
     static final ClassCache _primitiveDefaults = new ClassCacheImpl();
-    static final Map _methodParameterTypesCache = new HashMap(101);
-    static final Map _genericMethodParameterTypesCache = new HashMap(101);
-    static final Map _ctorParameterTypesCache = new HashMap(101);
+
+    static final Map _methodParameterTypesCache = new HashMap( 101 );
+
+    static final Map _genericMethodParameterTypesCache = new HashMap( 101 );
+
+    static final Map _ctorParameterTypesCache = new HashMap( 101 );
+
     static SecurityManager _securityManager = System.getSecurityManager();
+
     static final EvaluationPool _evaluationPool = new EvaluationPool();
+
     static final ObjectArrayPool _objectArrayPool = new ObjectArrayPool();
 
     static final IntHashMap _methodAccessCache = new IntHashMap();
+
     static final IntHashMap _methodPermCache = new IntHashMap();
 
     static ClassCacheInspector _cacheInspector;
@@ -173,38 +200,44 @@ public class OgnlRuntime {
     /**
      * Lazy loading of Javassist library
      */
-    static {
-        try {
-            Class.forName("javassist.ClassPool");
+    static
+    {
+        try
+        {
+            Class.forName( "javassist.ClassPool" );
             _compiler = new ExpressionCompiler();
-        } catch (ClassNotFoundException e) {
-            throw new IllegalArgumentException("Javassist library is missing in classpath! Please add missed dependency!",e);
+        }
+        catch ( ClassNotFoundException e )
+        {
+            throw new IllegalArgumentException(
+                                                "Javassist library is missing in classpath! Please add missed dependency!",
+                                                e );
         }
     }
 
     private static IdentityHashMap PRIMITIVE_WRAPPER_CLASSES = new IdentityHashMap();
 
     /**
-     * Used to provide primitive type equivalent conversions into and out of
-     * native / object types.
+     * Used to provide primitive type equivalent conversions into and out of native / object types.
      */
-    static {
-        PRIMITIVE_WRAPPER_CLASSES.put(Boolean.TYPE, Boolean.class);
-        PRIMITIVE_WRAPPER_CLASSES.put(Boolean.class, Boolean.TYPE);
-        PRIMITIVE_WRAPPER_CLASSES.put(Byte.TYPE, Byte.class);
-        PRIMITIVE_WRAPPER_CLASSES.put(Byte.class, Byte.TYPE);
-        PRIMITIVE_WRAPPER_CLASSES.put(Character.TYPE, Character.class);
-        PRIMITIVE_WRAPPER_CLASSES.put(Character.class, Character.TYPE);
-        PRIMITIVE_WRAPPER_CLASSES.put(Short.TYPE, Short.class);
-        PRIMITIVE_WRAPPER_CLASSES.put(Short.class, Short.TYPE);
-        PRIMITIVE_WRAPPER_CLASSES.put(Integer.TYPE, Integer.class);
-        PRIMITIVE_WRAPPER_CLASSES.put(Integer.class, Integer.TYPE);
-        PRIMITIVE_WRAPPER_CLASSES.put(Long.TYPE, Long.class);
-        PRIMITIVE_WRAPPER_CLASSES.put(Long.class, Long.TYPE);
-        PRIMITIVE_WRAPPER_CLASSES.put(Float.TYPE, Float.class);
-        PRIMITIVE_WRAPPER_CLASSES.put(Float.class, Float.TYPE);
-        PRIMITIVE_WRAPPER_CLASSES.put(Double.TYPE, Double.class);
-        PRIMITIVE_WRAPPER_CLASSES.put(Double.class, Double.TYPE);
+    static
+    {
+        PRIMITIVE_WRAPPER_CLASSES.put( Boolean.TYPE, Boolean.class );
+        PRIMITIVE_WRAPPER_CLASSES.put( Boolean.class, Boolean.TYPE );
+        PRIMITIVE_WRAPPER_CLASSES.put( Byte.TYPE, Byte.class );
+        PRIMITIVE_WRAPPER_CLASSES.put( Byte.class, Byte.TYPE );
+        PRIMITIVE_WRAPPER_CLASSES.put( Character.TYPE, Character.class );
+        PRIMITIVE_WRAPPER_CLASSES.put( Character.class, Character.TYPE );
+        PRIMITIVE_WRAPPER_CLASSES.put( Short.TYPE, Short.class );
+        PRIMITIVE_WRAPPER_CLASSES.put( Short.class, Short.TYPE );
+        PRIMITIVE_WRAPPER_CLASSES.put( Integer.TYPE, Integer.class );
+        PRIMITIVE_WRAPPER_CLASSES.put( Integer.class, Integer.TYPE );
+        PRIMITIVE_WRAPPER_CLASSES.put( Long.TYPE, Long.class );
+        PRIMITIVE_WRAPPER_CLASSES.put( Long.class, Long.TYPE );
+        PRIMITIVE_WRAPPER_CLASSES.put( Float.TYPE, Float.class );
+        PRIMITIVE_WRAPPER_CLASSES.put( Float.class, Float.TYPE );
+        PRIMITIVE_WRAPPER_CLASSES.put( Double.TYPE, Double.class );
+        PRIMITIVE_WRAPPER_CLASSES.put( Double.class, Double.TYPE );
     }
 
     private static final Map NUMERIC_CASTS = new HashMap();
@@ -212,32 +245,33 @@ public class OgnlRuntime {
     /**
      * Constant strings for casting different primitive types.
      */
-    static {
-        NUMERIC_CASTS.put(Double.class, "(double)");
-        NUMERIC_CASTS.put(Float.class, "(float)");
-        NUMERIC_CASTS.put(Integer.class, "(int)");
-        NUMERIC_CASTS.put(Long.class, "(long)");
-        NUMERIC_CASTS.put(BigDecimal.class, "(double)");
-        NUMERIC_CASTS.put(BigInteger.class, "");
+    static
+    {
+        NUMERIC_CASTS.put( Double.class, "(double)" );
+        NUMERIC_CASTS.put( Float.class, "(float)" );
+        NUMERIC_CASTS.put( Integer.class, "(int)" );
+        NUMERIC_CASTS.put( Long.class, "(long)" );
+        NUMERIC_CASTS.put( BigDecimal.class, "(double)" );
+        NUMERIC_CASTS.put( BigInteger.class, "" );
     }
 
     private static final Map NUMERIC_VALUES = new HashMap();
 
     /**
-     * Constant strings for getting the primitive value of different
-     * native types on the generic {@link Number} object interface. (or the less
-     * generic BigDecimal/BigInteger types)
-     */
-    static {
-        NUMERIC_VALUES.put(Double.class, "doubleValue()");
-        NUMERIC_VALUES.put(Float.class, "floatValue()");
-        NUMERIC_VALUES.put(Integer.class, "intValue()");
-        NUMERIC_VALUES.put(Long.class, "longValue()");
-        NUMERIC_VALUES.put(Short.class, "shortValue()");
-        NUMERIC_VALUES.put(Byte.class, "byteValue()");
-        NUMERIC_VALUES.put(BigDecimal.class, "doubleValue()");
-        NUMERIC_VALUES.put(BigInteger.class, "doubleValue()");
-        NUMERIC_VALUES.put(Boolean.class, "booleanValue()");
+     * Constant strings for getting the primitive value of different native types on the generic {@link Number} object
+     * interface. (or the less generic BigDecimal/BigInteger types)
+     */
+    static
+    {
+        NUMERIC_VALUES.put( Double.class, "doubleValue()" );
+        NUMERIC_VALUES.put( Float.class, "floatValue()" );
+        NUMERIC_VALUES.put( Integer.class, "intValue()" );
+        NUMERIC_VALUES.put( Long.class, "longValue()" );
+        NUMERIC_VALUES.put( Short.class, "shortValue()" );
+        NUMERIC_VALUES.put( Byte.class, "byteValue()" );
+        NUMERIC_VALUES.put( BigDecimal.class, "doubleValue()" );
+        NUMERIC_VALUES.put( BigInteger.class, "doubleValue()" );
+        NUMERIC_VALUES.put( Boolean.class, "booleanValue()" );
     }
 
     private static final Map NUMERIC_LITERALS = new HashMap();
@@ -245,128 +279,129 @@ public class OgnlRuntime {
     /**
      * Numeric primitive literal string expressions.
      */
-    static {
-        NUMERIC_LITERALS.put(Integer.class, "");
-        NUMERIC_LITERALS.put(Integer.TYPE, "");
-        NUMERIC_LITERALS.put(Long.class, "l");
-        NUMERIC_LITERALS.put(Long.TYPE, "l");
-        NUMERIC_LITERALS.put(BigInteger.class, "d");
-        NUMERIC_LITERALS.put(Float.class, "f");
-        NUMERIC_LITERALS.put(Float.TYPE, "f");
-        NUMERIC_LITERALS.put(Double.class, "d");
-        NUMERIC_LITERALS.put(Double.TYPE, "d");
-        NUMERIC_LITERALS.put(BigInteger.class, "d");
-        NUMERIC_LITERALS.put(BigDecimal.class, "d");
+    static
+    {
+        NUMERIC_LITERALS.put( Integer.class, "" );
+        NUMERIC_LITERALS.put( Integer.TYPE, "" );
+        NUMERIC_LITERALS.put( Long.class, "l" );
+        NUMERIC_LITERALS.put( Long.TYPE, "l" );
+        NUMERIC_LITERALS.put( BigInteger.class, "d" );
+        NUMERIC_LITERALS.put( Float.class, "f" );
+        NUMERIC_LITERALS.put( Float.TYPE, "f" );
+        NUMERIC_LITERALS.put( Double.class, "d" );
+        NUMERIC_LITERALS.put( Double.TYPE, "d" );
+        NUMERIC_LITERALS.put( BigInteger.class, "d" );
+        NUMERIC_LITERALS.put( BigDecimal.class, "d" );
     }
 
     private static final Map NUMERIC_DEFAULTS = new HashMap();
 
-    static {
-        NUMERIC_DEFAULTS.put(Boolean.class, Boolean.FALSE);
-        NUMERIC_DEFAULTS.put(Byte.class, new Byte((byte) 0));
-        NUMERIC_DEFAULTS.put(Short.class, new Short((short) 0));
-        NUMERIC_DEFAULTS.put(Character.class, new Character((char) 0));
-        NUMERIC_DEFAULTS.put(Integer.class, new Integer(0));
-        NUMERIC_DEFAULTS.put(Long.class, new Long(0L));
-        NUMERIC_DEFAULTS.put(Float.class, new Float(0.0f));
-        NUMERIC_DEFAULTS.put(Double.class, new Double(0.0));
+    static
+    {
+        NUMERIC_DEFAULTS.put( Boolean.class, Boolean.FALSE );
+        NUMERIC_DEFAULTS.put( Byte.class, new Byte( (byte) 0 ) );
+        NUMERIC_DEFAULTS.put( Short.class, new Short( (short) 0 ) );
+        NUMERIC_DEFAULTS.put( Character.class, new Character( (char) 0 ) );
+        NUMERIC_DEFAULTS.put( Integer.class, new Integer( 0 ) );
+        NUMERIC_DEFAULTS.put( Long.class, new Long( 0L ) );
+        NUMERIC_DEFAULTS.put( Float.class, new Float( 0.0f ) );
+        NUMERIC_DEFAULTS.put( Double.class, new Double( 0.0 ) );
 
-        NUMERIC_DEFAULTS.put(BigInteger.class, new BigInteger("0"));
-        NUMERIC_DEFAULTS.put(BigDecimal.class, new BigDecimal(0.0));
+        NUMERIC_DEFAULTS.put( BigInteger.class, new BigInteger( "0" ) );
+        NUMERIC_DEFAULTS.put( BigDecimal.class, new BigDecimal( 0.0 ) );
     }
 
-    static {
+    static
+    {
         PropertyAccessor p = new ArrayPropertyAccessor();
 
-        setPropertyAccessor(Object.class, new ObjectPropertyAccessor());
-        setPropertyAccessor(byte[].class, p);
-        setPropertyAccessor(short[].class, p);
-        setPropertyAccessor(char[].class, p);
-        setPropertyAccessor(int[].class, p);
-        setPropertyAccessor(long[].class, p);
-        setPropertyAccessor(float[].class, p);
-        setPropertyAccessor(double[].class, p);
-        setPropertyAccessor(Object[].class, p);
-        setPropertyAccessor(List.class, new ListPropertyAccessor());
-        setPropertyAccessor(Map.class, new MapPropertyAccessor());
-        setPropertyAccessor(Set.class, new SetPropertyAccessor());
-        setPropertyAccessor(Iterator.class, new IteratorPropertyAccessor());
-        setPropertyAccessor(Enumeration.class, new EnumerationPropertyAccessor());
+        setPropertyAccessor( Object.class, new ObjectPropertyAccessor() );
+        setPropertyAccessor( byte[].class, p );
+        setPropertyAccessor( short[].class, p );
+        setPropertyAccessor( char[].class, p );
+        setPropertyAccessor( int[].class, p );
+        setPropertyAccessor( long[].class, p );
+        setPropertyAccessor( float[].class, p );
+        setPropertyAccessor( double[].class, p );
+        setPropertyAccessor( Object[].class, p );
+        setPropertyAccessor( List.class, new ListPropertyAccessor() );
+        setPropertyAccessor( Map.class, new MapPropertyAccessor() );
+        setPropertyAccessor( Set.class, new SetPropertyAccessor() );
+        setPropertyAccessor( Iterator.class, new IteratorPropertyAccessor() );
+        setPropertyAccessor( Enumeration.class, new EnumerationPropertyAccessor() );
 
         ElementsAccessor e = new ArrayElementsAccessor();
 
-        setElementsAccessor(Object.class, new ObjectElementsAccessor());
-        setElementsAccessor(byte[].class, e);
-        setElementsAccessor(short[].class, e);
-        setElementsAccessor(char[].class, e);
-        setElementsAccessor(int[].class, e);
-        setElementsAccessor(long[].class, e);
-        setElementsAccessor(float[].class, e);
-        setElementsAccessor(double[].class, e);
-        setElementsAccessor(Object[].class, e);
-        setElementsAccessor(Collection.class, new CollectionElementsAccessor());
-        setElementsAccessor(Map.class, new MapElementsAccessor());
-        setElementsAccessor(Iterator.class, new IteratorElementsAccessor());
-        setElementsAccessor(Enumeration.class, new EnumerationElementsAccessor());
-        setElementsAccessor(Number.class, new NumberElementsAccessor());
+        setElementsAccessor( Object.class, new ObjectElementsAccessor() );
+        setElementsAccessor( byte[].class, e );
+        setElementsAccessor( short[].class, e );
+        setElementsAccessor( char[].class, e );
+        setElementsAccessor( int[].class, e );
+        setElementsAccessor( long[].class, e );
+        setElementsAccessor( float[].class, e );
+        setElementsAccessor( double[].class, e );
+        setElementsAccessor( Object[].class, e );
+        setElementsAccessor( Collection.class, new CollectionElementsAccessor() );
+        setElementsAccessor( Map.class, new MapElementsAccessor() );
+        setElementsAccessor( Iterator.class, new IteratorElementsAccessor() );
+        setElementsAccessor( Enumeration.class, new EnumerationElementsAccessor() );
+        setElementsAccessor( Number.class, new NumberElementsAccessor() );
 
         NullHandler nh = new ObjectNullHandler();
 
-        setNullHandler(Object.class, nh);
-        setNullHandler(byte[].class, nh);
-        setNullHandler(short[].class, nh);
-        setNullHandler(char[].class, nh);
-        setNullHandler(int[].class, nh);
-        setNullHandler(long[].class, nh);
-        setNullHandler(float[].class, nh);
-        setNullHandler(double[].class, nh);
-        setNullHandler(Object[].class, nh);
+        setNullHandler( Object.class, nh );
+        setNullHandler( byte[].class, nh );
+        setNullHandler( short[].class, nh );
+        setNullHandler( char[].class, nh );
+        setNullHandler( int[].class, nh );
+        setNullHandler( long[].class, nh );
+        setNullHandler( float[].class, nh );
+        setNullHandler( double[].class, nh );
+        setNullHandler( Object[].class, nh );
 
         MethodAccessor ma = new ObjectMethodAccessor();
 
-        setMethodAccessor(Object.class, ma);
-        setMethodAccessor(byte[].class, ma);
-        setMethodAccessor(short[].class, ma);
-        setMethodAccessor(char[].class, ma);
-        setMethodAccessor(int[].class, ma);
-        setMethodAccessor(long[].class, ma);
-        setMethodAccessor(float[].class, ma);
-        setMethodAccessor(double[].class, ma);
-        setMethodAccessor(Object[].class, ma);
-
-        _primitiveTypes.put("boolean", Boolean.TYPE);
-        _primitiveTypes.put("byte", Byte.TYPE);
-        _primitiveTypes.put("short", Short.TYPE);
-        _primitiveTypes.put("char", Character.TYPE);
-        _primitiveTypes.put("int", Integer.TYPE);
-        _primitiveTypes.put("long", Long.TYPE);
-        _primitiveTypes.put("float", Float.TYPE);
-        _primitiveTypes.put("double", Double.TYPE);
-
-        _primitiveDefaults.put(Boolean.TYPE, Boolean.FALSE);
-        _primitiveDefaults.put(Boolean.class, Boolean.FALSE);
-        _primitiveDefaults.put(Byte.TYPE, new Byte((byte) 0));
-        _primitiveDefaults.put(Byte.class, new Byte((byte) 0));
-        _primitiveDefaults.put(Short.TYPE, new Short((short) 0));
-        _primitiveDefaults.put(Short.class, new Short((short) 0));
-        _primitiveDefaults.put(Character.TYPE, new Character((char) 0));
-        _primitiveDefaults.put(Integer.TYPE, new Integer(0));
-        _primitiveDefaults.put(Long.TYPE, new Long(0L));
-        _primitiveDefaults.put(Float.TYPE, new Float(0.0f));
-        _primitiveDefaults.put(Double.TYPE, new Double(0.0));
-
-        _primitiveDefaults.put(BigInteger.class, new BigInteger("0"));
-        _primitiveDefaults.put(BigDecimal.class, new BigDecimal(0.0));
+        setMethodAccessor( Object.class, ma );
+        setMethodAccessor( byte[].class, ma );
+        setMethodAccessor( short[].class, ma );
+        setMethodAccessor( char[].class, ma );
+        setMethodAccessor( int[].class, ma );
+        setMethodAccessor( long[].class, ma );
+        setMethodAccessor( float[].class, ma );
+        setMethodAccessor( double[].class, ma );
+        setMethodAccessor( Object[].class, ma );
+
+        _primitiveTypes.put( "boolean", Boolean.TYPE );
+        _primitiveTypes.put( "byte", Byte.TYPE );
+        _primitiveTypes.put( "short", Short.TYPE );
+        _primitiveTypes.put( "char", Character.TYPE );
+        _primitiveTypes.put( "int", Integer.TYPE );
+        _primitiveTypes.put( "long", Long.TYPE );
+        _primitiveTypes.put( "float", Float.TYPE );
+        _primitiveTypes.put( "double", Double.TYPE );
+
+        _primitiveDefaults.put( Boolean.TYPE, Boolean.FALSE );
+        _primitiveDefaults.put( Boolean.class, Boolean.FALSE );
+        _primitiveDefaults.put( Byte.TYPE, new Byte( (byte) 0 ) );
+        _primitiveDefaults.put( Byte.class, new Byte( (byte) 0 ) );
+        _primitiveDefaults.put( Short.TYPE, new Short( (short) 0 ) );
+        _primitiveDefaults.put( Short.class, new Short( (short) 0 ) );
+        _primitiveDefaults.put( Character.TYPE, new Character( (char) 0 ) );
+        _primitiveDefaults.put( Integer.TYPE, new Integer( 0 ) );
+        _primitiveDefaults.put( Long.TYPE, new Long( 0L ) );
+        _primitiveDefaults.put( Float.TYPE, new Float( 0.0f ) );
+        _primitiveDefaults.put( Double.TYPE, new Double( 0.0 ) );
+
+        _primitiveDefaults.put( BigInteger.class, new BigInteger( "0" ) );
+        _primitiveDefaults.put( BigDecimal.class, new BigDecimal( 0.0 ) );
     }
 
     /**
-     * Clears all of the cached reflection information normally used
-     * to improve the speed of expressions that operate on the same classes
-     * or are executed multiple times.
-     *
+     * Clears all of the cached reflection information normally used to improve the speed of expressions that operate on
+     * the same classes or are executed multiple times.
      * <p>
-     * <strong>Warning:</strong> Calling this too often can be a huge performance
-     * drain on your expressions - use with care.
+     * <strong>Warning:</strong> Calling this too often can be a huge performance drain on your expressions - use with
+     * care.
      * </p>
      */
     public static void clearCache()
@@ -387,46 +422,49 @@ public class OgnlRuntime {
 
     /**
      * Checks if the current jvm is java language >= 1.5 compatible.
-     *
+     * 
      * @return True if jdk15 features are present.
      */
     public static boolean isJdk15()
     {
-        if (_jdkChecked)
+        if ( _jdkChecked )
             return _jdk15;
 
         try
         {
-            Class.forName("java.lang.annotation.Annotation");
+            Class.forName( "java.lang.annotation.Annotation" );
             _jdk15 = true;
-        } catch (Exception e) { /* ignore */ }
+        }
+        catch ( Exception e )
+        { /* ignore */
+        }
 
         _jdkChecked = true;
 
         return _jdk15;
     }
 
-    public static String getNumericValueGetter(Class type)
+    public static String getNumericValueGetter( Class type )
     {
-        return (String) NUMERIC_VALUES.get(type);
+        return (String) NUMERIC_VALUES.get( type );
     }
 
-    public static Class getPrimitiveWrapperClass(Class primitiveClass)
+    public static Class getPrimitiveWrapperClass( Class primitiveClass )
     {
-        return (Class) PRIMITIVE_WRAPPER_CLASSES.get(primitiveClass);
+        return (Class) PRIMITIVE_WRAPPER_CLASSES.get( primitiveClass );
     }
 
-    public static String getNumericCast(Class type)
+    public static String getNumericCast( Class type )
     {
-        return (String) NUMERIC_CASTS.get(type);
+        return (String) NUMERIC_CASTS.get( type );
     }
 
-    public static String getNumericLiteral(Class type)
+    public static String getNumericLiteral( Class type )
     {
-        return (String) NUMERIC_LITERALS.get(type);
+        return (String) NUMERIC_LITERALS.get( type );
     }
 
-    public static void setCompiler(OgnlExpressionCompiler compiler)
+    public static void setCompiler( OgnlExpressionCompiler compiler )
     {
         _compiler = compiler;
     }
@@ -436,159 +474,165 @@ public class OgnlRuntime {
         return _compiler;
     }
 
-    public static void compileExpression(OgnlContext context, Node expression, Object root)
-            throws Exception
+    public static void compileExpression( OgnlContext context, Node expression, Object root )
+        throws Exception
     {
-        _compiler.compileExpression(context, expression, root);
+        _compiler.compileExpression( context, expression, root );
     }
 
     /**
-     * Gets the "target" class of an object for looking up accessors that are registered on the
-     * target. If the object is a Class object this will return the Class itself, else it will
-     * return object's getClass() result.
+     * Gets the "target" class of an object for looking up accessors that are registered on the target. If the object is
+     * a Class object this will return the Class itself, else it will return object's getClass() result.
      */
-    public static Class getTargetClass(Object o)
+    public static Class getTargetClass( Object o )
     {
-        return (o == null) ? null : ((o instanceof Class) ? (Class) o : o.getClass());
+        return ( o == null ) ? null : ( ( o instanceof Class ) ? (Class) o : o.getClass() );
     }
 
     /**
-     * Returns the base name (the class name without the package name prepended) of the object
-     * given.
+     * Returns the base name (the class name without the package name prepended) of the object given.
      */
-    public static String getBaseName(Object o)
+    public static String getBaseName( Object o )
     {
-        return (o == null) ? null : getClassBaseName(o.getClass());
+        return ( o == null ) ? null : getClassBaseName( o.getClass() );
     }
 
     /**
      * Returns the base name (the class name without the package name prepended) of the class given.
      */
-    public static String getClassBaseName(Class c)
+    public static String getClassBaseName( Class c )
     {
         String s = c.getName();
 
-        return s.substring(s.lastIndexOf('.') + 1);
+        return s.substring( s.lastIndexOf( '.' ) + 1 );
     }
 
-    public static String getClassName(Object o, boolean fullyQualified)
+    public static String getClassName( Object o, boolean fullyQualified )
     {
-        if (!(o instanceof Class))
+        if ( !( o instanceof Class ) )
         {
             o = o.getClass();
         }
 
-        return getClassName((Class) o, fullyQualified);
+        return getClassName( (Class) o, fullyQualified );
     }
 
-    public static String getClassName(Class c, boolean fullyQualified)
+    public static String getClassName( Class c, boolean fullyQualified )
     {
-        return fullyQualified ? c.getName() : getClassBaseName(c);
+        return fullyQualified ? c.getName() : getClassBaseName( c );
     }
 
     /**
      * Returns the package name of the object's class.
      */
-    public static String getPackageName(Object o)
+    public static String getPackageName( Object o )
     {
-        return (o == null) ? null : getClassPackageName(o.getClass());
+        return ( o == null ) ? null : getClassPackageName( o.getClass() );
     }
 
     /**
      * Returns the package name of the class given.
      */
-    public static String getClassPackageName(Class c)
+    public static String getClassPackageName( Class c )
     {
         String s = c.getName();
-        int i = s.lastIndexOf('.');
+        int i = s.lastIndexOf( '.' );
 
-        return (i < 0) ? null : s.substring(0, i);
+        return ( i < 0 ) ? null : s.substring( 0, i );
     }
 
     /**
      * Returns a "pointer" string in the usual format for these things - 0x<hex digits>.
      */
-    public static String getPointerString(int num)
+    public static String getPointerString( int num )
     {
         StringBuffer result = new StringBuffer();
-        String hex = Integer.toHexString(num), pad;
-        Integer l = new Integer(hex.length());
+        String hex = Integer.toHexString( num ), pad;
+        Integer l = new Integer( hex.length() );
 
         // result.append(HEX_PREFIX);
-        if ((pad = (String) HEX_PADDING.get(l)) == null) {
+        if ( ( pad = (String) HEX_PADDING.get( l ) ) == null )
+        {
             StringBuffer pb = new StringBuffer();
 
-            for (int i = hex.length(); i < HEX_LENGTH; i++) {
-                pb.append('0');
+            for ( int i = hex.length(); i < HEX_LENGTH; i++ )
+            {
+                pb.append( '0' );
             }
-            pad = new String(pb);
-            HEX_PADDING.put(l, pad);
+            pad = new String( pb );
+            HEX_PADDING.put( l, pad );
         }
-        result.append(pad);
-        result.append(hex);
-        return new String(result);
+        result.append( pad );
+        result.append( hex );
+        return new String( result );
     }
 
     /**
-     * Returns a "pointer" string in the usual format for these things - 0x<hex digits> for the
-     * object given. This will always return a unique value for each object.
+     * Returns a "pointer" string in the usual format for these things - 0x<hex digits> for the object given. This will
+     * always return a unique value for each object.
      */
-    public static String getPointerString(Object o)
+    public static String getPointerString( Object o )
     {
-        return getPointerString((o == null) ? 0 : System.identityHashCode(o));
+        return getPointerString( ( o == null ) ? 0 : System.identityHashCode( o ) );
     }
 
     /**
-     * Returns a unique descriptor string that includes the object's class and a unique integer
-     * identifier. If fullyQualified is true then the class name will be fully qualified to include
-     * the package name, else it will be just the class' base name.
+     * Returns a unique descriptor string that includes the object's class and a unique integer identifier. If
+     * fullyQualified is true then the class name will be fully qualified to include the package name, else it will be
+     * just the class' base name.
      */
-    public static String getUniqueDescriptor(Object object, boolean fullyQualified)
+    public static String getUniqueDescriptor( Object object, boolean fullyQualified )
     {
         StringBuffer result = new StringBuffer();
 
-        if (object != null) {
-            if (object instanceof Proxy) {
+        if ( object != null )
+        {
+            if ( object instanceof Proxy )
+            {
                 Class interfaceClass = object.getClass().getInterfaces()[0];
 
-                result.append(getClassName(interfaceClass, fullyQualified));
-                result.append('^');
-                object = Proxy.getInvocationHandler(object);
-            }
-            result.append(getClassName(object, fullyQualified));
-            result.append('@');
-            result.append(getPointerString(object));
-        } else {
-            result.append(NULL_OBJECT_STRING);
+                result.append( getClassName( interfaceClass, fullyQualified ) );
+                result.append( '^' );
+                object = Proxy.getInvocationHandler( object );
+            }
+            result.append( getClassName( object, fullyQualified ) );
+            result.append( '@' );
+            result.append( getPointerString( object ) );
         }
-        return new String(result);
+        else
+        {
+            result.append( NULL_OBJECT_STRING );
+        }
+        return new String( result );
     }
 
     /**
-     * Returns a unique descriptor string that includes the object's class' base name and a unique
-     * integer identifier.
+     * Returns a unique descriptor string that includes the object's class' base name and a unique integer identifier.
      */
-    public static String getUniqueDescriptor(Object object)
+    public static String getUniqueDescriptor( Object object )
     {
-        return getUniqueDescriptor(object, false);
+        return getUniqueDescriptor( object, false );
     }
 
     /**
-     * Utility to convert a List into an Object[] array. If the list is zero elements this will
-     * return a constant array; toArray() on List always returns a new object and this is wasteful
-     * for our purposes.
+     * Utility to convert a List into an Object[] array. If the list is zero elements this will return a constant array;
+     * toArray() on List always returns a new object and this is wasteful for our purposes.
      */
-    public static Object[] toArray(List list)
+    public static Object[] toArray( List list )
     {
         Object[] result;
         int size = list.size();
 
-        if (size == 0) {
+        if ( size == 0 )
+        {
             result = NoArguments;
-        } else {
-            result = getObjectArrayPool().create(list.size());
-            for (int i = 0; i < size; i++) {
-                result[i] = list.get(i);
+        }
+        else
+        {
+            result = getObjectArrayPool().create( list.size() );
+            for ( int i = 0; i < size; i++ )
+            {
+                result[i] = list.get( i );
             }
         }
         return result;
@@ -597,91 +641,91 @@ public class OgnlRuntime {
     /**
      * Returns the parameter types of the given method.
      */
-    public static Class[] getParameterTypes(Method m)
+    public static Class[] getParameterTypes( Method m )
     {
-        synchronized (_methodParameterTypesCache)
+        synchronized ( _methodParameterTypesCache )
         {
             Class[] result;
 
-            if ((result = (Class[]) _methodParameterTypesCache.get(m)) == null)
+            if ( ( result = (Class[]) _methodParameterTypesCache.get( m ) ) == null )
             {
-                _methodParameterTypesCache.put(m, result = m.getParameterTypes());
+                _methodParameterTypesCache.put( m, result = m.getParameterTypes() );
             }
             return result;
         }
     }
 
     /**
-     * Finds the appropriate parameter types for the given {@link Method} and
-     * {@link Class} instance of the type the method is associated with.  Correctly
-     * finds generic types if running in >= 1.5 jre as well.
-     *
+     * Finds the appropriate parameter types for the given {@link Method} and {@link Class} instance of the type the
+     * method is associated with. Correctly finds generic types if running in >= 1.5 jre as well.
+     * 
      * @param type The class type the method is being executed against.
      * @param m The method to find types for.
      * @return Array of parameter types for the given method.
      */
-    public static Class[] findParameterTypes(Class type, Method m)
+    public static Class[] findParameterTypes( Class type, Method m )
     {
-        if (type == null)
+        if ( type == null )
         {
-            return getParameterTypes(m);
+            return getParameterTypes( m );
         }
 
-        if (!isJdk15()
-            || type.getGenericSuperclass() == null
-            || !ParameterizedType.class.isInstance(type.getGenericSuperclass())
-            || m.getDeclaringClass().getTypeParameters() == null)
+        if ( !isJdk15() || type.getGenericSuperclass() == null
+            || !ParameterizedType.class.isInstance( type.getGenericSuperclass() )
+            || m.getDeclaringClass().getTypeParameters() == null )
         {
-            return getParameterTypes(m);
+            return getParameterTypes( m );
         }
 
-        synchronized (_genericMethodParameterTypesCache)
+        synchronized ( _genericMethodParameterTypesCache )
         {
             Class[] types;
 
-            if ((types = (Class[]) _genericMethodParameterTypesCache.get(m)) != null)
+            if ( ( types = (Class[]) _genericMethodParameterTypesCache.get( m ) ) != null )
             {
                 ParameterizedType genericSuperclass = (ParameterizedType) type.getGenericSuperclass();
-                if (Arrays.equals(types, genericSuperclass.getActualTypeArguments())) {
+                if ( Arrays.equals( types, genericSuperclass.getActualTypeArguments() ) )
+                {
                     return types;
                 }
             }
 
-            ParameterizedType param = (ParameterizedType)type.getGenericSuperclass();
+            ParameterizedType param = (ParameterizedType) type.getGenericSuperclass();
             Type[] genTypes = m.getGenericParameterTypes();
             TypeVariable[] declaredTypes = m.getDeclaringClass().getTypeParameters();
 
             types = new Class[genTypes.length];
 
-            typeSearch:
-            for (int i=0; i < genTypes.length; i++)
+            typeSearch: for ( int i = 0; i < genTypes.length; i++ )
             {
                 TypeVariable paramType = null;
 
-                if (TypeVariable.class.isInstance(genTypes[i]))
+                if ( TypeVariable.class.isInstance( genTypes[i] ) )
                 {
-                    paramType = (TypeVariable)genTypes[i];
-                } else if (GenericArrayType.class.isInstance(genTypes[i]))
+                    paramType = (TypeVariable) genTypes[i];
+                }
+                else if ( GenericArrayType.class.isInstance( genTypes[i] ) )
                 {
-                    paramType = (TypeVariable) ((GenericArrayType)genTypes[i]).getGenericComponentType();
+                    paramType = (TypeVariable) ( (GenericArrayType) genTypes[i] ).getGenericComponentType();
                 }
-                else if (ParameterizedType.class.isInstance(genTypes[i]))
+                else if ( ParameterizedType.class.isInstance( genTypes[i] ) )
                 {
-                	 types[i] = (Class) ((ParameterizedType) genTypes[i]).getRawType();
-                	 continue;
-                } else if (Class.class.isInstance(genTypes[i]))
+                    types[i] = (Class) ( (ParameterizedType) genTypes[i] ).getRawType();
+                    continue;
+                }
+                else if ( Class.class.isInstance( genTypes[i] ) )
                 {
                     types[i] = (Class) genTypes[i];
                     continue;
                 }
 
-                Class resolved = resolveType(param, paramType, declaredTypes);
+                Class resolved = resolveType( param, paramType, declaredTypes );
 
-                if (resolved != null)
+                if ( resolved != null )
                 {
-                    if (GenericArrayType.class.isInstance(genTypes[i]))
+                    if ( GenericArrayType.class.isInstance( genTypes[i] ) )
                     {
-                        resolved = Array.newInstance(resolved, 0).getClass();
+                        resolved = Array.newInstance( resolved, 0 ).getClass();
                     }
 
                     types[i] = resolved;
@@ -691,61 +735,44 @@ public class OgnlRuntime {
                 types[i] = m.getParameterTypes()[i];
             }
 
-            _genericMethodParameterTypesCache.put(m, types);
+            _genericMethodParameterTypesCache.put( m, types );
 
             return types;
         }
     }
 
-    static Class resolveType(ParameterizedType param, TypeVariable var, TypeVariable[] declaredTypes)
+    static Class resolveType( ParameterizedType param, TypeVariable var, TypeVariable[] declaredTypes )
     {
-        if (param.getActualTypeArguments().length < 1)
+        if ( param.getActualTypeArguments().length < 1 )
             return null;
 
-        for (int i=0; i < declaredTypes.length; i++)
+        for ( int i = 0; i < declaredTypes.length; i++ )
         {
-            if (!TypeVariable.class.isInstance( param.getActualTypeArguments()[i])
-                && declaredTypes[i].getName().equals(var.getName()))
+            if ( !TypeVariable.class.isInstance( param.getActualTypeArguments()[i] )
+                && declaredTypes[i].getName().equals( var.getName() ) )
             {
                 return (Class) param.getActualTypeArguments()[i];
             }
         }
 
         /*
-        for (int i=0; i < var.getBounds().length; i++)
-        {
-            Type t = var.getBounds()[i];
-            Class resolvedType = null;
-
-            if (ParameterizedType.class.isInstance(t))
-            {
-                ParameterizedType pparam = (ParameterizedType)t;
-                for (int e=0; e < pparam.getActualTypeArguments().length; e++)
-                {
-                    if (!TypeVariable.class.isInstance(pparam.getActualTypeArguments()[e]))
-                        continue;
-
-                    resolvedType = resolveType(pparam, (TypeVariable)pparam.getActualTypeArguments()[e], declaredTypes);
-                }
-            } else
-            {
-                resolvedType = findType(param.getActualTypeArguments(), (Class)t);
-            }
-
-            if (resolvedType != null)
-                return resolvedType;
-        }
-        */
+         * for (int i=0; i < var.getBounds().length; i++) { Type t = var.getBounds()[i]; Class resolvedType = null; if
+         * (ParameterizedType.class.isInstance(t)) { ParameterizedType pparam = (ParameterizedType)t; for (int e=0; e <
+         * pparam.getActualTypeArguments().length; e++) { if
+         * (!TypeVariable.class.isInstance(pparam.getActualTypeArguments()[e])) continue; resolvedType =
+         * resolveType(pparam, (TypeVariable)pparam.getActualTypeArguments()[e], declaredTypes); } } else { resolvedType
+         * = findType(param.getActualTypeArguments(), (Class)t); } if (resolvedType != null) return resolvedType; }
+         */
 
         return null;
     }
 
-    static Class findType(Type[] types, Class type)
+    static Class findType( Type[] types, Class type )
     {
-        for (int i = 0; i < types.length; i++)
+        for ( int i = 0; i < types.length; i++ )
         {
-            if (Class.class.isInstance(types[i]) && type.isAssignableFrom((Class)types[i]))
-                return (Class)types[i];
+            if ( Class.class.isInstance( types[i] ) && type.isAssignableFrom( (Class) types[i] ) )
+                return (Class) types[i];
         }
 
         return null;
@@ -754,13 +781,15 @@ public class OgnlRuntime {
     /**
      * Returns the parameter types of the given method.
      */
-    public static Class[] getParameterTypes(Constructor c)
+    public static Class[] getParameterTypes( Constructor c )
     {
-        synchronized (_ctorParameterTypesCache) {
+        synchronized ( _ctorParameterTypesCache )
+        {
             Class[] result;
 
-            if ((result = (Class[]) _ctorParameterTypesCache.get(c)) == null) {
-                _ctorParameterTypesCache.put(c, result = c.getParameterTypes());
+            if ( ( result = (Class[]) _ctorParameterTypesCache.get( c ) ) == null )
+            {
+                _ctorParameterTypesCache.put( c, result = c.getParameterTypes() );
             }
             return result;
         }
@@ -768,7 +797,7 @@ public class OgnlRuntime {
 
     /**
      * Gets the SecurityManager that OGNL uses to determine permissions for invoking methods.
-     *
+     * 
      * @return SecurityManager for OGNL
      */
     public static SecurityManager getSecurityManager()
@@ -778,10 +807,10 @@ public class OgnlRuntime {
 
     /**
      * Sets the SecurityManager that OGNL uses to determine permissions for invoking methods.
-     *
+     * 
      * @param value SecurityManager to set
      */
-    public static void setSecurityManager(SecurityManager value)
+    public static void setSecurityManager( SecurityManager value )
     {
         _securityManager = value;
     }
@@ -789,27 +818,30 @@ public class OgnlRuntime {
     /**
      * Permission will be named "invoke.<declaring-class>.<method-name>".
      */
-    public static Permission getPermission(Method method)
+    public static Permission getPermission( Method method )
     {
         Permission result = null;
         Class mc = method.getDeclaringClass();
 
-        synchronized (_invokePermissionCache) {
-            Map permissions = (Map) _invokePermissionCache.get(mc);
+        synchronized ( _invokePermissionCache )
+        {
+            Map permissions = (Map) _invokePermissionCache.get( mc );
 
-            if (permissions == null) {
-                _invokePermissionCache.put(mc, permissions = new HashMap(101));
+            if ( permissions == null )
+            {
+                _invokePermissionCache.put( mc, permissions = new HashMap( 101 ) );
             }
-            if ((result = (Permission) permissions.get(method.getName())) == null) {
-                result = new OgnlInvokePermission("invoke." + mc.getName() + "." + method.getName());
-                permissions.put(method.getName(), result);
+            if ( ( result = (Permission) permissions.get( method.getName() ) ) == null )
+            {
+                result = new OgnlInvokePermission( "invoke." + mc.getName() + "." + method.getName() );
+                permissions.put( method.getName(), result );
             }
         }
         return result;
     }
 
-    public static Object invokeMethod(Object target, Method method, Object[] argsArray)
-            throws InvocationTargetException, IllegalAccessException
+    public static Object invokeMethod( Object target, Method method, Object[] argsArray )
+        throws InvocationTargetException, IllegalAccessException
     {
         boolean syncInvoke = false;
         boolean checkPermission = false;
@@ -817,14 +849,16 @@ public class OgnlRuntime {
 
         // only synchronize method invocation if it actually requires it
 
-        synchronized(method) {
-            if (_methodAccessCache.get(mHash) == null
-                || _methodAccessCache.get(mHash) == Boolean.TRUE) {
+        synchronized ( method )
+        {
+            if ( _methodAccessCache.get( mHash ) == null || _methodAccessCache.get( mHash ) == Boolean.TRUE )
+            {
                 syncInvoke = true;
             }
 
-            if (_securityManager != null && _methodPermCache.get(mHash) == null
-                || _methodPermCache.get(mHash) == Boolean.FALSE) {
+            if ( _securityManager != null && _methodPermCache.get( mHash ) == null
+                || _methodPermCache.get( mHash ) == Boolean.FALSE )
+            {
                 checkPermission = true;
             }
         }
@@ -832,113 +866,127 @@ public class OgnlRuntime {
         Object result;
         boolean wasAccessible = true;
 
-        if (syncInvoke)
+        if ( syncInvoke )
         {
-            synchronized(method)
+            synchronized ( method )
             {
-                if (checkPermission)
+                if ( checkPermission )
                 {
                     try
                     {
-                        _securityManager.checkPermission(getPermission(method));
-                        _methodPermCache.put(mHash, Boolean.TRUE);
-                    } catch (SecurityException ex) {
-                        _methodPermCache.put(mHash, Boolean.FALSE);
-                        throw new IllegalAccessException("Method [" + method + "] cannot be accessed.");
+                        _securityManager.checkPermission( getPermission( method ) );
+                        _methodPermCache.put( mHash, Boolean.TRUE );
+                    }
+                    catch ( SecurityException ex )
+                    {
+                        _methodPermCache.put( mHash, Boolean.FALSE );
+                        throw new IllegalAccessException( "Method [" + method + "] cannot be accessed." );
                     }
                 }
 
-                if (!Modifier.isPublic(method.getModifiers()) || !Modifier.isPublic(method.getDeclaringClass().getModifiers()))
+                if ( !Modifier.isPublic( method.getModifiers() )
+                    || !Modifier.isPublic( method.getDeclaringClass().getModifiers() ) )
                 {
-                    if (!(wasAccessible = ((AccessibleObject) method).isAccessible()))
+                    if ( !( wasAccessible = ( (AccessibleObject) method ).isAccessible() ) )
                     {
-                        ((AccessibleObject) method).setAccessible(true);
-                        _methodAccessCache.put(mHash, Boolean.TRUE);
-                    } else
+                        ( (AccessibleObject) method ).setAccessible( true );
+                        _methodAccessCache.put( mHash, Boolean.TRUE );
+                    }
+                    else
                     {
-                        _methodAccessCache.put(mHash, Boolean.FALSE);
+                        _methodAccessCache.put( mHash, Boolean.FALSE );
                     }
-                } else
+                }
+                else
                 {
-                    _methodAccessCache.put(mHash, Boolean.FALSE);
+                    _methodAccessCache.put( mHash, Boolean.FALSE );
                 }
 
-                result = method.invoke(target, argsArray);
+                result = method.invoke( target, argsArray );
 
-                if (!wasAccessible)
+                if ( !wasAccessible )
                 {
-                    ((AccessibleObject) method).setAccessible(false);
+                    ( (AccessibleObject) method ).setAccessible( false );
                 }
             }
-        } else
+        }
+        else
         {
-            if (checkPermission)
+            if ( checkPermission )
             {
                 try
                 {
-                    _securityManager.checkPermission(getPermission(method));
-                    _methodPermCache.put(mHash, Boolean.TRUE);
-                } catch (SecurityException ex) {
-                    _methodPermCache.put(mHash, Boolean.FALSE);
-                    throw new IllegalAccessException("Method [" + method + "] cannot be accessed.");
+                    _securityManager.checkPermission( getPermission( method ) );
+                    _methodPermCache.put( mHash, Boolean.TRUE );
+                }
+                catch ( SecurityException ex )
+                {
+                    _methodPermCache.put( mHash, Boolean.FALSE );
+                    throw new IllegalAccessException( "Method [" + method + "] cannot be accessed." );
                 }
             }
 
-            result = method.invoke(target, argsArray);
+            result = method.invoke( target, argsArray );
         }
 
         return result;
     }
 
     /**
-     * Gets the class for a method argument that is appropriate for looking up methods by
-     * reflection, by looking for the standard primitive wrapper classes and exchanging for them
-     * their underlying primitive class objects. Other classes are passed through unchanged.
-     *
+     * Gets the class for a method argument that is appropriate for looking up methods by reflection, by looking for the
+     * standard primitive wrapper classes and exchanging for them their underlying primitive class objects. Other
+     * classes are passed through unchanged.
+     * 
      * @param arg an object that is being passed to a method
      * @return the class to use to look up the method
      */
-    public static final Class getArgClass(Object arg)
+    public static final Class getArgClass( Object arg )
     {
-        if (arg == null)
+        if ( arg == null )
             return null;
         Class c = arg.getClass();
-        if (c == Boolean.class)
+        if ( c == Boolean.class )
             return Boolean.TYPE;
-        else if (c.getSuperclass() == Number.class) {
-            if (c == Integer.class)
+        else if ( c.getSuperclass() == Number.class )
+        {
+            if ( c == Integer.class )
                 return Integer.TYPE;
-            if (c == Double.class)
+            if ( c == Double.class )
                 return Double.TYPE;
-            if (c == Byte.class)
+            if ( c == Byte.class )
                 return Byte.TYPE;
-            if (c == Long.class)
+            if ( c == Long.class )
                 return Long.TYPE;
-            if (c == Float.class)
+            if ( c == Float.class )
                 return Float.TYPE;
-            if (c == Short.class)
+            if ( c == Short.class )
                 return Short.TYPE;
-        } else if (c == Character.class)
+        }
+        else if ( c == Character.class )
             return Character.TYPE;
         return c;
     }
 
     /**
-     * Tells whether the given object is compatible with the given class ---that is, whether the
-     * given object can be passed as an argument to a method or constructor whose parameter type is
-     * the given class. If object is null this will return true because null is compatible with any
-     * type.
+     * Tells whether the given object is compatible with the given class ---that is, whether the given object can be
+     * passed as an argument to a method or constructor whose parameter type is the given class. If object is null this
+     * will return true because null is compatible with any type.
      */
-    public static final boolean isTypeCompatible(Object object, Class c)
+    public static final boolean isTypeCompatible( Object object, Class c )
     {
         boolean result = true;
 
-        if (object != null) {
-            if (c.isPrimitive()) {
-                if (getArgClass(object) != c) {
+        if ( object != null )
+        {
+            if ( c.isPrimitive() )
+            {
+                if ( getArgClass( object ) != c )
+                {
                     result = false;
                 }
-            } else if (!c.isInstance(object)) {
+            }
+            else if ( !c.isInstance( object ) )
+            {
                 result = false;
             }
         }
@@ -946,57 +994,67 @@ public class OgnlRuntime {
     }
 
     /**
-     * Tells whether the given array of objects is compatible with the given array of classes---that
-     * is, whether the given array of objects can be passed as arguments to a method or constructor
-     * whose parameter types are the given array of classes.
+     * Tells whether the given array of objects is compatible with the given array of classes---that is, whether the
+     * given array of objects can be passed as arguments to a method or constructor whose parameter types are the given
+     * array of classes.
      */
-    public static boolean areArgsCompatible(Object[] args, Class[] classes)
+    public static boolean areArgsCompatible( Object[] args, Class[] classes )
     {
-        return areArgsCompatible(args, classes, null);
+        return areArgsCompatible( args, classes, null );
     }
 
-    public static boolean areArgsCompatible(Object[] args, Class[] classes, Method m)
+    public static boolean areArgsCompatible( Object[] args, Class[] classes, Method m )
     {
         boolean result = true;
         boolean varArgs = m != null && isJdk15() && m.isVarArgs();
 
-        if (args.length != classes.length && !varArgs) {
+        if ( args.length != classes.length && !varArgs )
+        {
             result = false;
-        } else if (varArgs) {
-            for (int index = 0, count = args.length; result && (index < count); ++index) {
-                if (index >= classes.length){
+        }
+        else if ( varArgs )
+        {
+            for ( int index = 0, count = args.length; result && ( index < count ); ++index )
+            {
+                if ( index >= classes.length )
+                {
                     break;
                 }
 
-                result = isTypeCompatible(args[index], classes[index]);
+                result = isTypeCompatible( args[index], classes[index] );
 
-                if (!result && classes[index].isArray()) {
-                    result = isTypeCompatible(args[index], classes[index].getComponentType());
+                if ( !result && classes[index].isArray() )
+                {
+                    result = isTypeCompatible( args[index], classes[index].getComponentType() );
                 }
             }
-        } else {
-            for (int index = 0, count = args.length; result && (index < count); ++index) {
-                result = isTypeCompatible(args[index], classes[index]);
+        }
+        else
+        {
+            for ( int index = 0, count = args.length; result && ( index < count ); ++index )
+            {
+                result = isTypeCompatible( args[index], classes[index] );
             }
         }
         return result;
     }
 
     /**
-     * Tells whether the first array of classes is more specific than the second. Assumes that the
-     * two arrays are of the same length.
+     * Tells whether the first array of classes is more specific than the second. Assumes that the two arrays are of the
+     * same length.
      */
-    public static final boolean isMoreSpecific(Class[] classes1, Class[] classes2)
+    public static final boolean isMoreSpecific( Class[] classes1, Class[] classes2 )
     {
-        for (int index = 0, count = classes1.length; index < count; ++index) {
+        for ( int index = 0, count = classes1.length; index < count; ++index )
+        {
             Class c1 = classes1[index], c2 = classes2[index];
-            if (c1 == c2)
+            if ( c1 == c2 )
                 continue;
-            else if (c1.isPrimitive())
+            else if ( c1.isPrimitive() )
                 return true;
-            else if (c1.isAssignableFrom(c2))
+            else if ( c1.isAssignableFrom( c2 ) )
                 return false;
-            else if (c2.isAssignableFrom(c1))
+            else if ( c2.isAssignableFrom( c1 ) )
                 return true;
         }
 
@@ -1004,97 +1062,110 @@ public class OgnlRuntime {
         return false;
     }
 
-    public static String getModifierString(int modifiers)
+    public static String getModifierString( int modifiers )
     {
         String result;
 
-        if (Modifier.isPublic(modifiers))
+        if ( Modifier.isPublic( modifiers ) )
             result = "public";
-        else if (Modifier.isProtected(modifiers))
+        else if ( Modifier.isProtected( modifiers ) )
             result = "protected";
-        else if (Modifier.isPrivate(modifiers))
+        else if ( Modifier.isPrivate( modifiers ) )
             result = "private";
         else
             result = "";
-        if (Modifier.isStatic(modifiers))
+        if ( Modifier.isStatic( modifiers ) )
             result = "static " + result;
-        if (Modifier.isFinal(modifiers))
+        if ( Modifier.isFinal( modifiers ) )
             result = "final " + result;
-        if (Modifier.isNative(modifiers))
+        if ( Modifier.isNative( modifiers ) )
             result = "native " + result;
-        if (Modifier.isSynchronized(modifiers))
+        if ( Modifier.isSynchronized( modifiers ) )
             result = "synchronized " + result;
-        if (Modifier.isTransient(modifiers))
+        if ( Modifier.isTransient( modifiers ) )
             result = "transient " + result;
         return result;
     }
 
-    public static Class classForName(OgnlContext context, String className)
-            throws ClassNotFoundException
+    public static Class classForName( OgnlContext context, String className )
+        throws ClassNotFoundException
     {
-        Class result = (Class) _primitiveTypes.get(className);
+        Class result = (Class) _primitiveTypes.get( className );
 
-        if (result == null) {
+        if ( result == null )
+        {
             ClassResolver resolver;
 
-            if ((context == null) || ((resolver = context.getClassResolver()) == null)) {
+            if ( ( context == null ) || ( ( resolver = context.getClassResolver() ) == null ) )
+            {
                 resolver = OgnlContext.DEFAULT_CLASS_RESOLVER;
             }
-            result = resolver.classForName(className, context);
+            result = resolver.classForName( className, context );
         }
 
-        if (result == null)
-            throw new ClassNotFoundException("Unable to resolve class: " + className);
+        if ( result == null )
+            throw new ClassNotFoundException( "Unable to resolve class: " + className );
 
         return result;
     }
 
-    public static boolean isInstance(OgnlContext context, Object value, String className)
-            throws OgnlException
+    public static boolean isInstance( OgnlContext context, Object value, String className )
+        throws OgnlException
     {
-        try {
-            Class c = classForName(context, className);
-            return c.isInstance(value);
-        } catch (ClassNotFoundException e) {
-            throw new OgnlException("No such class: " + className, e);
+        try
+        {
+            Class c = classForName( context, className );
+            return c.isInstance( value );
+        }
+        catch ( ClassNotFoundException e )
+        {
+            throw new OgnlException( "No such class: " + className, e );
         }
     }
 
-    public static Object getPrimitiveDefaultValue(Class forClass)
+    public static Object getPrimitiveDefaultValue( Class forClass )
     {
-        return _primitiveDefaults.get(forClass);
+        return _primitiveDefaults.get( forClass );
     }
 
-    public static Object getNumericDefaultValue(Class forClass)
+    public static Object getNumericDefaultValue( Class forClass )
     {
-        return NUMERIC_DEFAULTS.get(forClass);
+        return NUMERIC_DEFAULTS.get( forClass );
     }
 
-    public static Object getConvertedType(OgnlContext context, Object target, Member member, String propertyName,
-                                          Object value, Class type)
+    public static Object getConvertedType( OgnlContext context, Object target, Member member, String propertyName,
+                                           Object value, Class type )
     {
-        return context.getTypeConverter().convertValue(context, target, member, propertyName, value, type);
+        return context.getTypeConverter().convertValue( context, target, member, propertyName, value, type );
     }
 
-    public static boolean getConvertedTypes(OgnlContext context, Object target, Member member, String propertyName,
-                                            Class[] parameterTypes, Object[] args, Object[] newArgs)
+    public static boolean getConvertedTypes( OgnlContext context, Object target, Member member, String propertyName,
+                                             Class[] parameterTypes, Object[] args, Object[] newArgs )
     {
         boolean result = false;
 
-        if (parameterTypes.length == args.length) {
+        if ( parameterTypes.length == args.length )
+        {
             result = true;
-            for (int i = 0, ilast = parameterTypes.length - 1; result && (i <= ilast); i++) {
+            for ( int i = 0, ilast = parameterTypes.length - 1; result && ( i <= ilast ); i++ )
+            {
                 Object arg = args[i];
                 Class type = parameterTypes[i];
 
-                if (isTypeCompatible(arg, type)) {
+                if ( isTypeCompatible( arg, type ) )
+                {
                     newArgs[i] = arg;
-                } else {
-                    Object v = getConvertedType(context, target, member, propertyName, arg, type);
+                }
+                else
+                {
+                    Object v = getConvertedType( context, target, member, propertyName, arg, type );
 
-                    if (v == OgnlRuntime.NoConversionPossible) {
+                    if ( v == OgnlRuntime.NoConversionPossible )
+                    {
                         result = false;
-                    } else {
+                    }
+                    else
+                    {
                         newArgs[i] = v;
                     }
                 }
@@ -1103,20 +1174,20 @@ public class OgnlRuntime {
         return result;
     }
 
-    public static Method getConvertedMethodAndArgs(OgnlContext context, Object target, String propertyName,
-                                                   List methods, Object[] args, Object[] newArgs)
+    public static Method getConvertedMethodAndArgs( OgnlContext context, Object target, String propertyName,
+                                                    List methods, Object[] args, Object[] newArgs )
     {
         Method result = null;
         TypeConverter converter = context.getTypeConverter();
 
-        if ((converter != null) && (methods != null))
+        if ( ( converter != null ) && ( methods != null ) )
         {
-            for (int i = 0, icount = methods.size(); (result == null) && (i < icount); i++)
+            for ( int i = 0, icount = methods.size(); ( result == null ) && ( i < icount ); i++ )
             {
-                Method m = (Method) methods.get(i);
-                Class[] parameterTypes = findParameterTypes(target != null ? target.getClass() : null, m);//getParameterTypes(m);
+                Method m = (Method) methods.get( i );
+                Class[] parameterTypes = findParameterTypes( target != null ? target.getClass() : null, m );// getParameterTypes(m);
 
-                if (getConvertedTypes(context, target, m, propertyName, parameterTypes, args, newArgs))
+                if ( getConvertedTypes( context, target, m, propertyName, parameterTypes, args, newArgs ) )
                 {
                     result = m;
                 }
@@ -1125,18 +1196,21 @@ public class OgnlRuntime {
         return result;
     }
 
-    public static Constructor getConvertedConstructorAndArgs(OgnlContext context, Object target, List constructors,
-                                                             Object[] args, Object[] newArgs)
+    public static Constructor getConvertedConstructorAndArgs( OgnlContext context, Object target, List constructors,
+                                                              Object[] args, Object[] newArgs )
     {
         Constructor result = null;
         TypeConverter converter = context.getTypeConverter();
 
-        if ((converter != null) && (constructors != null)) {
-            for (int i = 0, icount = constructors.size(); (result == null) && (i < icount); i++) {
-                Constructor ctor = (Constructor) constructors.get(i);
-                Class[] parameterTypes = getParameterTypes(ctor);
+        if ( ( converter != null ) && ( constructors != null ) )
+        {
+            for ( int i = 0, icount = constructors.size(); ( result == null ) && ( i < icount ); i++ )
+            {
+                Constructor ctor = (Constructor) constructors.get( i );
+                Class[] parameterTypes = getParameterTypes( ctor );
 
-                if (getConvertedTypes(context, target, ctor, null, parameterTypes, args, newArgs)) {
+                if ( getConvertedTypes( context, target, ctor, null, parameterTypes, args, newArgs ) )
+                {
                     result = ctor;
                 }
             }
@@ -1145,11 +1219,10 @@ public class OgnlRuntime {
     }
 
     /**
-     * Gets the appropriate method to be called for the given target, method name and arguments. If
-     * successful this method will return the Method within the target that can be called and the
-     * converted arguments in actualArgs. If unsuccessful this method will return null and the
-     * actualArgs will be empty.
-     *
+     * Gets the appropriate method to be called for the given target, method name and arguments. If successful this
+     * method will return the Method within the target that can be called and the converted arguments in actualArgs. If
+     * unsuccessful this method will return null and the actualArgs will be empty.
+     * 
      * @param context The current execution context.
      * @param source Target object to run against or method name.
      * @param target Instance of object to be run against.
@@ -1157,94 +1230,94 @@ public class OgnlRuntime {
      * @param methods List of current known methods.
      * @param args Arguments originally passed in.
      * @param actualArgs Converted arguments.
-     *
      * @return Best method match or null if none could be found.
      */
-    public static Method getAppropriateMethod(OgnlContext context, Object source, Object target, String propertyName,
-                                              List methods, Object[] args, Object[] actualArgs)
+    public static Method getAppropriateMethod( OgnlContext context, Object source, Object target, String propertyName,
+                                               List methods, Object[] args, Object[] actualArgs )
     {
         Method result = null;
         Class[] resultParameterTypes = null;
 
-        if (methods != null)
+        if ( methods != null )
         {
-            for (int i = 0, icount = methods.size(); i < icount; i++)
+            for ( int i = 0, icount = methods.size(); i < icount; i++ )
             {
-                Method m = (Method) methods.get(i);
+                Method m = (Method) methods.get( i );
 
                 Class typeClass = target != null ? target.getClass() : null;
-                if (typeClass == null && source != null && Class.class.isInstance(source))
+                if ( typeClass == null && source != null && Class.class.isInstance( source ) )
                 {
-                    typeClass = (Class)source;
+                    typeClass = (Class) source;
                 }
 
-                Class[] mParameterTypes = findParameterTypes(typeClass, m);
+                Class[] mParameterTypes = findParameterTypes( typeClass, m );
 
-                if (areArgsCompatible(args, mParameterTypes, m)
-                    && ((result == null) || isMoreSpecific(mParameterTypes, resultParameterTypes)))
+                if ( areArgsCompatible( args, mParameterTypes, m )
+                    && ( ( result == null ) || isMoreSpecific( mParameterTypes, resultParameterTypes ) ) )
                 {
                     result = m;
                     resultParameterTypes = mParameterTypes;
-                    System.arraycopy(args, 0, actualArgs, 0, args.length);
+                    System.arraycopy( args, 0, actualArgs, 0, args.length );
 
-                    for (int j = 0; j < mParameterTypes.length; j++)
+                    for ( int j = 0; j < mParameterTypes.length; j++ )
                     {
                         Class type = mParameterTypes[j];
 
-                        if (type.isPrimitive() && (actualArgs[j] == null))
+                        if ( type.isPrimitive() && ( actualArgs[j] == null ) )
                         {
-                            actualArgs[j] = getConvertedType(context, source, result, propertyName, null, type);
+                            actualArgs[j] = getConvertedType( context, source, result, propertyName, null, type );
                         }
                     }
                 }
             }
         }
 
-        if (result == null)
+        if ( result == null )
         {
-            result = getConvertedMethodAndArgs(context, target, propertyName, methods, args, actualArgs);
+            result = getConvertedMethodAndArgs( context, target, propertyName, methods, args, actualArgs );
         }
 
         return result;
     }
 
-    public static Object callAppropriateMethod(OgnlContext context, Object source, Object target, String methodName,
-                                               String propertyName, List methods, Object[] args)
-            throws MethodFailedException
+    public static Object callAppropriateMethod( OgnlContext context, Object source, Object target, String methodName,
+                                                String propertyName, List methods, Object[] args )
+        throws MethodFailedException
     {
         Throwable reason = null;
-        Object[] actualArgs = _objectArrayPool.create(args.length);
+        Object[] actualArgs = _objectArrayPool.create( args.length );
 
-        try {
-            Method method = getAppropriateMethod(context, source, target, propertyName, methods, args, actualArgs);
+        try
+        {
+            Method method = getAppropriateMethod( context, source, target, propertyName, methods, args, actualArgs );
 
-            if ((method == null) || !isMethodAccessible(context, source, method, propertyName))
+            if ( ( method == null ) || !isMethodAccessible( context, source, method, propertyName ) )
             {
                 StringBuffer buffer = new StringBuffer();
                 String className = "";
 
-                if (target != null)
+                if ( target != null )
                 {
                     className = target.getClass().getName() + ".";
                 }
 
-                for (int i = 0, ilast = args.length - 1; i <= ilast; i++)
+                for ( int i = 0, ilast = args.length - 1; i <= ilast; i++ )
                 {
                     Object arg = args[i];
 
-                    buffer.append((arg == null) ? NULL_STRING : arg.getClass().getName());
-                    if (i < ilast)
+                    buffer.append( ( arg == null ) ? NULL_STRING : arg.getClass().getName() );
+                    if ( i < ilast )
                     {
-                        buffer.append(", ");
+                        buffer.append( ", " );
                     }
                 }
 
-                throw new NoSuchMethodException(className + methodName + "(" + buffer + ")");
+                throw new NoSuchMethodException( className + methodName + "(" + buffer + ")" );
             }
 
             Object[] convertedArgs = actualArgs;
 
-            if (isJdk15() && method.isVarArgs())
+            if ( isJdk15() && method.isVarArgs() )
             {
                 Class[] parmTypes = method.getParameterTypes();
 
@@ -1252,30 +1325,31 @@ public class OgnlRuntime {
                 // where it is expected that the parameter passed in to invoke the method
                 // will look like "new Object[] { arrayOfNonVarArgsArguments, arrayOfVarArgsArguments }"
 
-                for (int i=0; i < parmTypes.length; i++)
+                for ( int i = 0; i < parmTypes.length; i++ )
                 {
-                    if (parmTypes[i].isArray())
+                    if ( parmTypes[i].isArray() )
                     {
                         convertedArgs = new Object[i + 1];
-                        System.arraycopy(actualArgs, 0, convertedArgs, 0, convertedArgs.length);
+                        System.arraycopy( actualArgs, 0, convertedArgs, 0, convertedArgs.length );
 
                         Object[] varArgs;
 
                         // if they passed in varargs arguments grab them and dump in to new varargs array
 
-                        if (actualArgs.length > i)
+                        if ( actualArgs.length > i )
                         {
                             ArrayList varArgsList = new ArrayList();
-                            for (int j=i; j < actualArgs.length; j++)
+                            for ( int j = i; j < actualArgs.length; j++ )
                             {
-                                if (actualArgs[j] != null)
+                                if ( actualArgs[j] != null )
                                 {
-                                    varArgsList.add(actualArgs[j]);
+                                    varArgsList.add( actualArgs[j] );
                                 }
                             }
 
                             varArgs = varArgsList.toArray();
-                        } else
+                        }
+                        else
                         {
                             varArgs = new Object[0];
                         }
@@ -1286,214 +1360,241 @@ public class OgnlRuntime {
                 }
             }
 
-            return invokeMethod(target, method, convertedArgs);
+            return invokeMethod( target, method, convertedArgs );
 
-        } catch (NoSuchMethodException e) {
+        }
+        catch ( NoSuchMethodException e )
+        {
             reason = e;
-        } catch (IllegalAccessException e) {
+        }
+        catch ( IllegalAccessException e )
+        {
             reason = e;
-        } catch (InvocationTargetException e) {
+        }
+        catch ( InvocationTargetException e )
+        {
             reason = e.getTargetException();
-        } finally {
-            _objectArrayPool.recycle(actualArgs);
+        }
+        finally
+        {
+            _objectArrayPool.recycle( actualArgs );
         }
 
-        throw new MethodFailedException(source, methodName, reason);
+        throw new MethodFailedException( source, methodName, reason );
     }
 
-    public static Object callStaticMethod(OgnlContext context, String className, String methodName, Object[] args)
-            throws OgnlException
+    public static Object callStaticMethod( OgnlContext context, String className, String methodName, Object[] args )
+        throws OgnlException
     {
-        try {
-            Class targetClass = classForName(context, className);
-            if (targetClass == null)
-                throw new ClassNotFoundException("Unable to resolve class with name " + className);
+        try
+        {
+            Class targetClass = classForName( context, className );
+            if ( targetClass == null )
+                throw new ClassNotFoundException( "Unable to resolve class with name " + className );
 
-            MethodAccessor ma = getMethodAccessor(targetClass);
+            MethodAccessor ma = getMethodAccessor( targetClass );
 
-            return ma.callStaticMethod(context, targetClass, methodName, args);
-        } catch (ClassNotFoundException ex) {
-            throw new MethodFailedException(className, methodName, ex);
+            return ma.callStaticMethod( context, targetClass, methodName, args );
+        }
+        catch ( ClassNotFoundException ex )
+        {
+            throw new MethodFailedException( className, methodName, ex );
         }
     }
 
     /**
      * Invokes the specified method against the target object.
-     *
-     * @param context
-     *          The current execution context.
-     * @param target
-     *          The object to invoke the method on.
-     * @param methodName
-     *          Name of the method - as in "getValue" or "add", etc..
-     * @param propertyName
-     *          Name of the property to call instead?
-     * @param args
-     *          Optional arguments needed for method.
+     * 
+     * @param context The current execution context.
+     * @param target The object to invoke the method on.
+     * @param methodName Name of the method - as in "getValue" or "add", etc..
+     * @param propertyName Name of the property to call instead?
+     * @param args Optional arguments needed for method.
      * @return Result of invoking method.
-     *
      * @deprecated Use {@link #callMethod(OgnlContext, Object, String, Object[])} instead.
      * @throws OgnlException For lots of different reasons.
      */
-    public static Object callMethod(OgnlContext context, Object target, String methodName, String propertyName, Object[] args)
-            throws OgnlException
+    public static Object callMethod( OgnlContext context, Object target, String methodName, String propertyName,
+                                     Object[] args )
+        throws OgnlException
     {
-        return callMethod(context, target, methodName == null ? propertyName : methodName, args);
+        return callMethod( context, target, methodName == null ? propertyName : methodName, args );
     }
 
     /**
      * Invokes the specified method against the target object.
-     *
-     * @param context
-     *          The current execution context.
-     * @param target
-     *          The object to invoke the method on.
-     * @param methodName
-     *          Name of the method - as in "getValue" or "add", etc..
-     * @param args
-     *          Optional arguments needed for method.
+     * 
+     * @param context The current execution context.
+     * @param target The object to invoke the method on.
+     * @param methodName Name of the method - as in "getValue" or "add", etc..
+     * @param args Optional arguments needed for method.
      * @return Result of invoking method.
-     *
      * @throws OgnlException For lots of different reasons.
      */
-    public static Object callMethod(OgnlContext context, Object target, String methodName, Object[] args)
-            throws OgnlException
+    public static Object callMethod( OgnlContext context, Object target, String methodName, Object[] args )
+        throws OgnlException
     {
-        if (target == null)
-            throw new NullPointerException("target is null for method " + methodName);
+        if ( target == null )
+            throw new NullPointerException( "target is null for method " + methodName );
 
-        return getMethodAccessor(target.getClass()).callMethod(context, target, methodName, args);
+        return getMethodAccessor( target.getClass() ).callMethod( context, target, methodName, args );
     }
 
-    public static Object callConstructor(OgnlContext context, String className, Object[] args)
-            throws OgnlException
+    public static Object callConstructor( OgnlContext context, String className, Object[] args )
+        throws OgnlException
     {
         Throwable reason = null;
         Object[] actualArgs = args;
 
-        try {
+        try
+        {
             Constructor ctor = null;
             Class[] ctorParameterTypes = null;
-            Class target = classForName(context, className);
-            List constructors = getConstructors(target);
+            Class target = classForName( context, className );
+            List constructors = getConstructors( target );
 
-            for (int i = 0, icount = constructors.size(); i < icount; i++) {
-                Constructor c = (Constructor) constructors.get(i);
-                Class[] cParameterTypes = getParameterTypes(c);
+            for ( int i = 0, icount = constructors.size(); i < icount; i++ )
+            {
+                Constructor c = (Constructor) constructors.get( i );
+                Class[] cParameterTypes = getParameterTypes( c );
 
-                if (areArgsCompatible(args, cParameterTypes)
-                    && (ctor == null || isMoreSpecific(cParameterTypes, ctorParameterTypes))) {
+                if ( areArgsCompatible( args, cParameterTypes )
+                    && ( ctor == null || isMoreSpecific( cParameterTypes, ctorParameterTypes ) ) )
+                {
                     ctor = c;
                     ctorParameterTypes = cParameterTypes;
                 }
             }
-            if (ctor == null) {
-                actualArgs = _objectArrayPool.create(args.length);
-                if ((ctor = getConvertedConstructorAndArgs(context, target, constructors, args, actualArgs)) == null) {
+            if ( ctor == null )
+            {
+                actualArgs = _objectArrayPool.create( args.length );
+                if ( ( ctor = getConvertedConstructorAndArgs( context, target, constructors, args, actualArgs ) ) == null )
+                {
                     throw new NoSuchMethodException();
                 }
             }
-            if (!context.getMemberAccess().isAccessible(context, target, ctor, null)) {
-                throw new IllegalAccessException(
-                        "access denied to " + target.getName() + "()");
+            if ( !context.getMemberAccess().isAccessible( context, target, ctor, null ) )
+            {
+                throw new IllegalAccessException( "access denied to " + target.getName() + "()" );
             }
-            return ctor.newInstance(actualArgs);
-        } catch (ClassNotFoundException e) {
+            return ctor.newInstance( actualArgs );
+        }
+        catch ( ClassNotFoundException e )
+        {
             reason = e;
-        } catch (NoSuchMethodException e) {
+        }
+        catch ( NoSuchMethodException e )
+        {
             reason = e;
-        } catch (IllegalAccessException e) {
+        }
+        catch ( IllegalAccessException e )
+        {
             reason = e;
-        } catch (InvocationTargetException e) {
+        }
+        catch ( InvocationTargetException e )
+        {
             reason = e.getTargetException();
-        } catch (InstantiationException e) {
+        }
+        catch ( InstantiationException e )
+        {
             reason = e;
-        } finally {
-            if (actualArgs != args) {
-                _objectArrayPool.recycle(actualArgs);
+        }
+        finally
+        {
+            if ( actualArgs != args )
+            {
+                _objectArrayPool.recycle( actualArgs );
             }
         }
 
-        throw new MethodFailedException(className, "new", reason);
+        throw new MethodFailedException( className, "new", reason );
     }
 
-    public static final Object getMethodValue(OgnlContext context, Object target, String propertyName)
-            throws OgnlException, IllegalAccessException, NoSuchMethodException, IntrospectionException
+    public static final Object getMethodValue( OgnlContext context, Object target, String propertyName )
+        throws OgnlException, IllegalAccessException, NoSuchMethodException, IntrospectionException
     {
-        return getMethodValue(context, target, propertyName, false);
+        return getMethodValue( context, target, propertyName, false );
     }
 
     /**
-     * If the checkAccessAndExistence flag is true this method will check to see if the method
-     * exists and if it is accessible according to the context's MemberAccess. If neither test
-     * passes this will return NotFound.
+     * If the checkAccessAndExistence flag is true this method will check to see if the method exists and if it is
+     * accessible according to the context's MemberAccess. If neither test passes this will return NotFound.
      */
-    public static final Object getMethodValue(OgnlContext context, Object target, String propertyName,
-                                              boolean checkAccessAndExistence)
-            throws OgnlException, IllegalAccessException, NoSuchMethodException, IntrospectionException
+    public static final Object getMethodValue( OgnlContext context, Object target, String propertyName,
+                                               boolean checkAccessAndExistence )
+        throws OgnlException, IllegalAccessException, NoSuchMethodException, IntrospectionException
     {
         Object result = null;
-        Method m = getGetMethod(context, (target == null) ? null : target.getClass() , propertyName);
-        if (m == null)
-            m = getReadMethod((target == null) ? null : target.getClass(), propertyName, 0);
+        Method m = getGetMethod( context, ( target == null ) ? null : target.getClass(), propertyName );
+        if ( m == null )
+            m = getReadMethod( ( target == null ) ? null : target.getClass(), propertyName, 0 );
 
-        if (checkAccessAndExistence)
+        if ( checkAccessAndExistence )
         {
-            if ((m == null) || !context.getMemberAccess().isAccessible(context, target, m, propertyName))
+            if ( ( m == null ) || !context.getMemberAccess().isAccessible( context, target, m, propertyName ) )
             {
                 result = NotFound;
             }
         }
-        if (result == null) {
-            if (m != null) {
-                try {
-                    result = invokeMethod(target, m, NoArguments);
-                } catch (InvocationTargetException ex) {
-                    throw new OgnlException(propertyName, ex.getTargetException());
+        if ( result == null )
+        {
+            if ( m != null )
+            {
+                try
+                {
+                    result = invokeMethod( target, m, NoArguments );
+                }
+                catch ( InvocationTargetException ex )
+                {
+                    throw new OgnlException( propertyName, ex.getTargetException() );
                 }
-            } else {
-                throw new NoSuchMethodException(propertyName);
+            }
+            else
+            {
+                throw new NoSuchMethodException( propertyName );
             }
         }
         return result;
     }
 
-    public static boolean setMethodValue(OgnlContext context, Object target, String propertyName, Object value)
-            throws OgnlException, IllegalAccessException, NoSuchMethodException, IntrospectionException
+    public static boolean setMethodValue( OgnlContext context, Object target, String propertyName, Object value )
+        throws OgnlException, IllegalAccessException, NoSuchMethodException, IntrospectionException
     {
-        return setMethodValue(context, target, propertyName, value, false);
+        return setMethodValue( context, target, propertyName, value, false );
     }
 
-    public static boolean setMethodValue(OgnlContext context, Object target, String propertyName, Object value,

[... 2010 lines stripped ...]