Details

Description

The org.apache.openjpa.persistence.QueryImpl hashcode() implementation does not ensure that recursive invocations of hashcode() on object(s) in that method will not result in a NullPointerException. I.e., in this specific case it does not check whether _query is null, and it should since there is no guarantee that _query will always be non-null.

The org.apache.openjpa.persistence.QueryImpl hashcode() implementation does not ensure that recursive invocations of hashcode() on object(s) in that method will not result in a NullPointerException. I.e., in this specific case it does not check whether _query is null, and it should since there is no guarantee that _query will always be non-null.

Added check to hashcode() method to ensure that _query is not null prior to invoking its hashcode method.
Again, no testcase is provided in this case as it can be easily reproduced while debugging in Eclipse, or adding println() statements to QueryImpl instantiation of _query (which is what I did for expediency), which will invoke the toString() method, which will invoke the hashcode() method, which will cause a NullPointerException. If a testcase is preferred though please let me know.

Tim McConnell
added a comment - 21/Sep/09 23:45 Added check to hashcode() method to ensure that _query is not null prior to invoking its hashcode method.
Again, no testcase is provided in this case as it can be easily reproduced while debugging in Eclipse, or adding println() statements to QueryImpl instantiation of _query (which is what I did for expediency), which will invoke the toString() method, which will invoke the hashcode() method, which will cause a NullPointerException. If a testcase is preferred though please let me know.