Fix FindBugs and unused code warnings
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 14 Jan 2011 19:07:17 +0000 (19:07 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 14 Jan 2011 19:07:17 +0000 (19:07 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1059117 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/naming/resources/ResourceAttributes.java
res/findbugs/filter-false-positives.xml

index d40feef..fa58e6f 100644 (file)
@@ -88,24 +88,12 @@ public class ResourceAttributes implements Attributes {
     
     
     /**
-     * Source.
-     */
-    public static final String SOURCE = "source";
-    
-    
-    /**
      * MIME type of the content.
      */
     public static final String CONTENT_TYPE = "getcontenttype";
     
     
     /**
-     * Content language.
-     */
-    public static final String CONTENT_LANGUAGE = "getcontentlanguage";
-    
-    
-    /**
      * Content length.
      */
     public static final String CONTENT_LENGTH = "getcontentlength";
@@ -333,7 +321,7 @@ public class ResourceAttributes implements Attributes {
     public void setContentLength(long contentLength) {
         this.contentLength = contentLength;
         if (attributes != null)
-            attributes.put(CONTENT_LENGTH, new Long(contentLength));
+            attributes.put(CONTENT_LENGTH, Long.valueOf(contentLength));
     }
     
     
@@ -808,11 +796,11 @@ public class ResourceAttributes implements Attributes {
             } else if (attrID.equals(CONTENT_LENGTH)) {
                 long contentLength = getContentLength();
                 if (contentLength < 0) return null;
-                return new BasicAttribute(CONTENT_LENGTH, new Long(contentLength));
+                return new BasicAttribute(CONTENT_LENGTH, Long.valueOf(contentLength));
             } else if (attrID.equals(ALTERNATE_CONTENT_LENGTH)) {
                 long contentLength = getContentLength();
                 if (contentLength < 0) return null;
-                return new BasicAttribute(ALTERNATE_CONTENT_LENGTH, new Long(contentLength));
+                return new BasicAttribute(ALTERNATE_CONTENT_LENGTH, Long.valueOf(contentLength));
             } else if (attrID.equals(ETAG)) {
                 String etag = getETag();
                 if (etag == null) return null;
@@ -904,7 +892,7 @@ public class ResourceAttributes implements Attributes {
             }
             long contentLength = getContentLength();
             if (contentLength >= 0) {
-                Long contentLengthLong = new Long(contentLength);
+                Long contentLengthLong = Long.valueOf(contentLength);
                 attributes.addElement(new BasicAttribute(CONTENT_LENGTH, contentLengthLong));
                 attributes.addElement(new BasicAttribute(ALTERNATE_CONTENT_LENGTH, contentLengthLong));
             }
index 752c68b..27dd7c9 100644 (file)
     <Bug code="Nm" />
   </Match>
   <Match>
+    <!-- Class has to implement clone since its superclass does but fakes it -->
+    <Class name="org.apache.naming.resources.ResourceAttributes" />
+    <Bug code="CN" />
+  </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" />