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

NullPointerException when using MockConnection with DSLContext.transaction() #5017

Closed
lukaseder opened this issue Jan 31, 2016 · 0 comments
Closed

Comments

@lukaseder
Copy link
Member

The following logic throws a NPE:

DSLContext e = DSL.using(new MockConnection(new EmptyResult()), SQLDialect.H2);

e.transaction(new TransactionalRunnable() {

    @Override
    public void run(Configuration configuration) throws Exception {
        Result<Record> result = DSL.using(configuration).fetch("select ?, ? from dual", 1, 2);

        assertEquals(0, result.size());
        assertEquals(3, result.fields().length);
        for (int i = 0; i < 3; i++) {
            assertEquals(TABLE1.field(i).getName(), result.field(i).getName());
            assertEquals(TABLE1.field(i).getType(), result.field(i).getType());
        }
    }
});

The exception being:

java.lang.NullPointerException
    at java.util.ArrayDeque.addFirst(ArrayDeque.java:228)
    at java.util.ArrayDeque.push(ArrayDeque.java:503)
    at org.jooq.impl.DefaultTransactionProvider.begin(DefaultTransactionProvider.java:155)
    at org.jooq.impl.DefaultDSLContext.transactionResult(DefaultDSLContext.java:363)
    at org.jooq.impl.DefaultDSLContext.transaction(DefaultDSLContext.java:392)
    at org.jooq.test.MockTest.testEmptyResultWithTransaction(MockTest.java:135)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant