openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim McConnell (JIRA)" <>
Subject [jira] Commented: (OPENJPA-1301) EntityManagerFactoryImpl
Date Tue, 15 Sep 2009 03:07:57 GMT


Tim McConnell commented on OPENJPA-1301:

There are a couple problems with the implementation of the hashcode() and equals() methods
in EntityManagerFactoryImpl. First, neither checks whether _factory is null, which can and
does cause NullPointException(s). Second, it's not usually good form to use instanceof in
the equals() method in a class that is not "final" as it can easily violate the symmetry requirement
of equivalence. 

No testcase is provided in this case as it can be easily reproduced in while debugging in
Eclipse, interrogating an instance of EntityManagerFactoryImpl prior to the instantiation
of _factory, which will invoke the toString() method, which will invoke the hashcode() method,
which will cause a NullPointerException. 

A cursory check has turned up some other classes with similar implementation problems that
I'll correct with separate patches as I do not feel comfortable doing it all in a single mass

> EntityManagerFactoryImpl
> ------------------------
>                 Key: OPENJPA-1301
>                 URL:
>             Project: OpenJPA
>          Issue Type: Sub-task
>            Reporter: Tim McConnell
>            Assignee: Tim McConnell
>            Priority: Minor
>         Attachments: OPENJPA-1301.patch

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message