designwizard
designwizard copied to clipboard
Throws ArrayIndexOutOfBoundsException in ClassReader.readClass() when calling the method ASMExtractor.processClass()
The Design Wizard is throwing exception when trying to process classes. This occurs in some projects, perhaps with class with large number of rows.
The error occurred during the extraction of facts with DesignWizard from the project's GitHub cloned. In the directory resources/testFiles/ was made the project's clone.
git clone [email protected]:cliffmaury/angular-spring4-stack.git
So, in the directory angular-spring4-stack run mvn compile
. And call the DesignWizard constructor for extracting facts.
@Test(expected = ArrayIndexOutOfBoundsException.class)
public void test() {
DesignWizard dw;
String classpath;
try {
classpath = "resources/testFiles/angular-spring4-stack/target/classes";
dw = new DesignWizard(classpath);
} catch (IOException e) {
e.printStackTrace();
} catch (ArrayIndexOutOfBoundsException e) {
e.printStackTrace();
throw e;
}
}
The exception stack trace:
java.lang.ArrayIndexOutOfBoundsException: 43776
at org.objectweb.asm.ClassReader.readClass(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.designwizard.extractor.asm.ASMExtractor.processClass(ASMExtractor.java:114)
at org.designwizard.extractor.asm.ASMExtractor.processDir(ASMExtractor.java:64)
at org.designwizard.extractor.asm.ASMExtractor.processDir(ASMExtractor.java:72)
at org.designwizard.extractor.asm.ASMExtractor.processDir(ASMExtractor.java:72)
at org.designwizard.extractor.asm.ASMExtractor.processDir(ASMExtractor.java:72)
at org.designwizard.extractor.asm.ASMExtractor.processDir(ASMExtractor.java:72)
at org.designwizard.extractor.asm.ASMExtractor.processDir(ASMExtractor.java:72)
at org.designwizard.extractor.asm.ASMExtractor.processDir(ASMExtractor.java:72)
at org.designwizard.extractor.asm.ASMExtractor.processDir(ASMExtractor.java:72)
at org.designwizard.design.manager.DesignManager.extractFactsFromClassesDir(DesignManager.java:143)
at org.designwizard.design.manager.DesignManager.extractFacts(DesignManager.java:85)
at org.designwizard.api.DesignWizard.<init>(DesignWizard.java:57)
at br.edu.ufcg.splab.designtests.DesignWizardDecorator.<init>(DesignWizardDecorator.java:21)
at br.edu.ufcg.splab.designtests.RulesVerifier.processarProjeto(RulesVerifier.java:88)
at br.edu.ufcg.splab.designtests.RulesVerifier.processarArquivo(RulesVerifier.java:64)
at br.edu.ufcg.splab.designtests.RulesVerifier.main(RulesVerifier.java:41)
I read some problems related to this bug, and i figured out what is occuring, asm-3.1 doesn't support lambdas expression available in JDK 8.
For your problem there are two solutions:
- Update to asm-5.0.1 or higher; (recommeded) or
- Change the compiler of the angular-spring4-stack project to JDK 7 or JDK 6.
I think it's better to either update DesignWizard with the asm dependency or update the README file, adding the information that DesignWizard doesn't support project that uses lambda expressions.
Asm5.1 also occurs this exception.