commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcucchi...@apache.org
Subject svn commit: r1197015 - /commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ExpressionNode.java
Date Thu, 03 Nov 2011 09:26:20 GMT
Author: mcucchiara
Date: Thu Nov  3 09:26:20 2011
New Revision: 1197015

URL: http://svn.apache.org/viewvc?rev=1197015&view=rev
Log:
OGNL-37 - Use StringBuilder instead of String concatenation with '+'.

Modified:
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ExpressionNode.java

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=1197015&r1=1197014&r2=1197015&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 Thu
Nov  3 09:26:20 2011
@@ -140,7 +140,7 @@ public abstract class ExpressionNode
     @Override
     public String toSetSourceString( OgnlContext context, Object target )
     {
-        String result = ( parent == null ) ? "" : "(";
+        StringBuilder sourceStringBuilder = new StringBuilder( parent == null ? "" : "("
);
 
         if ( ( children != null ) && ( children.length > 0 ) )
         {
@@ -148,17 +148,17 @@ public abstract class ExpressionNode
             {
                 if ( i > 0 )
                 {
-                    result += " " + getExpressionOperator( i ) + " ";
+                    sourceStringBuilder.append( " " ).append( getExpressionOperator( i )
).append( ' ' );
                 }
 
-                result += children[i].toSetSourceString( context, target );
+                sourceStringBuilder.append( children[i].toSetSourceString( context, target
) );
             }
         }
         if ( parent != null )
         {
-            result = result + ")";
+            sourceStringBuilder.append( ")" );
         }
 
-        return result;
+        return sourceStringBuilder.toString();
     }
 }



Mime
View raw message