Remove unused code
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 15 Jan 2011 13:42:01 +0000 (13:42 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 15 Jan 2011 13:42:01 +0000 (13:42 +0000)
Fix FindBugs and Eclipse warnings
Correct typos

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1059322 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/buf/MessageBytes.java
java/org/apache/tomcat/util/digester/Digester.java
res/findbugs/filter-false-positives.xml
webapps/docs/changelog.xml
webapps/docs/config/context.xml

index e8cd3b3..9d81094 100644 (file)
@@ -154,19 +154,6 @@ public final class MessageBytes implements Cloneable, Serializable {
         hasLongValue=false;
     }
 
-    /** Remove the cached string value. Use it after a conversion on the
-     *  byte[] or after the encoding is changed
-     *  XXX Is this needed ?
-     */
-    public void resetStringValue() {
-        if( type != T_STR ) {
-            // If this was created as a byte[] or char[], we remove
-            // the old string value
-            hasStrValue=false;
-            strValue=null;
-        }
-    }
-
     /** 
      * Set the content to be a string
      */
@@ -294,7 +281,7 @@ public final class MessageBytes implements Cloneable, Serializable {
     public boolean equals(String s) {
         switch (type) {
         case T_STR:
-            if( strValue==null && s!=null) return false;
+            if (strValue == null) return s == null;
             return strValue.equals( s );
         case T_CHARS:
             return charC.equals( s );
@@ -313,7 +300,7 @@ public final class MessageBytes implements Cloneable, Serializable {
     public boolean equalsIgnoreCase(String s) {
         switch (type) {
         case T_STR:
-            if( strValue==null && s!=null) return false;
+            if (strValue == null) return s == null;
             return strValue.equalsIgnoreCase( s );
         case T_CHARS:
             return charC.equalsIgnoreCase( s );
@@ -324,6 +311,14 @@ public final class MessageBytes implements Cloneable, Serializable {
         }
     }
 
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof MessageBytes) {
+            return equals((MessageBytes) obj);
+        }
+        return false;
+    }
+
     public boolean equals(MessageBytes mb) {
         switch (type) {
         case T_STR:
index e21f0c3..46f870c 100644 (file)
@@ -78,6 +78,7 @@ public class Digester extends DefaultHandler {
     // ---------------------------------------------------------- Static Fields    
     private static class SystemPropertySource 
         implements IntrospectionUtils.PropertySource {
+        @Override
         public String getProperty( String key ) {
             return System.getProperty(key);
         }
index 27dd7c9..3e58001 100644 (file)
     <Bug code="CN" />
   </Match>
   <Match>
+    <!-- Returning null here is fine -->
+    <Class name="org.apache.tomcat.util.buf.MessageBytes"/>
+    <Method name="toString"/>
+    <Bug code="NP" />
+  </Match>
+  <Match>
+    <!-- Test really is for the same object rather than equality -->
+    <Class name="org.apache.tomcat.util.digester.Digester"/>
+    <Method name="updateBodyText"/>
+    <Bug code="ES" />
+  </Match>
+  <Match>
     <!-- Yes the simple name is the same as the super class. Accept it. -->
     <Class name="org.apache.tomcat.util.threads.ThreadPoolExecutor" />
     <Bug code="Nm" />
index fa92fc9..73835bf 100644 (file)
@@ -91,7 +91,7 @@
         Correct a handful of Javadoc warnings. (markt)
       </fix>
       <add>
-        Provide additional detail about how web application version order it
+        Provide additional detail about how web application version order is
         determined when using parallel deployment. (markt)
       </add>
     </changelog>
         dependencies to ensure that the correct Tomcat version appears in the
         manifest. (markt) 
       </fix>
+      <fix>
+        Code clean-up to remove unused code and reduce IDE warnings. (markt)
+      </fix>
     </changelog>
   </subsection>
 </section>
index 5b34748..ab3bf17 100644 (file)
   </table>
   
   <p>The version component is treated as a <code>String</code> both for
-  performance reasons and to allow flexability in versioning schemes. String
+  performance reasons and to allow flexibility in versioning schemes. String
   comparissions are used to determine version order. Therefore
   <code>foo##11.war</code> will be treated as an earlier version than
   <code>foo##2.war</code>. If using a purely numerical versioning scheme it is