Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTProperty.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTProperty.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTProperty.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTProperty.java Sat Oct 29 11:10:16 2011 @@ -103,7 +103,7 @@ public class ASTProperty public Object getProperty( OgnlContext context, Object source ) throws OgnlException { - return _children[0].getValue( context, context.getRoot() ); + return children[0].getValue( context, context.getRoot() ); } protected Object getValueBody( OgnlContext context, Object source ) @@ -132,8 +132,8 @@ public class ASTProperty public boolean isNodeSimpleProperty( OgnlContext context ) throws OgnlException { - return ( _children != null ) && ( _children.length == 1 ) - && ( (SimpleNode) _children[0] ).isConstant( context ); + return ( children != null ) && ( children.length == 1 ) + && ( (SimpleNode) children[0] ).isConstant( context ); } public Class getGetterClass() @@ -165,7 +165,7 @@ public class ASTProperty if ( isIndexedAccess() ) { - Object value = _children[0].getValue( context, context.getRoot() ); + Object value = children[0].getValue( context, context.getRoot() ); if ( value == null || DynamicSubscript.class.isAssignableFrom( value.getClass() ) ) { @@ -174,11 +174,11 @@ public class ASTProperty } // Get root cast string if the child is a type that needs it (like a nested ASTProperty) - String srcString = _children[0].toGetSourceString( context, context.getRoot() ); + String srcString = children[0].toGetSourceString( context, context.getRoot() ); srcString = - ExpressionCompiler.getRootExpression( _children[0], context.getRoot(), context ) + srcString; + ExpressionCompiler.getRootExpression( children[0], context.getRoot(), context ) + srcString; - if ( ASTChain.class.isInstance( _children[0] ) ) + if ( ASTChain.class.isInstance( children[0] ) ) { String cast = (String) context.remove( ExpressionCompiler.PRE_CAST ); if ( cast != null ) @@ -187,7 +187,7 @@ public class ASTProperty } } - if ( ASTConst.class.isInstance( _children[0] ) + if ( ASTConst.class.isInstance( children[0] ) && String.class.isInstance( context.getCurrentObject() ) ) { srcString = "\"" + srcString + "\""; @@ -238,7 +238,7 @@ public class ASTProperty * + context.getCurrentType()); */ - if ( ASTConst.class.isInstance( _children[0] ) + if ( ASTConst.class.isInstance( children[0] ) && Number.class.isInstance( context.getCurrentObject() ) ) { context.setCurrentType( @@ -252,7 +252,7 @@ public class ASTProperty } } - String name = ( (ASTConst) _children[0] ).getValue().toString(); + String name = ( (ASTConst) children[0] ).getValue().toString(); target = getTarget( context, target, name ); @@ -287,7 +287,7 @@ public class ASTProperty } } - if ( _parent == null ) + if ( parent == null ) { // the above pd will be the wrong result sometimes, such as methods like getValue(int) vs String[] // getValue() @@ -346,9 +346,9 @@ public class ASTProperty Class currType = context.getCurrentType(); Class prevType = context.getPreviousType(); - String srcString = _children[0].toGetSourceString( context, context.getRoot() ); + String srcString = children[0].toGetSourceString( context, context.getRoot() ); - if ( ASTConst.class.isInstance( _children[0] ) + if ( ASTConst.class.isInstance( children[0] ) && String.class.isInstance( context.getCurrentObject() ) ) { srcString = "\"" + srcString + "\""; @@ -452,7 +452,7 @@ public class ASTProperty if ( isIndexedAccess() ) { - Object value = _children[0].getValue( context, context.getRoot() ); + Object value = children[0].getValue( context, context.getRoot() ); if ( value == null ) { @@ -460,11 +460,11 @@ public class ASTProperty "Value passed as indexed property is null, can't enhance statement to bytecode." ); } - String srcString = _children[0].toGetSourceString( context, context.getRoot() ); + String srcString = children[0].toGetSourceString( context, context.getRoot() ); srcString = - ExpressionCompiler.getRootExpression( _children[0], context.getRoot(), context ) + srcString; + ExpressionCompiler.getRootExpression( children[0], context.getRoot(), context ) + srcString; - if ( ASTChain.class.isInstance( _children[0] ) ) + if ( ASTChain.class.isInstance( children[0] ) ) { String cast = (String) context.remove( ExpressionCompiler.PRE_CAST ); if ( cast != null ) @@ -473,7 +473,7 @@ public class ASTProperty } } - if ( ASTConst.class.isInstance( _children[0] ) + if ( ASTConst.class.isInstance( children[0] ) && String.class.isInstance( context.getCurrentObject() ) ) { srcString = "\"" + srcString + "\""; @@ -536,7 +536,7 @@ public class ASTProperty context.setCurrentType( currType ); context.setPreviousType( prevType ); - if ( ASTConst.class.isInstance( _children[0] ) + if ( ASTConst.class.isInstance( children[0] ) && Number.class.isInstance( context.getCurrentObject() ) ) { context.setCurrentType( @@ -567,7 +567,7 @@ public class ASTProperty } } - String name = ( (ASTConst) _children[0] ).getValue().toString(); + String name = ( (ASTConst) children[0] ).getValue().toString(); // System.out.println(" astprop(setter) : trying to set " + name + " on object target " + // context.getCurrentObject().getClass().getName()); @@ -614,7 +614,7 @@ public class ASTProperty } } - if ( _parent == null ) + if ( parent == null ) { // the above pd will be the wrong result sometimes, such as methods like getValue(int) vs String[] // getValue() @@ -646,7 +646,7 @@ public class ASTProperty { setterClass = target.getClass(); } - if ( _parent != null && pd != null && pa == null ) + if ( parent != null && pd != null && pa == null ) { m = pd.getReadMethod(); result = m.getName() + "()"; @@ -663,9 +663,9 @@ public class ASTProperty // Class currType = context.getCurrentType(); // Class prevType = context.getPreviousType(); - String srcString = _children[0].toGetSourceString( context, context.getRoot() ); + String srcString = children[0].toGetSourceString( context, context.getRoot() ); - if ( ASTConst.class.isInstance( _children[0] ) + if ( ASTConst.class.isInstance( children[0] ) && String.class.isInstance( context.getCurrentObject() ) ) { srcString = "\"" + srcString + "\"";
Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTRemainder.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTRemainder.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTRemainder.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTRemainder.java Sat Oct 29 11:10:16 2011 @@ -40,8 +40,8 @@ class ASTRemainder protected Object getValueBody( OgnlContext context, Object source ) throws OgnlException { - Object v1 = _children[0].getValue( context, source ); - Object v2 = _children[1].getValue( context, source ); + Object v1 = children[0].getValue( context, source ); + Object v2 = children[1].getValue( context, source ); return OgnlOps.remainder( v1, v2 ); } Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTRootVarRef.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTRootVarRef.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTRootVarRef.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTRootVarRef.java Sat Oct 29 11:10:16 2011 @@ -64,7 +64,7 @@ public class ASTRootVarRef context.setCurrentType( getterClass ); } - if ( _parent == null || ( getterClass != null && getterClass.isArray() ) ) + if ( parent == null || ( getterClass != null && getterClass.isArray() ) ) { return ""; } @@ -76,7 +76,7 @@ public class ASTRootVarRef public String toSetSourceString( OgnlContext context, Object target ) { - if ( _parent == null || ( getterClass != null && getterClass.isArray() ) ) + if ( parent == null || ( getterClass != null && getterClass.isArray() ) ) { return ""; } Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSelect.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSelect.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSelect.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSelect.java Sat Oct 29 11:10:16 2011 @@ -47,7 +47,7 @@ class ASTSelect protected Object getValueBody( OgnlContext context, Object source ) throws OgnlException { - Node expr = _children[0]; + Node expr = children[0]; List answer = new ArrayList(); ElementsAccessor elementsAccessor = OgnlRuntime.getElementsAccessor( OgnlRuntime.getTargetClass( source ) ); Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSelectFirst.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSelectFirst.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSelectFirst.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSelectFirst.java Sat Oct 29 11:10:16 2011 @@ -46,7 +46,7 @@ class ASTSelectFirst protected Object getValueBody( OgnlContext context, Object source ) throws OgnlException { - Node expr = _children[0]; + Node expr = children[0]; List answer = new ArrayList(); ElementsAccessor elementsAccessor = OgnlRuntime.getElementsAccessor( OgnlRuntime.getTargetClass( source ) ); Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSelectLast.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSelectLast.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSelectLast.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSelectLast.java Sat Oct 29 11:10:16 2011 @@ -46,7 +46,7 @@ class ASTSelectLast protected Object getValueBody( OgnlContext context, Object source ) throws OgnlException { - Node expr = _children[0]; + Node expr = children[0]; List answer = new ArrayList(); ElementsAccessor elementsAccessor = OgnlRuntime.getElementsAccessor( OgnlRuntime.getTargetClass( source ) ); Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSequence.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSequence.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSequence.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSequence.java Sat Oct 29 11:10:16 2011 @@ -56,9 +56,9 @@ public class ASTSequence throws OgnlException { Object result = null; - for ( int i = 0; i < _children.length; ++i ) + for ( int i = 0; i < children.length; ++i ) { - result = _children[i].getValue( context, source ); + result = children[i].getValue( context, source ); } return result; // The result is just the last one we saw. @@ -67,12 +67,12 @@ public class ASTSequence protected void setValueBody( OgnlContext context, Object target, Object value ) throws OgnlException { - int last = _children.length - 1; + int last = children.length - 1; for ( int i = 0; i < last; ++i ) { - _children[i].getValue( context, target ); + children[i].getValue( context, target ); } - _children[last].setValue( context, target, value ); + children[last].setValue( context, target, value ); } public Class getGetterClass() @@ -106,17 +106,17 @@ public class ASTSequence NodeType lastType = null; - for ( int i = 0; i < _children.length; ++i ) + for ( int i = 0; i < children.length; ++i ) { // System.out.println("astsequence child : " + _children[i].getClass().getName()); - String seqValue = _children[i].toGetSourceString( context, target ); + String seqValue = children[i].toGetSourceString( context, target ); - if ( ( i + 1 ) < _children.length && ASTOr.class.isInstance( _children[i] ) ) + if ( ( i + 1 ) < children.length && ASTOr.class.isInstance( children[i] ) ) { seqValue = "(" + seqValue + ")"; } - if ( i > 0 && ASTProperty.class.isInstance( _children[i] ) && seqValue != null + if ( i > 0 && ASTProperty.class.isInstance( children[i] ) && seqValue != null && seqValue.trim().length() > 0 ) { String pre = (String) context.get( "_currentChain" ); @@ -126,17 +126,17 @@ public class ASTSequence } seqValue = - ExpressionCompiler.getRootExpression( _children[i], context.getRoot(), context ) + pre + seqValue; + ExpressionCompiler.getRootExpression( children[i], context.getRoot(), context ) + pre + seqValue; context.setCurrentAccessor( context.getRoot().getClass() ); } - if ( ( i + 1 ) >= _children.length ) + if ( ( i + 1 ) >= children.length ) { coreExpression = result; lastExpression = seqValue; } - if ( seqValue != null && seqValue.trim().length() > 0 && ( i + 1 ) < _children.length ) + if ( seqValue != null && seqValue.trim().length() > 0 && ( i + 1 ) < children.length ) { result += seqValue + ";"; } @@ -146,9 +146,9 @@ public class ASTSequence } // set last known type from last child with a type - if ( NodeType.class.isInstance( _children[i] ) && ( (NodeType) _children[i] ).getGetterClass() != null ) + if ( NodeType.class.isInstance( children[i] ) && ( (NodeType) children[i] ).getGetterClass() != null ) { - lastType = (NodeType) _children[i]; + lastType = (NodeType) children[i]; } } Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTShiftLeft.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTShiftLeft.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTShiftLeft.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTShiftLeft.java Sat Oct 29 11:10:16 2011 @@ -40,8 +40,8 @@ class ASTShiftLeft protected Object getValueBody( OgnlContext context, Object source ) throws OgnlException { - Object v1 = _children[0].getValue( context, source ); - Object v2 = _children[1].getValue( context, source ); + Object v1 = children[0].getValue( context, source ); + Object v2 = children[1].getValue( context, source ); return OgnlOps.shiftLeft( v1, v2 ); } Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTShiftRight.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTShiftRight.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTShiftRight.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTShiftRight.java Sat Oct 29 11:10:16 2011 @@ -40,8 +40,8 @@ class ASTShiftRight protected Object getValueBody( OgnlContext context, Object source ) throws OgnlException { - Object v1 = _children[0].getValue( context, source ); - Object v2 = _children[1].getValue( context, source ); + Object v1 = children[0].getValue( context, source ); + Object v2 = children[1].getValue( context, source ); return OgnlOps.shiftRight( v1, v2 ); } Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTStaticMethod.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTStaticMethod.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTStaticMethod.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTStaticMethod.java Sat Oct 29 11:10:16 2011 @@ -72,7 +72,7 @@ public class ASTStaticMethod { for ( int i = 0, icount = args.length; i < icount; ++i ) { - args[i] = _children[i].getValue( context, root ); + args[i] = children[i].getValue( context, root ); } return OgnlRuntime.callStaticMethod( context, className, methodName, args ); @@ -100,7 +100,7 @@ public class ASTStaticMethod try { Class clazz = OgnlRuntime.classForName( context, className ); - Method m = OgnlRuntime.getMethod( context, clazz, methodName, _children, true ); + Method m = OgnlRuntime.getMethod( context, clazz, methodName, children, true ); if ( clazz == null || m == null ) { @@ -116,11 +116,11 @@ public class ASTStaticMethod } OgnlExpressionCompiler compiler = OgnlRuntime.getCompiler( context ); - if ( ( _children != null ) && ( _children.length > 0 ) ) + if ( ( children != null ) && ( children.length > 0 ) ) { Class[] parms = m.getParameterTypes(); - for ( int i = 0; i < _children.length; i++ ) + for ( int i = 0; i < children.length; i++ ) { if ( i > 0 ) { @@ -129,7 +129,7 @@ public class ASTStaticMethod Class prevType = context.getCurrentType(); - Node child = _children[i]; + Node child = children[i]; Object root = context.getRoot(); String parmString = ASTMethodUtil.getParmString( context, root, child, prevType ); Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSubtract.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSubtract.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSubtract.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSubtract.java Sat Oct 29 11:10:16 2011 @@ -40,8 +40,8 @@ class ASTSubtract protected Object getValueBody( OgnlContext context, Object source ) throws OgnlException { - Object v1 = _children[0].getValue( context, source ); - Object v2 = _children[1].getValue( context, source ); + Object v1 = children[0].getValue( context, source ); + Object v2 = children[1].getValue( context, source ); return OgnlOps.subtract( v1, v2 ); } Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTTest.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTTest.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTTest.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTTest.java Sat Oct 29 11:10:16 2011 @@ -42,17 +42,17 @@ class ASTTest protected Object getValueBody( OgnlContext context, Object source ) throws OgnlException { - Object test = _children[0].getValue( context, source ); + Object test = children[0].getValue( context, source ); int branch = OgnlOps.booleanValue( test ) ? 1 : 2; - return _children[branch].getValue( context, source ); + return children[branch].getValue( context, source ); } protected void setValueBody( OgnlContext context, Object target, Object value ) throws OgnlException { - Object test = _children[0].getValue( context, target ); + Object test = children[0].getValue( context, target ); int branch = OgnlOps.booleanValue( test ) ? 1 : 2; - _children[branch].setValue( context, target, value ); + children[branch].setValue( context, target, value ); } public String getExpressionOperator( int index ) @@ -67,10 +67,10 @@ class ASTTest throw new UnsupportedCompilationException( "evaluation resulted in null expression." ); } - if ( _children.length != 3 ) + if ( children.length != 3 ) { throw new UnsupportedCompilationException( "Can only compile test expressions with two children." - + _children.length ); + + children.length ); } String result = ""; @@ -78,18 +78,18 @@ class ASTTest try { - String first = OgnlRuntime.getChildSource( context, target, _children[0] ); + String first = OgnlRuntime.getChildSource( context, target, children[0] ); if ( !OgnlRuntime.isBoolean( first ) && !context.getCurrentType().isPrimitive() ) { first = OgnlRuntime.getCompiler( context ).createLocalReference( context, first, context.getCurrentType() ); } - if ( ExpressionNode.class.isInstance( _children[0] ) ) + if ( ExpressionNode.class.isInstance( children[0] ) ) { first = "(" + first + ")"; } - String second = OgnlRuntime.getChildSource( context, target, _children[1] ); + String second = OgnlRuntime.getChildSource( context, target, children[1] ); Class secondType = context.getCurrentType(); if ( !OgnlRuntime.isBoolean( second ) && !context.getCurrentType().isPrimitive() ) @@ -97,12 +97,12 @@ class ASTTest second = OgnlRuntime.getCompiler( context ).createLocalReference( context, second, context.getCurrentType() ); } - if ( ExpressionNode.class.isInstance( _children[1] ) ) + if ( ExpressionNode.class.isInstance( children[1] ) ) { second = "(" + second + ")"; } - String third = OgnlRuntime.getChildSource( context, target, _children[2] ); + String third = OgnlRuntime.getChildSource( context, target, children[2] ); Class thirdType = context.getCurrentType(); if ( !OgnlRuntime.isBoolean( third ) && !context.getCurrentType().isPrimitive() ) @@ -111,7 +111,7 @@ class ASTTest } - if ( ExpressionNode.class.isInstance( _children[2] ) ) + if ( ExpressionNode.class.isInstance( children[2] ) ) { third = "(" + third + ")"; } Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTUnsignedShiftRight.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTUnsignedShiftRight.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTUnsignedShiftRight.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTUnsignedShiftRight.java Sat Oct 29 11:10:16 2011 @@ -40,8 +40,8 @@ class ASTUnsignedShiftRight protected Object getValueBody( OgnlContext context, Object source ) throws OgnlException { - Object v1 = _children[0].getValue( context, source ); - Object v2 = _children[1].getValue( context, source ); + Object v1 = children[0].getValue( context, source ); + Object v2 = children[1].getValue( context, source ); return OgnlOps.unsignedShiftRight( v1, v2 ); } @@ -57,13 +57,13 @@ class ASTUnsignedShiftRight try { - String child1 = OgnlRuntime.getChildSource( context, target, _children[0] ); - child1 = coerceToNumeric( child1, context, _children[0] ); + String child1 = OgnlRuntime.getChildSource( context, target, children[0] ); + child1 = coerceToNumeric( child1, context, children[0] ); - String child2 = OgnlRuntime.getChildSource( context, target, _children[1] ); - child2 = coerceToNumeric( child2, context, _children[1] ); + String child2 = OgnlRuntime.getChildSource( context, target, children[1] ); + child2 = coerceToNumeric( child2, context, children[1] ); - Object v1 = _children[0].getValue( context, target ); + Object v1 = children[0].getValue( context, target ); int type = OgnlOps.getNumericType( v1 ); if ( type <= OgnlOps.INT ) Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTVarRef.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTVarRef.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTVarRef.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTVarRef.java Sat Oct 29 11:10:16 2011 @@ -126,7 +126,7 @@ public class ASTVarRef post = ")"; } - if ( _parent != null && ASTAssign.class.isInstance( _parent ) ) + if ( parent != null && ASTAssign.class.isInstance( parent ) ) { core = "$1.put(\"" + name + "\","; last = pre + "$1.get(\"" + name + "\")" + post; Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTXor.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTXor.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTXor.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTXor.java Sat Oct 29 11:10:16 2011 @@ -45,10 +45,10 @@ class ASTXor protected Object getValueBody( OgnlContext context, Object source ) throws OgnlException { - Object result = _children[0].getValue( context, source ); - for ( int i = 1; i < _children.length; ++i ) + Object result = children[0].getValue( context, source ); + for ( int i = 1; i < children.length; ++i ) { - result = OgnlOps.binaryXor( result, _children[i].getValue( context, source ) ); + result = OgnlOps.binaryXor( result, children[i].getValue( context, source ) ); } return result; } Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ComparisonExpression.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ComparisonExpression.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ComparisonExpression.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ComparisonExpression.java Sat Oct 29 11:10:16 2011 @@ -73,8 +73,8 @@ public abstract class ComparisonExpressi // iterate over children to make numeric type detection work properly - OgnlRuntime.getChildSource( context, target, _children[0] ); - OgnlRuntime.getChildSource( context, target, _children[1] ); + OgnlRuntime.getChildSource( context, target, children[0] ); + OgnlRuntime.getChildSource( context, target, children[1] ); // System.out.println("comparison expression currentType: " + context.getCurrentType() + " previousType: " + // context.getPreviousType()); @@ -87,7 +87,7 @@ public abstract class ComparisonExpressi result.append( getComparisonFunction() ).append( "( ($w) (" ); } - result.append( OgnlRuntime.getChildSource( context, target, _children[0], conversion ) ) + result.append( OgnlRuntime.getChildSource( context, target, children[0], conversion ) ) .append( " " ); if ( conversion ) @@ -99,7 +99,7 @@ public abstract class ComparisonExpressi result.append( getExpressionOperator( 0 ) ); } - result.append( "" ).append( OgnlRuntime.getChildSource( context, target, _children[1], conversion ) ); + result.append( "" ).append( OgnlRuntime.getChildSource( context, target, children[1], conversion ) ); if ( conversion ) { Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ExpressionNode.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ExpressionNode.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ExpressionNode.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ExpressionNode.java Sat Oct 29 11:10:16 2011 @@ -57,14 +57,14 @@ public abstract class ExpressionNode { boolean result = isNodeConstant( context ); - if ( ( _children != null ) && ( _children.length > 0 ) ) + if ( ( children != null ) && ( children.length > 0 ) ) { result = true; - for ( int i = 0; result && ( i < _children.length ); ++i ) + for ( int i = 0; result && ( i < children.length ); ++i ) { - if ( _children[i] instanceof SimpleNode ) + if ( children[i] instanceof SimpleNode ) { - result = ( (SimpleNode) _children[i] ).isConstant( context ); + result = ( (SimpleNode) children[i] ).isConstant( context ); } else { @@ -77,7 +77,7 @@ public abstract class ExpressionNode public String getExpressionOperator( int index ) { - throw new RuntimeException( "unknown operator for " + OgnlParserTreeConstants.jjtNodeName[_id] ); + throw new RuntimeException( "unknown operator for " + OgnlParserTreeConstants.jjtNodeName[id] ); } @Override @@ -85,26 +85,26 @@ public abstract class ExpressionNode { StringBuilder result = new StringBuilder( - ( _parent == null || NumericExpression.class.isAssignableFrom( _parent.getClass() ) ) ? "" : "(" ); + ( parent == null || NumericExpression.class.isAssignableFrom( parent.getClass() ) ) ? "" : "(" ); - if ( ( _children != null ) && ( _children.length > 0 ) ) + if ( ( children != null ) && ( children.length > 0 ) ) { - for ( int i = 0; i < _children.length; ++i ) + for ( int i = 0; i < children.length; ++i ) { if ( i > 0 ) { result.append( " " ).append( getExpressionOperator( i ) ).append( " " ); } - String value = _children[i].toGetSourceString( context, target ); + String value = children[i].toGetSourceString( context, target ); - if ( ( ASTProperty.class.isInstance( _children[i] ) || ASTMethod.class.isInstance( _children[i] ) - || ASTSequence.class.isInstance( _children[i] ) || ASTChain.class.isInstance( _children[i] ) ) + if ( ( ASTProperty.class.isInstance( children[i] ) || ASTMethod.class.isInstance( children[i] ) + || ASTSequence.class.isInstance( children[i] ) || ASTChain.class.isInstance( children[i] ) ) && value != null && value.trim().length() > 0 ) { String pre = null; - if ( ASTMethod.class.isInstance( _children[i] ) ) + if ( ASTMethod.class.isInstance( children[i] ) ) { pre = (String) context.get( "_currentChain" ); } @@ -121,7 +121,7 @@ public abstract class ExpressionNode } value = - cast + ExpressionCompiler.getRootExpression( _children[i], context.getRoot(), context ) + pre + cast + ExpressionCompiler.getRootExpression( children[i], context.getRoot(), context ) + pre + value; } @@ -129,7 +129,7 @@ public abstract class ExpressionNode } } - if ( _parent != null && !NumericExpression.class.isAssignableFrom( _parent.getClass() ) ) + if ( parent != null && !NumericExpression.class.isAssignableFrom( parent.getClass() ) ) { result.append( ")" ); } @@ -140,21 +140,21 @@ public abstract class ExpressionNode @Override public String toSetSourceString( OgnlContext context, Object target ) { - String result = ( _parent == null ) ? "" : "("; + String result = ( parent == null ) ? "" : "("; - if ( ( _children != null ) && ( _children.length > 0 ) ) + if ( ( children != null ) && ( children.length > 0 ) ) { - for ( int i = 0; i < _children.length; ++i ) + for ( int i = 0; i < children.length; ++i ) { if ( i > 0 ) { result += " " + getExpressionOperator( i ) + " "; } - result += _children[i].toSetSourceString( context, target ); + result += children[i].toSetSourceString( context, target ); } } - if ( _parent != null ) + if ( parent != null ) { result = result + ")"; } Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NumericExpression.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NumericExpression.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NumericExpression.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NumericExpression.java Sat Oct 29 11:10:16 2011 @@ -83,15 +83,15 @@ public abstract class NumericExpression getterClass = value.getClass(); } - for ( int i = 0; i < _children.length; i++ ) + for ( int i = 0; i < children.length; i++ ) { if ( i > 0 ) { result.append( " " ).append( getExpressionOperator( i ) ).append( " " ); } - String str = OgnlRuntime.getChildSource( context, target, _children[i] ); + String str = OgnlRuntime.getChildSource( context, target, children[i] ); - result.append( coerceToNumeric( str, context, _children[i] ) ); + result.append( coerceToNumeric( str, context, children[i] ) ); } } Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/SimpleNode.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/SimpleNode.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/SimpleNode.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/SimpleNode.java Sat Oct 29 11:10:16 2011 @@ -34,31 +34,31 @@ public abstract class SimpleNode private static final long serialVersionUID = 8305393337889433901L; - protected Node _parent; + protected Node parent; - protected Node[] _children; + protected Node[] children; - protected int _id; + protected int id; - protected OgnlParser _parser; + protected OgnlParser parser; - private boolean _constantValueCalculated; + private boolean constantValueCalculated; - private volatile boolean _hasConstantValue; + private volatile boolean hasConstantValue; - private Object _constantValue; + private Object constantValue; - private ExpressionAccessor _accessor; + private ExpressionAccessor accessor; public SimpleNode( int i ) { - _id = i; + id = i; } public SimpleNode( OgnlParser p, int i ) { this( i ); - _parser = p; + parser = p; } public void jjtOpen() @@ -71,37 +71,37 @@ public abstract class SimpleNode public void jjtSetParent( Node n ) { - _parent = n; + parent = n; } public Node jjtGetParent() { - return _parent; + return parent; } public void jjtAddChild( Node n, int i ) { - if ( _children == null ) + if ( children == null ) { - _children = new Node[i + 1]; + children = new Node[i + 1]; } - else if ( i >= _children.length ) + else if ( i >= children.length ) { Node c[] = new Node[i + 1]; - System.arraycopy( _children, 0, c, 0, _children.length ); - _children = c; + System.arraycopy( children, 0, c, 0, children.length ); + children = c; } - _children[i] = n; + children[i] = n; } public Node jjtGetChild( int i ) { - return _children[i]; + return children[i]; } public int jjtGetNumChildren() { - return ( _children == null ) ? 0 : _children.length; + return ( children == null ) ? 0 : children.length; } /* @@ -129,7 +129,7 @@ public abstract class SimpleNode public String toString( String prefix ) { - return prefix + OgnlParserTreeConstants.jjtNodeName[_id] + " " + toString(); + return prefix + OgnlParserTreeConstants.jjtNodeName[id] + " " + toString(); } public String toGetSourceString( OgnlContext context, Object target ) @@ -150,11 +150,11 @@ public abstract class SimpleNode { writer.println( toString( prefix ) ); - if ( _children != null ) + if ( children != null ) { - for ( int i = 0; i < _children.length; ++i ) + for ( int i = 0; i < children.length; ++i ) { - SimpleNode n = (SimpleNode) _children[i]; + SimpleNode n = (SimpleNode) children[i]; if ( n != null ) { n.dump( writer, prefix + " " ); @@ -167,13 +167,13 @@ public abstract class SimpleNode { int result = -1; - if ( _parent != null ) + if ( parent != null ) { - int icount = _parent.jjtGetNumChildren(); + int icount = parent.jjtGetNumChildren(); for ( int i = 0; i < icount; i++ ) { - if ( _parent.jjtGetChild( i ) == this ) + if ( parent.jjtGetChild( i ) == this ) { result = i; break; @@ -191,11 +191,11 @@ public abstract class SimpleNode if ( i >= 0 ) { - int icount = _parent.jjtGetNumChildren(); + int icount = parent.jjtGetNumChildren(); if ( i < icount ) { - result = _parent.jjtGetChild( i + 1 ); + result = parent.jjtGetChild( i + 1 ); } } return result; @@ -207,20 +207,20 @@ public abstract class SimpleNode context.setCurrentObject( source ); context.setCurrentNode( this ); - if ( !_constantValueCalculated ) + if ( !constantValueCalculated ) { - _constantValueCalculated = true; + constantValueCalculated = true; boolean constant = isConstant( context ); if ( constant ) { - _constantValue = getValueBody( context, source ); + constantValue = getValueBody( context, source ); } - _hasConstantValue = constant; + hasConstantValue = constant; } - return _hasConstantValue ? _constantValue : getValueBody( context, source ); + return hasConstantValue ? constantValue : getValueBody( context, source ); } protected void evaluateSetValueBody( OgnlContext context, Object target, Object value ) @@ -379,7 +379,7 @@ public abstract class SimpleNode protected boolean lastChild( OgnlContext context ) { - return _parent == null || context.get( "_lastChild" ) != null; + return parent == null || context.get( "_lastChild" ) != null; } /** @@ -391,47 +391,56 @@ public abstract class SimpleNode boolean shouldFlatten = false; int newSize = 0; - for ( int i = 0; i < _children.length; ++i ) - if ( _children[i].getClass() == getClass() ) + for ( Node aChildren : children ) + { + if ( aChildren.getClass() == getClass() ) { shouldFlatten = true; - newSize += _children[i].jjtGetNumChildren(); + newSize += aChildren.jjtGetNumChildren(); } else + { ++newSize; + } + } if ( shouldFlatten ) { Node[] newChildren = new Node[newSize]; int j = 0; - for ( int i = 0; i < _children.length; ++i ) + for ( Node c : children ) { - Node c = _children[i]; if ( c.getClass() == getClass() ) { for ( int k = 0; k < c.jjtGetNumChildren(); ++k ) + { newChildren[j++] = c.jjtGetChild( k ); + } } else + { newChildren[j++] = c; + } } if ( j != newSize ) + { throw new Error( "Assertion error: " + j + " != " + newSize ); + } - _children = newChildren; + children = newChildren; } } public ExpressionAccessor getAccessor() { - return _accessor; + return accessor; } public void setAccessor( ExpressionAccessor accessor ) { - _accessor = accessor; + this.accessor = accessor; } } Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ToStringVisitor.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ToStringVisitor.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ToStringVisitor.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ToStringVisitor.java Sat Oct 29 11:10:16 2011 @@ -42,15 +42,15 @@ public class ToStringVisitor private StringBuilder commaSeparatedChildren( SimpleNode node, StringBuilder data ) { - if ( ( node._children != null ) ) + if ( ( node.children != null ) ) { - for ( int i = 0; i < node._children.length; ++i ) + for ( int i = 0; i < node.children.length; ++i ) { if ( i > 0 ) { data.append( ", " ); } - recurse( node._children[i], data ); + recurse( node.children[i], data ); } } return data; @@ -68,24 +68,24 @@ public class ToStringVisitor private StringBuilder visitExpressionNode( ExpressionNode node, StringBuilder data ) { - if ( node._parent != null ) + if ( node.parent != null ) { data.append( "(" ); } - if ( ( node._children != null ) && ( node._children.length > 0 ) ) + if ( ( node.children != null ) && ( node.children.length > 0 ) ) { - for ( int i = 0; i < node._children.length; ++i ) + for ( int i = 0; i < node.children.length; ++i ) { if ( i > 0 ) { data.append( " " ).append( node.getExpressionOperator( i ) ).append( " " ); } - recurse( node._children[i], data ); + recurse( node.children[i], data ); } } - if ( node._parent != null ) + if ( node.parent != null ) { data.append( ')' ); } @@ -155,7 +155,7 @@ public class ToStringVisitor private StringBuilder concatInfix( SimpleNode node, String infix, StringBuilder data ) { - return concatInfix( node._children[0], infix, node._children[1], data ); + return concatInfix( node.children[0], infix, node.children[1], data ); } private StringBuilder concatInfix( Node left, String infix, Node right, StringBuilder data ) @@ -222,7 +222,7 @@ public class ToStringVisitor private StringBuilder appendPrefixed( String prefix, SimpleNode node, StringBuilder data ) { data.append( prefix ); - return recurse( node._children[0], data ); + return recurse( node.children[0], data ); } public StringBuilder visit( ASTNot node, StringBuilder data ) @@ -232,25 +232,25 @@ public class ToStringVisitor public StringBuilder visit( ASTInstanceof node, StringBuilder data ) { - return recurse( node._children[0], data ).append( " instanceof " ).append( node.getTargetType() ); + return recurse( node.children[0], data ).append( " instanceof " ).append( node.getTargetType() ); } public StringBuilder visit( ASTChain node, StringBuilder data ) { - if ( ( node._children != null ) && ( node._children.length > 0 ) ) + if ( ( node.children != null ) && ( node.children.length > 0 ) ) { - for ( int i = 0; i < node._children.length; i++ ) + for ( int i = 0; i < node.children.length; i++ ) { if ( i > 0 ) { - if ( !( node._children[i] instanceof ASTProperty ) - || !( (ASTProperty) node._children[i] ).isIndexedAccess() ) + if ( !( node.children[i] instanceof ASTProperty ) + || !( (ASTProperty) node.children[i] ).isIndexedAccess() ) { data.append( "." ); } } - recurse( node._children[i], data ); + recurse( node.children[i], data ); } } return data; @@ -344,7 +344,7 @@ public class ToStringVisitor data.append( "{ " ); for ( int i = 0; i < node.jjtGetNumChildren(); ++i ) { - ASTKeyValue kv = (ASTKeyValue) node._children[i]; + ASTKeyValue kv = (ASTKeyValue) node.children[i]; if ( i > 0 ) { @@ -371,7 +371,7 @@ public class ToStringVisitor if ( node.isArray() ) { - if ( node._children[0] instanceof ASTConst ) + if ( node.children[0] instanceof ASTConst ) { indexedChild( node, data ); } @@ -402,14 +402,14 @@ public class ToStringVisitor } else { - data.append( ( (ASTConst) node._children[0] ).getValue() ); + data.append( ( (ASTConst) node.children[0] ).getValue() ); } return data; } private StringBuilder indexedChild( SimpleNode node, StringBuilder data ) { - return surroundedNode( "[", node._children[0], "]", data ); + return surroundedNode( "[", node.children[0], "]", data ); } public StringBuilder visit( ASTStaticMethod node, StringBuilder data ) @@ -426,7 +426,7 @@ public class ToStringVisitor public StringBuilder visit( ASTProject node, StringBuilder data ) { - return surroundedNode( "{ ", node._children[0], " }", data ); + return surroundedNode( "{ ", node.children[0], " }", data ); } private StringBuilder surroundedNode( String open, Node inner, String close, StringBuilder data ) @@ -437,17 +437,17 @@ public class ToStringVisitor public StringBuilder visit( ASTSelect node, StringBuilder data ) { - return surroundedNode( "{? ", node._children[0], " }", data ); + return surroundedNode( "{? ", node.children[0], " }", data ); } public StringBuilder visit( ASTSelectFirst node, StringBuilder data ) { - return surroundedNode( "{^ ", node._children[0], " }", data ); + return surroundedNode( "{^ ", node.children[0], " }", data ); } public StringBuilder visit( ASTSelectLast node, StringBuilder data ) { - return surroundedNode( "{$ ", node._children[0], " }", data ); + return surroundedNode( "{$ ", node.children[0], " }", data ); } private StringBuilder recurse( Node child, StringBuilder data ) Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/TypeConverter.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/TypeConverter.java?rev=1194869&r1=1194868&r2=1194869&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/TypeConverter.java (original) +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/TypeConverter.java Sat Oct 29 11:10:16 2011 @@ -24,7 +24,7 @@ import java.util.Map; /** * Interface for accessing the type conversion facilities within a context. - * + * * @author Luke Blanshard (blans...@netscape.net) * @author Drew Davidson (d...@ognl.org) */ @@ -35,17 +35,18 @@ public interface TypeConverter * Converts the given value to a given type. The OGNL context, target, member and name of property being set are * given. This method should be able to handle conversion in general without any context, target, member or property * name specified. - * - * @param context OGNL context under which the conversion is being done - * @param target target object in which the property is being set - * @param member member (Constructor, Method or Field) being set + * + * @param context OGNL context under which the conversion is being done + * @param target target object in which the property is being set + * @param member member (Constructor, Method or Field) being set * @param propertyName property name being set - * @param value value to be converted - * @param toType type to which value is converted + * @param value value to be converted + * @param toType type to which value is converted * @return Converted value of type toType or TypeConverter.NoConversionPossible to indicate that the conversion was * not possible. */ - <T> T convertValue( Map<String, Object> context, Object target, Member member, String propertyName, Object value, Class<T> toType ) + <T> T convertValue( Map<String, Object> context, Object target, Member member, String propertyName, Object value, + Class<T> toType ) throws OgnlException; }