Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
When verifying a class, the verifier looks for this class and its dependencies in a classpath configured for this verification. If the classes of the verifier itself are not in this classpath, then an error can occur.
The causes is the use of the internal class org.apache.bcel.verifier.structurals.GenericArray to mock the array class when a method invokation is done on an array. If the class GenericArray is not available in the classpath of the verifier class, we get the following error:
Exception in thread "main" org.apache.bcel.verifier.exc.AssertionViolatedException: INTERNAL ERROR: Some RuntimeException occured while verify()ing class 'org.apache.bcel.verifier.tests.TestArray01', method 'public static void test1()'. Original RuntimeException's stack trace:
—
org.apache.bcel.verifier.exc.AssertionViolatedException: INTERNAL ERROR: Missing class: java.lang.ClassNotFoundException: Exception while looking for class org.apache.bcel.verifier.structurals.GenericArray: java.io.IOException: Couldn't find: org/apache/bcel/verifier/structurals/GenericArray.class
at org.apache.bcel.verifier.structurals.InstConstraintVisitor.visitINVOKEVIRTUAL(InstConstraintVisitor.java:2059)
…
Here is a simple example of code that raises this exception:
public static void test1(){ String[] a = new String[4]; a.equals(null); }