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

NPE in AbstractSQLQuery when no connection provided #22

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

NPE in AbstractSQLQuery when no connection provided #22

trisberg opened this issue Oct 5, 2011 · 1 comment
Labels

Comments

@trisberg
Copy link

@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)
...

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

Successfully merging a pull request may close this issue.

None yet
2 participants