Apply Remy's alternative fix for the String comparison bugs found by Find Bugs. Note...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 27 Oct 2008 14:04:07 +0000 (14:04 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 27 Oct 2008 14:04:07 +0000 (14:04 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@708185 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/IntrospectionUtils.java
java/org/apache/tomcat/util/digester/Digester.java

index 4338acf..7606664 100644 (file)
@@ -489,6 +489,9 @@ public final class IntrospectionUtils {
      */
     public static String replaceProperties(String value, Hashtable staticProp,
             PropertySource dynamicProp[]) {
+        if (value.indexOf("$") < 0) {
+            return value;
+        }
         StringBuffer sb = new StringBuffer();
         int prev = 0;
         // assert value!=nil
index bfabd62..13371dd 100644 (file)
@@ -2866,7 +2866,7 @@ public class Digester extends DefaultHandler {
             try {
                 String newValue = 
                     IntrospectionUtils.replaceProperties(value, null, source);
-                if (!value.equals(newValue)) {
+                if (value != newValue) {
                     newAttrs.setValue(i, newValue);
                 }
             }
@@ -2894,7 +2894,7 @@ public class Digester extends DefaultHandler {
             return bodyText; // return unchanged data
         }
 
-        if (out.equals(in))  {
+        if (out == in)  {
             // No substitutions required. Don't waste memory creating
             // a new buffer
             return bodyText;