| Summary: | EntityManager.createNamedQuery().getParameters() throws NullPointerException | ||||||
|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Laird Nelson <ljnelson> | ||||
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P3 | CC: | david.minsky, michael.f.obrien | ||||
| Version: | unspecified | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | Macintosh | ||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 195551 [details]
Proposed fix, and testcase
Moved existing HashMap creation to be initial statement within control statement for lazy initialization.
Update to EJBQueryImpl getInternalParameters() - Move instantiation of 'parameters' HashMap to initial statement in lazy initialization control structure to prevent a NullPointerException occurring in the situation where a query has zero parameters. - Test emptyParametersForNonParameterizedNamedQueryTest added to JUnitJPQLParameterTestSuite Reviewed: Andrei Ilitchev Testing: Core LRG JPA LRG Checked into trunk (2.3) at r9377 The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
See Summary. Steps to reproduce (assert* methods from JUnit): EntityManagerFactory emf = ... // get an EMF EntityManager em = emf.createEntityManager(); assertNotNull(em); final Query q = em.createNamedQuery("someValidNamedQueryWithoutParameters"); assertNotNull(q); q.getParameters(); // observe NPE