You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by db...@apache.org on 2013/10/15 08:13:17 UTC
svn commit: r1532202 - in
/commons/proper/bcel/trunk/src/main/java/org/apache/bcel: util/
verifier/statics/ verifier/structurals/
Author: dbrosius
Date: Tue Oct 15 06:13:17 2013
New Revision: 1532202
URL: http://svn.apache.org/r1532202
Log:
simplify and avoid NPEs
Modified:
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/AttributeHTML.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/SyntheticRepository.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/InstConstraintVisitor.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/LocalVariables.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/AttributeHTML.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/AttributeHTML.java?rev=1532202&r1=1532201&r2=1532202&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/AttributeHTML.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/AttributeHTML.java Tue Oct 15 06:13:17 2013
@@ -203,7 +203,7 @@ final class AttributeHTML implements org
file.print("</UL>\n");
break;
default: // Such as Unknown attribute or Deprecated
- file.print("<P>" + attribute.toString());
+ file.print("<P>" + attribute);
}
file.println("</TD></TR>");
file.flush();
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java?rev=1532202&r1=1532201&r2=1532202&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java Tue Oct 15 06:13:17 2013
@@ -97,7 +97,7 @@ public class ClassLoaderRepository imple
storeClass(RC);
return RC;
} catch (IOException e) {
- throw new ClassNotFoundException(className + " not found: " + e.toString(), e);
+ throw new ClassNotFoundException(className + " not found: " + e, e);
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/SyntheticRepository.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/SyntheticRepository.java?rev=1532202&r1=1532201&r2=1532202&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/SyntheticRepository.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/SyntheticRepository.java Tue Oct 15 06:13:17 2013
@@ -123,7 +123,7 @@ public class SyntheticRepository impleme
return loadClass(_path.getInputStream(className), className);
} catch (IOException e) {
throw new ClassNotFoundException("Exception while looking for class " + className
- + ": " + e.toString(), e);
+ + ": " + e, e);
}
}
@@ -178,7 +178,7 @@ public class SyntheticRepository impleme
}
} catch (IOException e) {
throw new ClassNotFoundException("Exception while looking for class " + className
- + ": " + e.toString(), e);
+ + ": " + e, e);
} finally {
if (is != null){
try {
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java?rev=1532202&r1=1532201&r2=1532202&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java Tue Oct 15 06:13:17 2013
@@ -172,7 +172,7 @@ public final class Pass2Verifier extends
} catch (ClassNotFoundException e) {
// FIXME: this might not be the best way to handle missing classes.
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -224,7 +224,7 @@ public final class Pass2Verifier extends
} catch (ClassNotFoundException e) {
// FIXME: this might not be the best way to handle missing classes.
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -279,7 +279,7 @@ public final class Pass2Verifier extends
} catch (ClassNotFoundException e) {
// FIXME: this might not be the best way to handle missing classes.
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -296,11 +296,11 @@ public final class Pass2Verifier extends
// we only have to verify if the indices of the constants point
// to constants of the appropriate type and such.
JavaClass jc = Repository.lookupClass(myOwner.getClassName());
- new CPESSC_Visitor(jc); // constructor implicitely traverses jc
+ new CPESSC_Visitor(jc); // constructor implicitly traverses jc
} catch (ClassNotFoundException e) {
// FIXME: this might not be the best way to handle missing classes.
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -1043,7 +1043,7 @@ public final class Pass2Verifier extends
} catch (ClassNotFoundException e) {
// FIXME: this might not be the best way to handle missing classes.
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}// visitCode(Code) END
@@ -1102,7 +1102,7 @@ public final class Pass2Verifier extends
} catch (ClassNotFoundException e) {
// FIXME: this might not be the best way to handle missing classes.
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
// SYNTHETIC: see above
@@ -1200,7 +1200,7 @@ public final class Pass2Verifier extends
} catch (ClassNotFoundException e) {
// FIXME: this might not be the best way to handle missing classes.
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
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=1532202&r1=1532201&r2=1532202&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 Tue Oct 15 06:13:17 2013
@@ -212,7 +212,7 @@ public final class Pass3aVerifier extend
}
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -417,7 +417,7 @@ public final class Pass3aVerifier extend
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -458,7 +458,7 @@ public final class Pass3aVerifier extend
return Repository.lookupClass(myOwner.getClassName()).getMethods()[method_no].getCode().getMaxLocals();
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -611,7 +611,7 @@ public final class Pass3aVerifier extend
}
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -1026,7 +1026,7 @@ public final class Pass3aVerifier extend
}
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -1053,7 +1053,7 @@ public final class Pass3aVerifier extend
}
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -1095,7 +1095,7 @@ public final class Pass3aVerifier extend
}
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -1160,7 +1160,7 @@ public final class Pass3aVerifier extend
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -1193,7 +1193,7 @@ public final class Pass3aVerifier extend
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -1227,7 +1227,7 @@ public final class Pass3aVerifier extend
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/InstConstraintVisitor.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/InstConstraintVisitor.java?rev=1532202&r1=1532201&r2=1532202&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/InstConstraintVisitor.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/InstConstraintVisitor.java Tue Oct 15 06:13:17 2013
@@ -485,7 +485,7 @@ public class InstConstraintVisitor exten
}
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -584,7 +584,7 @@ public class InstConstraintVisitor exten
}
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -1305,7 +1305,7 @@ public class InstConstraintVisitor exten
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -1933,7 +1933,7 @@ public class InstConstraintVisitor exten
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -1985,7 +1985,7 @@ public class InstConstraintVisitor exten
}
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -2063,7 +2063,7 @@ public class InstConstraintVisitor exten
}
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -2715,7 +2715,7 @@ public class InstConstraintVisitor exten
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
@@ -2780,7 +2780,7 @@ public class InstConstraintVisitor exten
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/LocalVariables.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/LocalVariables.java?rev=1532202&r1=1532201&r2=1532202&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/LocalVariables.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/LocalVariables.java Tue Oct 15 06:13:17 2013
@@ -181,7 +181,7 @@ public class LocalVariables{
}
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java?rev=1532202&r1=1532201&r2=1532202&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java Tue Oct 15 06:13:17 2013
@@ -249,7 +249,7 @@ public class OperandStack{
}
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java?rev=1532202&r1=1532201&r2=1532202&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java Tue Oct 15 06:13:17 2013
@@ -328,7 +328,7 @@ public final class Pass3bVerifier extend
jc = Repository.lookupClass(myOwner.getClassName());
} catch (ClassNotFoundException e) {
// FIXME: maybe not the best way to handle this
- throw new AssertionViolatedException("Missing class: " + e.toString(), e);
+ throw new AssertionViolatedException("Missing class: " + e, e);
}
ConstantPoolGen constantPoolGen = new ConstantPoolGen(jc.getConstantPool());
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java?rev=1532202&r1=1532201&r2=1532202&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java Tue Oct 15 06:13:17 2013
@@ -115,7 +115,7 @@ public class Subroutines{
*/
@Override
public String toString(){
- String ret = "Subroutine: Local variable is '"+localVariable+"', JSRs are '"+theJSRs+"', RET is '"+theRET+"', Instructions: '"+instructions.toString()+"'.";
+ String ret = "Subroutine: Local variable is '"+localVariable+"', JSRs are '"+theJSRs+"', RET is '"+theRET+"', Instructions: '"+instructions+"'.";
ret += " Accessed local variable slots: '";
int[] alv = getAccessedLocalsIndices();
@@ -640,6 +640,6 @@ System.err.println("DEBUG: Please verify
*/
@Override
public String toString(){
- return "---\n"+subroutines.toString()+"\n---\n";
+ return "---\n"+subroutines+"\n---\n";
}
}