commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang StringEscapeUtils.java
Date Sun, 18 May 2003 00:10:38 GMT
ggregory    2003/05/17 17:10:38

  Modified:    lang/src/java/org/apache/commons/lang StringEscapeUtils.java
  Log:
  Improve performance (by ~10% on Sun Java 1.3.1_08) for the method escapeEntities(String
str, Entities entities) by using the existing StringBuffer instead of String + to the same
buffer.
  
  Revision  Changes    Path
  1.11      +10 -4     jakarta-commons/lang/src/java/org/apache/commons/lang/StringEscapeUtils.java
  
  Index: StringEscapeUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/StringEscapeUtils.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- StringEscapeUtils.java	16 May 2003 19:00:07 -0000	1.10
  +++ StringEscapeUtils.java	18 May 2003 00:10:38 -0000	1.11
  @@ -477,12 +477,16 @@
               if (entity == null) {
                   if (((int) ch) > 0x7F) {
                       int intValue = ((int) ch);
  -                    buf.append("&#" + intValue + ";");
  +                    buf.append("&#");
  +                    buf.append(intValue);
  +                    buf.append(';');
                   } else {
                       buf.append(ch);
                   }
               } else {
  -                buf.append("&" + entity + ";");
  +                buf.append('&');
  +                buf.append(entity);
  +                buf.append(';');
               }
           }
           return buf.toString();
  @@ -507,7 +511,9 @@
                       iso = entities.entityValue(entity);
                   }
                   if (iso == null) {
  -                    buf.append("&" + entity + ";");
  +                    buf.append('&');
  +                    buf.append(entity);
  +                    buf.append(';');
                   } else {
                       buf.append((char) (iso.intValue()));
                   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message