You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2014/06/29 14:13:30 UTC

svn commit: r1606487 - /commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java

Author: ggregory
Date: Sun Jun 29 12:13:29 2014
New Revision: 1606487

URL: http://svn.apache.org/r1606487
Log:
Redundant null check: The variable lvt cannot be null at this location.

Modified:
    commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java?rev=1606487&r1=1606486&r2=1606487&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java Sun Jun 29 12:13:29 2014
@@ -261,20 +261,23 @@ public final class Pass3aVerifier extend
            than only one. This is a bug in BCEL. */
         Attribute[] atts = code.getAttributes();
         for (Attribute att : atts) {
-            if (att instanceof LocalVariableTable){
+            if (att instanceof LocalVariableTable) {
                 LocalVariableTable lvt = (LocalVariableTable) att;
-                if (lvt != null){
-                    LocalVariable[] localVariables = lvt.getLocalVariableTable();
-                    for (LocalVariable localVariable : localVariables) {
-                        int startpc = localVariable.getStartPC();
-                        int length  = localVariable.getLength();
-
-                        if (!contains(instructionPositions, startpc)){
-                            throw new ClassConstraintException("Code attribute '"+code+"' has a LocalVariableTable attribute '"+code.getLocalVariableTable()+"' referring to a code offset ('"+startpc+"') that does not exist.");
-                        }
-                        if ( (!contains(instructionPositions, startpc+length)) && (startpc+length != codeLength) ){
-                            throw new ClassConstraintException("Code attribute '"+code+"' has a LocalVariableTable attribute '"+code.getLocalVariableTable()+"' referring to a code offset start_pc+length ('"+(startpc+length)+"') that does not exist.");
-                        }
+                LocalVariable[] localVariables = lvt.getLocalVariableTable();
+                for (LocalVariable localVariable : localVariables) {
+                    int startpc = localVariable.getStartPC();
+                    int length = localVariable.getLength();
+
+                    if (!contains(instructionPositions, startpc)) {
+                        throw new ClassConstraintException("Code attribute '" + code
+                                + "' has a LocalVariableTable attribute '" + code.getLocalVariableTable()
+                                + "' referring to a code offset ('" + startpc + "') that does not exist.");
+                    }
+                    if ((!contains(instructionPositions, startpc + length)) && (startpc + length != codeLength)) {
+                        throw new ClassConstraintException("Code attribute '" + code
+                                + "' has a LocalVariableTable attribute '" + code.getLocalVariableTable()
+                                + "' referring to a code offset start_pc+length ('" + (startpc + length)
+                                + "') that does not exist.");
                     }
                 }
             }