Author: dbrosius Date: Tue Apr 1 20:42:14 2008 New Revision: 643698 URL: http://svn.apache.org/viewvc?rev=643698&view=rev Log: don't allocate a buffer if no work is to be done
Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java?rev=643698&r1=643697&r2=643698&view=diff ============================================================================== --- jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java (original) +++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java Tue Apr 1 20:42:14 2008 @@ -705,7 +705,7 @@ /** - * Replace all occurences of <em>old</em> in <em>str</em> with <em>new</em>. + * Replace all occurrences of <em>old</em> in <em>str</em> with <em>new</em>. * * @param str String to permute * @param old String to be replaced @@ -714,9 +714,9 @@ */ public static final String replace( String str, String old, String new_ ) { int index, old_index; - StringBuffer buf = new StringBuffer(); try { if ((index = str.indexOf(old)) != -1) { // `old' found in str + StringBuffer buf = new StringBuffer(); old_index = 0; // String start offset // While we have something to replace while ((index = str.indexOf(old, old_index)) != -1) { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]