Whilst I am thinking about excluding stuff from FindBugs - add some exceptions for...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 15 Dec 2010 14:54:23 +0000 (14:54 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 15 Dec 2010 14:54:23 +0000 (14:54 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1049572 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/el/parser/AstNegative.java
java/org/apache/el/parser/SimpleNode.java
res/findbugs/filter-false-positives.xml

index e16a0a7..1e89c80 100644 (file)
@@ -47,7 +47,7 @@ public final class AstNegative extends SimpleNode {
         Object obj = this.children[0].getValue(ctx);
 
         if (obj == null) {
-            return new Long(0);
+            return Long.valueOf(0);
         }
         if (obj instanceof BigDecimal) {
             return ((BigDecimal) obj).negate();
@@ -59,27 +59,27 @@ public final class AstNegative extends SimpleNode {
             if (isStringFloat((String) obj)) {
                 return new Double(-Double.parseDouble((String) obj));
             }
-            return new Long(-Long.parseLong((String) obj));
+            return Long.valueOf(-Long.parseLong((String) obj));
         }
         if (obj instanceof Long) {
-            return new Long(-((Long) obj).longValue());
+            return Long.valueOf(-((Long) obj).longValue());
         }
         if (obj instanceof Double) {
             return new Double(-((Double) obj).doubleValue());
         }
         if (obj instanceof Integer) {
-            return new Integer(-((Integer) obj).intValue());
+            return Integer.valueOf(-((Integer) obj).intValue());
         }
         if (obj instanceof Float) {
             return new Float(-((Float) obj).floatValue());
         }
         if (obj instanceof Short) {
-            return new Short((short) -((Short) obj).shortValue());
+            return Short.valueOf((short) -((Short) obj).shortValue());
         }
         if (obj instanceof Byte) {
-            return new Byte((byte) -((Byte) obj).byteValue());
+            return Byte.valueOf((byte) -((Byte) obj).byteValue());
         }
         Long num = (Long) coerceToNumber(obj, Long.class);
-        return new Long(-num.longValue());
+        return Long.valueOf(-num.longValue());
     }
 }
index 9ff99d1..6010381 100644 (file)
@@ -47,22 +47,27 @@ public abstract class SimpleNode extends ELSupport implements Node {
         id = i;
     }
 
+    @Override
     public void jjtOpen() {
         // NOOP by default
     }
 
+    @Override
     public void jjtClose() {
         // NOOP by default
     }
 
+    @Override
     public void jjtSetParent(Node n) {
         parent = n;
     }
 
+    @Override
     public Node jjtGetParent() {
         return parent;
     }
 
+    @Override
     public void jjtAddChild(Node n, int i) {
         if (children == null) {
             children = new Node[i + 1];
@@ -74,10 +79,12 @@ public abstract class SimpleNode extends ELSupport implements Node {
         children[i] = n;
     }
 
+    @Override
     public Node jjtGetChild(int i) {
         return children[i];
     }
 
+    @Override
     public int jjtGetNumChildren() {
         return (children == null) ? 0 : children.length;
     }
@@ -102,23 +109,7 @@ public abstract class SimpleNode extends ELSupport implements Node {
         return prefix + toString();
     }
 
-    /*
-     * Override this method if you want to customize how the node dumps out its
-     * children.
-     */
-
-    public void dump(String prefix) {
-        System.out.println(toString(prefix));
-        if (children != null) {
-            for (int i = 0; i < children.length; ++i) {
-                SimpleNode n = (SimpleNode) children[i];
-                if (n != null) {
-                    n.dump(prefix + " ");
-                }
-            }
-        }
-    }
-
+    @Override
     public String getImage() {
         return image;
     }
@@ -127,26 +118,31 @@ public abstract class SimpleNode extends ELSupport implements Node {
         this.image = image;
     }
 
+    @Override
     public Class<?> getType(EvaluationContext ctx)
             throws ELException {
         throw new UnsupportedOperationException();
     }
 
+    @Override
     public Object getValue(EvaluationContext ctx)
             throws ELException {
         throw new UnsupportedOperationException();
     }
 
+    @Override
     public boolean isReadOnly(EvaluationContext ctx)
             throws ELException {
         return true;
     }
 
+    @Override
     public void setValue(EvaluationContext ctx, Object value)
             throws ELException {
         throw new PropertyNotWritableException(MessageFactory.get("error.syntax.set"));
     }
 
+    @Override
     public void accept(NodeVisitor visitor) throws Exception {
         visitor.visit(this);
         if (this.children != null && this.children.length > 0) {
@@ -156,11 +152,13 @@ public abstract class SimpleNode extends ELSupport implements Node {
         }
     }
 
+    @Override
     public Object invoke(EvaluationContext ctx, Class<?>[] paramTypes,
             Object[] paramValues) throws ELException {
         throw new UnsupportedOperationException();
     }
 
+    @Override
     public MethodInfo getMethodInfo(EvaluationContext ctx,
             Class<?>[] paramTypes) throws ELException {
         throw new UnsupportedOperationException();
@@ -208,6 +206,7 @@ public abstract class SimpleNode extends ELSupport implements Node {
     /**
      * @since EL 2.2
      */
+    @Override
     public ValueReference getValueReference(EvaluationContext ctx) {
         return null;
     }
@@ -215,6 +214,7 @@ public abstract class SimpleNode extends ELSupport implements Node {
     /**
      * @since EL 2.2
      */
+    @Override
     public boolean isParametersProvided() {
         return false;
     }
index 9786b7c..940c9f6 100644 (file)
@@ -1,7 +1,18 @@
 <FindBugsFilter>
+  <!--  Considered to be false positives -->
   <Match>
     <Class name="org.apache.catalina.startup.HostConfig" />
     <Method name="checkResources" />
     <Bug code="SWL" />
   </Match>
+  <!--  Generated code -->
+  <Match>
+    <Class name="org.apache.el.parser.ELParserTokenManager" />
+  </Match>
+  <Match>
+    <Class name="org.apache.el.parser.TokenMgrError" />
+  </Match>
+  <Match>
+    <Class name="org.apache.el.parser.ParseException" />
+  </Match>
 </FindBugsFilter>
\ No newline at end of file