[ 
https://issues.apache.org/jira/browse/OPENJPA-1707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12885640#action_12885640
 ] 

Rick Curtis commented on OPENJPA-1707:
--------------------------------------

The change that I committed to trunk utilizes the 
PCEnhancer.checkEnhancementLevel() method which was added in OPENJPA-151 but as 
far as I can tell was never used. I believe the intent of this field was to be 
used for changes to enhanced bytecode that may break serialization. Since this 
field was never utilized, I took the liberty to repurpose the method.

I added some magic to the build which now will write the revision of the 
PCEnhancer to META-INF/org.apache.openjpa.revision.properties. This value will 
be read into PCEnhancer in a static initializer which will be used for 
validation, and will be written to enhanced bytecode. This way we won't have to 
manually update the PCEnhancer.ENHANCER_VERSION every time a change is made to 
that file.

Currently I have it so that when trace IS NOT enabled, we will only log one 
message when a down level Entity is encountered. If trace is enabled we will 
log a message for each down level Entity that is encountered. 

I flipped back and forth on whether or not this should be an INFO or WARN 
message. I ended up going with an INFO message because for the time being any 
Entity that was enhanced prior to this commit will result in a message being 
logged. 

> A warning message should be logged when a down level enhanced Entity is 
> encountered.
> ------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1707
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1707
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: kernel
>    Affects Versions: 2.0.0, 2.1.0
>            Reporter: Rick Curtis
>            Assignee: Rick Curtis
>             Fix For: 2.1.0
>
>
> Currently when PCEnhancer is called to enhance an Entity that was previous 
> enhanced it will simply noop and move on. It could be smarter and use the 
> PersistenceCapable.pcGetEnhancementContractVersion to detect and when an 
> Entity has been enhanced with an older version of the enhancer and log a 
> warning message. A similar change would also need to be made to 
> PCClassFileTransformer.needsEnhance to perform the same sort of logic at 
> runtime.
> This would be particularly helpful in the case where an application was 
> compiled/enhanced/packaged and a bug was fixed in the enhancer but the 
> pre-packaged app still has the bad bytecode.

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

Reply via email to