Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 361280 - JpaFacetActionPage.setUpRuntimeListener() throws class cast exception due to cast to ModifyFacetedProjectWizard
Summary: JpaFacetActionPage.setUpRuntimeListener() throws class cast exception due to ...
Status: RESOLVED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: JPA (show other bugs)
Version: 2.3.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.0.2   Edit
Assignee: Karen Butzke CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-18 13:25 EDT by Kevan Holdaway CLA
Modified: 2011-12-08 17:39 EST (History)
2 users (show)

See Also:
neil.hauge: review+


Attachments
proposed patch against 3.0 maintenance (1.70 KB, patch)
2011-11-01 17:22 EDT, Karen Butzke CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.