Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tacianosilva opened this issue Oct 19, 2015 · 2 comments
Assignees
Labels
Milestone

Comments

@tacianosilva
Copy link
Collaborator

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)
@catharinequintans
Copy link
Contributor

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:

  1. Update to asm-5.0.1 or higher; (recommeded) or
  2. 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.

@dengshiwei
Copy link

Asm5.1 also occurs this exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants