Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 361280

Summary: JpaFacetActionPage.setUpRuntimeListener() throws class cast exception due to cast to ModifyFacetedProjectWizard
Product: [WebTools] Dali JPA Tools Reporter: Kevan Holdaway <kholdaway>
Component: JPAAssignee: Karen Butzke <karenfbutzke>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: karenfbutzke, neil.hauge
Version: 2.3.4Flags: neil.hauge: review+
Target Milestone: 3.0.2   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
proposed patch against 3.0 maintenance none

Description Kevan Holdaway CLA 2011-10-18 13:25:00 EDT
Build Identifier: Version: 2.3.4.v201104192310-7N7UF77FD3wTgcVbmmf0cT Build id: 20100915173744

org.eclipse.jpt.ui.internal.wizards.JpaFacetActionPage.setUpRuntimeListener()throws a class cast exception due to its cast to ModifyFacetedProjectWizard.  IWizardPage.getWizard() should check for instanceof before making a cast.  In our scenario this wizard page is not in the ModifyFacetedProjectWizard.  Ideally you would get this property out of the datamodel using code like this:

		wc = (IFacetedProjectWorkingCopy) getDataModel().getProperty(
				IFacetDataModelProperties.FACETED_PROJECT_WORKING_COPY);
		if (wc != null) {
			// must do it manually the first time
			model.setProperty(RUNTIME, wc.getPrimaryRuntime());
			runtimeListener = new IFacetedProjectListener() {
				public void handleEvent(final IFacetedProjectEvent event) {
					model.setProperty(RUNTIME, wc.getPrimaryRuntime());
				}
			};
			wc.addListener(runtimeListener, IFacetedProjectEvent.Type.PRIMARY_RUNTIME_CHANGED);
		}


The working copy is in the datamodel and it would avoid the class cast issue when run in a wizard that is not that class.


Reproducible: Always
Comment 1 Karen Butzke CLA 2011-11-01 17:22:00 EDT
Created attachment 206299 [details]
proposed patch against 3.0 maintenance
Comment 2 Karen Butzke CLA 2011-11-01 17:22:42 EDT
I've fixed this in HEAD, seems like a good candidate for 3.0.2
Comment 3 Karen Butzke CLA 2011-11-01 17:46:08 EDT
fix checked in to maintenance
Comment 4 Kevan Holdaway CLA 2011-12-08 17:20:21 EST
Any chance this could be backported to 2.3.x?  We are seeing the problem in 2.3.3.
Comment 5 Neil Hauge CLA 2011-12-08 17:39:17 EST
We would just need a stream to do the release.  I'm not sure if there is going to be another maintenance build on that stream, but I would guess there is.  The other option would be to do a custom patch on top of 2.3.4.  I'll look into it.  Remind me if you haven't heard anything in a week.