Calling empyt() on lazy PersistentSet throws NullPointerException
-----------------------------------------------------------------
Key: HHH-6029
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6029
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.2
Reporter: Robin Palotai
Priority: Minor
Calling empyt() on lazy PersistentSet throws NullPointerException. This is trivial, since
the method directly calls set.isEmpty, where set is null yet.
Normally one would not use the PersistentSet interface, just java.util.Set, therefore
calling empty() would not be possible.
But tools or apis may rely on using reflection to determine methods to call. In this case,
ScalaTest's ShouldMatcher has the syntax
someSet should be ('empty)
where based on the 'empty symbol, it looks for a method returning boolean either
called empty() or isEmpty(). One would expect that java.util.Set has isEmpty, but this is
preceded by PersistentSet's empty.
The workaround is trivial, use the 'Empty symbol instead.
As a solution, is it possible to add nullness check to empty() and invoke isEmpty()
behavior on null?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira