NPE in AbstractSQLQuery when no connection provided #22

Closed
trisberg opened this Issue Oct 5, 2011 · 1 comment

Comments

Projects
None yet
2 participants
@trisberg

trisberg commented Oct 5, 2011

If I create an SQLQuery without a connection like this

SQLQuery query = new SQLQueryImpl(new PostgresTemplates());

and later forget to clone with a connection I get and NPE when calling uniqueResults. Could you add a null check and throw a more informative exception alerting the user to the problem.

The exception I see is:
Exception in thread "main" java.lang.NullPointerException
at com.mysema.query.sql.AbstractSQLQuery.iterateSingle(AbstractSQLQuery.java:434)
at com.mysema.query.sql.AbstractSQLQuery.iterate(AbstractSQLQuery.java:367)
at com.mysema.query.sql.AbstractSQLQuery.iterate(AbstractSQLQuery.java:360)
at com.mysema.query.sql.AbstractSQLQuery.uniqueResult(AbstractSQLQuery.java:576)
...

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 23, 2011

Member

Released in 2.2.4

Member

timowest commented Oct 23, 2011

Released in 2.2.4

@timowest timowest closed this Oct 23, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment