Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313405 - No validation message when a persistence.xml file version is unsupported
Summary: No validation message when a persistence.xml file version is unsupported
Status: VERIFIED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: General (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 2.3 RC2   Edit
Assignee: Paul Fullbright CLA
QA Contact:
URL:
Whiteboard: PMC_approved
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-18 13:29 EDT by Tim deBoer CLA
Modified: 2010-05-26 12:26 EDT (History)
3 users (show)

See Also:
david_williams: pmc_approved+
neil.hauge: pmc_approved? (raghunathan.srinivasan)
neil.hauge: pmc_approved? (naci.dai)
neil.hauge: pmc_approved? (deboer)
neil.hauge: pmc_approved? (neil.hauge)
neil.hauge: pmc_approved? (kaloyan)
neil.hauge: review+


Attachments
proposed patch (9.85 KB, patch)
2010-05-19 17:43 EDT, Paul Fullbright CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim deBoer CLA 2010-05-18 13:29:19 EDT
I accidentally had a JPA 2.0 persistence.xml in a project that was set to a JPA 1.0 provider. As a result, there were a couple IllegalArgumentExceptions in the .log from BaseJpaPlatformUi.getResourceUiDefinition() whenever I browsed to the JPA content node of the project.

I found my problem by debugging and fixed it via the provider setting. I'm not sure any user would have been able to figure this out, but at least we should not be throwing uncaught exceptions. Instead, can we either catch the exception or just log a short error message from this method?
Comment 1 Neil Hauge CLA 2010-05-18 17:42:34 EDT
We're looking at some minor changes that could enhance the usability here, since this isn't an unlikely error state to be in.  Trying to come up with a fix that would be suitable for RC2.  Thanks for reporting this Tim.
Comment 2 Paul Fullbright CLA 2010-05-19 17:39:09 EDT
Retitling this and splitting the error logging into another bug, as that is potentially destabilizing for RC2.  (see bug 313632)
Comment 3 Paul Fullbright CLA 2010-05-19 17:43:02 EDT
Created attachment 169233 [details]
proposed patch

Changed the validation for GenericRootContextNode to check for unsupported as well as unrecognizable (invalid) content.  
Placed the validation error on the file itself if the file exists.
Made similar changes for orm.xml validation.
Made notes in BaseJpaPlatformUI with respect to bug 313632.
Comment 4 Paul Fullbright CLA 2010-05-19 17:46:46 EDT
One further note.  The patch gives user feedback in the case he falls into this state, but we decided not to address the error logging issue.  The exception is caught and logged, so we don't have spare exceptions flying around.  But removing the exception required adding a null implementation of the ResourceUiProvider or various other null checking that could cause destability.
Comment 5 Karen Butzke CLA 2010-05-19 22:02:48 EDT
I've tested this patch, looks good to me
Comment 6 Neil Hauge CLA 2010-05-19 23:56:58 EDT
* Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such. 

This problem is likely to cause quite a bit of user confusion, possibly to the point where they may recreate a project to get out of the described error state.  It is also likely that users will encounter this problem as Tim did.

* Is there a work-around? If so, why do you believe the work-around is insufficient? 

Work around is to change the facet version and platform, but the user likely won't figure this out.

* How has the fix been tested? Is there a test case
 attached to the bugzilla record? Has a JUnit Test been added? 

Fix has been manually tested by Paul, Karen, and myself.

* Give a brief technical overview. Who has reviewed this fix? 

See comment 3.  Karen and I have reviewed the fix.

* What is the risk associated with this fix? 

Medium Low.  Generally we wouldn't want to add validation at this point in the release, but this seems to be a particularly nasty error state that is not currently detected in a meaningful way to the user.  Given this risk, extra testing has been performed.
Comment 7 David Williams CLA 2010-05-20 00:12:00 EDT
Well, if Tim did it, it must be easy to make this error :) ... so, I'm good.
Comment 8 Neil Hauge CLA 2010-05-20 07:42:37 EDT
Patch committed and released last night.
Comment 9 Paul Fullbright CLA 2010-05-26 12:26:59 EDT
verified in RC2