dodie/scott

ArrayIndexOutOfBoundsException on instumentation

dodie opened this issue · 1 comments

dodie commented

In some environments the instrumentation fails with the following error:

java.lang.ArrayIndexOutOfBoundsException: -1
        at java.util.ArrayList.elementData(ArrayList.java:422)
        at java.util.ArrayList.get(ArrayList.java:435)
        at hu.advancedweb.scott.instrumentation.transformation.ScopeExtractorTestMethodVisitor.visitVarInsn(ScopeExtractorTestMethodVisitor.java:88)

Logging the events reveals that a single visitVarInsn happens before the first visitLabel, and this causes the error.

dodie commented

Because otherwise all visit events happen normally, it seems pretty safe to simply ignore this first visitvarIns in case it happens.