From: markt Date: Mon, 27 Oct 2008 14:04:07 +0000 (+0000) Subject: Apply Remy's alternative fix for the String comparison bugs found by Find Bugs. Note... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=095fd3e998b5000c6851fe00f48cdfd652d355b1;p=tomcat7.0 Apply Remy's alternative fix for the String comparison bugs found by Find Bugs. Note FB still complains but it is a false positive. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@708185 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/tomcat/util/IntrospectionUtils.java b/java/org/apache/tomcat/util/IntrospectionUtils.java index 4338acfd8..76066646d 100644 --- a/java/org/apache/tomcat/util/IntrospectionUtils.java +++ b/java/org/apache/tomcat/util/IntrospectionUtils.java @@ -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 diff --git a/java/org/apache/tomcat/util/digester/Digester.java b/java/org/apache/tomcat/util/digester/Digester.java index bfabd6207..13371dd63 100644 --- a/java/org/apache/tomcat/util/digester/Digester.java +++ b/java/org/apache/tomcat/util/digester/Digester.java @@ -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;