Author: markt Date: Wed Dec 15 14:54:23 2010 New Revision: 1049572 URL: http://svn.apache.org/viewvc?rev=1049572&view=rev Log: Whilst I am thinking about excluding stuff from FindBugs - add some exceptions for the generated code with issues and fix the remaining issues in the same package
Modified: tomcat/trunk/java/org/apache/el/parser/AstNegative.java tomcat/trunk/java/org/apache/el/parser/SimpleNode.java tomcat/trunk/res/findbugs/filter-false-positives.xml Modified: tomcat/trunk/java/org/apache/el/parser/AstNegative.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/AstNegative.java?rev=1049572&r1=1049571&r2=1049572&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/el/parser/AstNegative.java (original) +++ tomcat/trunk/java/org/apache/el/parser/AstNegative.java Wed Dec 15 14:54:23 2010 @@ -47,7 +47,7 @@ public final class AstNegative extends S 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 S 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()); } } Modified: tomcat/trunk/java/org/apache/el/parser/SimpleNode.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/SimpleNode.java?rev=1049572&r1=1049571&r2=1049572&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/el/parser/SimpleNode.java (original) +++ tomcat/trunk/java/org/apache/el/parser/SimpleNode.java Wed Dec 15 14:54:23 2010 @@ -47,22 +47,27 @@ public abstract class SimpleNode extends 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 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 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 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 } } + @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 /** * @since EL 2.2 */ + @Override public ValueReference getValueReference(EvaluationContext ctx) { return null; } @@ -215,6 +214,7 @@ public abstract class SimpleNode extends /** * @since EL 2.2 */ + @Override public boolean isParametersProvided() { return false; } Modified: tomcat/trunk/res/findbugs/filter-false-positives.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/res/findbugs/filter-false-positives.xml?rev=1049572&r1=1049571&r2=1049572&view=diff ============================================================================== --- tomcat/trunk/res/findbugs/filter-false-positives.xml (original) +++ tomcat/trunk/res/findbugs/filter-false-positives.xml Wed Dec 15 14:54:23 2010 @@ -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 --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org