Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0.3, 1.1.0, 1.2.1
    • Fix Version/s: 1.3.0, 2.0.0-M3
    • Component/s: jpa
    • Labels:
      None
    • Patch Info:
      Patch Available
    1. OPENJPA-1301.patch
      1.0 kB
      Tim McConnell

      Activity

      Hide
      Donald Woods added a comment -

      committed to trunk and 1.3.x

      Show
      Donald Woods added a comment - committed to trunk and 1.3.x
      Hide
      Tim McConnell added a comment -

      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 update.

      Show
      Tim McConnell added a comment - 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 update.

        People

        • Assignee:
          Tim McConnell
          Reporter:
          Tim McConnell
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved:

            Development