Skip to content

Throws ArrayIndexOutOfBoundsException in ClassReader.readClass() when calling the method ASMExtractor.processClass() #36

@tacianosilva

Description

@tacianosilva

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)

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions