Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 1.0.0, 1.0.1, 1.1.0
    • Fix Version/s: 1.0.1, 1.1.0
    • Component/s: kernel
    • Labels:
      None

      Description

      From the parent Issue...

      o I think the "unsupported" option for the openjpa.RuntimeUnenhancedClasses property is hiding a more meaningful message. For example, if I run with "warn" option, I get the warning message (runtime-optimization-disabled) and a null is returned. In this scenario, the processing continues and then I get this message:

      <openjpa-1.1.0-SNAPSHOT-r420667:573398M nonfatal user error>
      org.apache.openjpa.persistence.ArgumentException: Attempt to cast instance "..." to
      PersistenceCapable failed. Ensure that it has been enhanced.

      But, if I run with the "unsupported" option, then the only message I get is the (runtime-optimization-disabled) exception. Although it still indicates an error exists, it's not as clear as the "PersistenceCapable" message. Not sure if we should re-think the "warn" vs "unsupported" argument, or maybe just an update to the message text for (runtime-optimization-disabled).

        Activity

        Hide
        Kevin Sutter added a comment -

        Invalid Issue – working as designed.

        Show
        Kevin Sutter added a comment - Invalid Issue – working as designed.
        Hide
        Kevin Sutter added a comment -

        After doing more experimentation and reading through the javadoc for this property, I think this is working as designed. The "unsupported" should throw the exception and "warn" should log the message and return null. This will eventually result in the other message getting logged as well.

        Will close shortly.

        Show
        Kevin Sutter added a comment - After doing more experimentation and reading through the javadoc for this property, I think this is working as designed. The "unsupported" should throw the exception and "warn" should log the message and return null. This will eventually result in the other message getting logged as well. Will close shortly.
        Hide
        Kevin Sutter added a comment -

        From ManagedClassSubClasser.prepareUnenhancedClasses():

        if (conf.getRuntimeUnenhancedClassesConstant()
        != RuntimeUnenhancedClasssesModes.SUPPORTED) {
        Collection unenhanced = new ArrayList();
        for (Class cls : classes)
        if (!PersistenceCapable.class.isAssignableFrom(cls))
        unenhanced.add(cls);
        if (unenhanced.size() > 0)

        { Message msg = _loc.get("runtime-optimization-disabled", unenhanced); if (conf.getRuntimeUnenhancedClassesConstant() == RuntimeUnenhancedClasssesModes.WARN) log.warn(msg); else throw new UserException(msg); }

        return null;
        }

        Once we determine that we are not running with RuntimeUnenhancedClasses=supported, we drop into this code block. Once we enter this code block, the only exits are the UserException (RuntimeUnenhancedClassses=unsupported) and returning null (RuntimeUnenhancedClassses=warn). If we are in the "warn" path, we still get the same error message as the "unsupported" path, but we also get the benefit of getting an even more meaningful message later because we return null for this method invocation. The base message for both cases is this:

        runtime-optimization-disabled: This configuration disallows runtime \
        optimization, but the following listed types were not enhanced at build \
        time or at class load time with a javaagent: "

        {0}

        ".

        The additional message for the "warn" path was mentioned earlier in the Issue:

        <openjpa-1.1.0-SNAPSHOT-r420667:573398M nonfatal user error>
        org.apache.openjpa.persistence.ArgumentException: Attempt to cast instance "..." to
        PersistenceCapable failed. Ensure that it has been enhanced.

        So, my question is whether there is a difference between "warn" and "unsupported". Neither option will get you to Patrick's runtime enhancement.

        Proposal:

        Change "unsupported" to log the runtime-optimization-disabled message and return null (don't throw the exception). This will allow the processing to continue until we get the "PersistenceCapable failed" message.

        Change "warn" to only log the runtime-optimization-disabled message and continue processing through Patrick's runtime enhancement.

        I think this is more inline with what we wanted to do with these options. Comments?

        Kevin

        Show
        Kevin Sutter added a comment - From ManagedClassSubClasser.prepareUnenhancedClasses(): if (conf.getRuntimeUnenhancedClassesConstant() != RuntimeUnenhancedClasssesModes.SUPPORTED) { Collection unenhanced = new ArrayList(); for (Class cls : classes) if (!PersistenceCapable.class.isAssignableFrom(cls)) unenhanced.add(cls); if (unenhanced.size() > 0) { Message msg = _loc.get("runtime-optimization-disabled", unenhanced); if (conf.getRuntimeUnenhancedClassesConstant() == RuntimeUnenhancedClasssesModes.WARN) log.warn(msg); else throw new UserException(msg); } return null; } Once we determine that we are not running with RuntimeUnenhancedClasses=supported, we drop into this code block. Once we enter this code block, the only exits are the UserException (RuntimeUnenhancedClassses=unsupported) and returning null (RuntimeUnenhancedClassses=warn). If we are in the "warn" path, we still get the same error message as the "unsupported" path, but we also get the benefit of getting an even more meaningful message later because we return null for this method invocation. The base message for both cases is this: runtime-optimization-disabled: This configuration disallows runtime \ optimization, but the following listed types were not enhanced at build \ time or at class load time with a javaagent: " {0} ". The additional message for the "warn" path was mentioned earlier in the Issue: <openjpa-1.1.0-SNAPSHOT-r420667:573398M nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Attempt to cast instance "..." to PersistenceCapable failed. Ensure that it has been enhanced. So, my question is whether there is a difference between "warn" and "unsupported". Neither option will get you to Patrick's runtime enhancement. Proposal: Change "unsupported" to log the runtime-optimization-disabled message and return null (don't throw the exception). This will allow the processing to continue until we get the "PersistenceCapable failed" message. Change "warn" to only log the runtime-optimization-disabled message and continue processing through Patrick's runtime enhancement. I think this is more inline with what we wanted to do with these options. Comments? Kevin

          People

          • Assignee:
            Kevin Sutter
            Reporter:
            Kevin Sutter
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development