Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.3.2.Final
    • Fix Version/s: 5.2.0.Beta1
    • Component/s: engine
    • Labels:
    • Environment:
      WebSphere 7 (without JPA 2 feature pack)
      Solaris 10 10/09 s10s_u8wos_08a SPARC
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      I was running into some classpath issues with my application which led me to look into the code of the DefaultTraversableResolver class in Hibenate Validator 4.3.2. Specifically, I was looking into the "detectJPA()" method, which doesn't seem to be able to differentiate between JPA 2 and 1 due to a missing "return" statement.

      Here's the code from lines 98 to 110:

            // try to invoke the method to make sure that we are dealing with a complete JPA2 implementation
            // unfortunately there are several incomplete implementations out there (see HV-374)
            try {
               Object persistence = run( NewInstance.action( persistenceClass, "persistence provider" ) );
               ReflectionHelper.getValue( persistenceUtilGetter, persistence );
            }
            catch ( Exception e ) {
               log.debugf(
                     "Unable to invoke %s.%s. Inconsistent JPA environment. All properties will per default be traversable.",
                     PERSISTENCE_CLASS_NAME,
                     PERSISTENCE_UTIL_METHOD
               );
            }
      

      Now, shouldn't this log.debug statement be followed by a return to abort the JPA detection process while concluding that a full-featured implementation of JPA2 is not available? But this is not the case, the detection proceeds assuming a 2.0 version. Here are the directly following lines:

            log.debugf(
                  "Found %s on classpath containing '%s'. Assuming JPA 2 environment. Trying to instantiate JPA aware TraversableResolver",
                  PERSISTENCE_CLASS_NAME,
                  PERSISTENCE_UTIL_METHOD
            );
      

      Naturally, when the conclusion is reached that JPA 2.0 is available the JPATraversableResolver is used.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: