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

ArrayIndexOutOfBoundsException -1 when using CollQuery with Jacoco #396

Closed
subes opened this issue Apr 14, 2013 · 3 comments
Closed

ArrayIndexOutOfBoundsException -1 when using CollQuery with Jacoco #396

subes opened this issue Apr 14, 2013 · 3 comments
Milestone

Comments

@subes
Copy link

@subes subes commented Apr 14, 2013

Hi,

the following testcase:

@Test
public void testQueryDslWithSimpleClass() {
    final List<CloneableKlasse> vos = new ArrayList<CloneableKlasse>();
    for (int i = 0; i < 5; i++) {
        final CloneableKlasse vo = new CloneableKlasse();
        vo.setAndereValue(i);
        vos.add(vo);
    }
    final CloneableKlasse vo = Alias.alias(CloneableKlasse.class, "vo");
    Assertions.assertThat(vo).isNotNull();
    final CollQuery query = new CollQuery();
    final EntityPathBase<CloneableKlasse> fromVo = Alias.$(vo);
    Assertions.assertThat(fromVo).isNotNull();
    query.from(fromVo, vos);
    query.where(Alias.$(vo.getAndereValue()).eq(1));
    final List<CloneableKlasse> result = query.list(Alias.$(vo));

    Assertions.assertThat(result).isNotNull();
    Assertions.assertThat(result.size()).isEqualTo(1);
    Assertions.assertThat(result.get(0).getAndereValue()).isEqualTo(1);
}

public static class CloneableKlasse implements Cloneable {
    private CloneableVO value;
    private Integer andereValue;

    public CloneableVO getValue() {
        return value;
    }

    public void setValue(final CloneableVO value) {
        this.value = value;
    }

    public Integer getAndereValue() {
        return andereValue;
    }

    public void setAndereValue(final Integer andereValue) {
        this.andereValue = andereValue;
    }

    @Override
    public Object clone() {
        try {
            return super.clone();
        } catch (final CloneNotSupportedException e) {
            throw Err.process(e);
        }
    }
}

causes the following exception:

java.lang.ArrayIndexOutOfBoundsException: -1
at com.mysema.codegen.MethodEvaluator.<init>(MethodEvaluator.java:39)
at com.mysema.codegen.AbstractEvaluatorFactory.createEvaluator(AbstractEvaluatorFactory.java:136)
at com.mysema.query.collections.DefaultEvaluatorFactory.createEvaluator(DefaultEvaluatorFactory.java:155)
at com.mysema.query.collections.DefaultQueryEngine.evaluateSingleSource(DefaultQueryEngine.java:174)
at com.mysema.query.collections.DefaultQueryEngine.list(DefaultQueryEngine.java:89)
at com.mysema.query.collections.AbstractCollQuery.list(AbstractCollQuery.java:176)
at de.invesdwin.common.beans.AValueObjectTest.testQueryDslWithSimpleClass(AValueObjectTest.java:89)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)

when I use Jacoco 0.6.2 to measure code coverage. Without Jacoco, the test runs fine. Maybe QueryDSL is not robust enough for bytecode instrumentation?

@timowest
Copy link
Member

@timowest timowest commented Apr 14, 2013

Which Querydsl version do you use?

@subes
Copy link
Author

@subes subes commented Apr 14, 2013

QueryDSL 3.1.0

timowest added a commit that referenced this issue Apr 14, 2013
timowest added a commit that referenced this issue Apr 14, 2013
@timowest
Copy link
Member

@timowest timowest commented Apr 16, 2013

Released in 3.1.1

@timowest timowest closed this Apr 16, 2013
@timowest timowest added this to the 3.1.1 milestone Apr 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants