Bug 412996 - ClassCastException in "Enter Anomaly Detail" dialog
Summary: ClassCastException in "Enter Anomaly Detail" dialog
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 0.20   Edit
Assignee: Francois Chouinard CLA
QA Contact:
URL:
Whiteboard:
Keywords: plan
Depends on:
Blocks:
 
Reported: 2013-07-15 13:28 EDT by Francois Chouinard CLA
Modified: 2013-07-17 13:04 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francois Chouinard CLA 2013-07-15 13:28:29 EDT
When entering an anomaly detail to specify a rule violation, the OK button is enabled but doesn't work. One can only cancel the dialog and then the system falls in an unstable state.

- Anomaly properties are disabled
- All context menus of Review Group, Reviews, Rule Sets, etc are gone
- All Review Navigator are greyed out *except* Refresh Data
- Need to refresh the Review Navigator (Refresh Data button) to reset things

To reproduce:

- Select an anomaly
- In Property View (Detailed tab), expand "Anomaly Details"
- Select Rule ID "Update..."
- In "Enter Anomaly Details", expand "Extra Parameters"
- Select a rule violation
- Click "OK"

Nothing happens. You can only "Cancel" and then the system became unstable.

Exception Stack Trace:

java.lang.ClassCastException: org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIRuleViolation cannot be cast to org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIRule
	at org.eclipse.mylyn.reviews.r4e.ui.internal.dialogs.NewAnomalyInputDialog.buttonPressed(NewAnomalyInputDialog.java:286)
	at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:628)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1392)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3742)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3363)
	at org.eclipse.mylyn.reviews.r4e.ui.internal.dialogs.NewAnomalyInputDialog.pumpMessages(NewAnomalyInputDialog.java:926)
	at org.eclipse.mylyn.reviews.r4e.ui.internal.dialogs.NewAnomalyInputDialog.open(NewAnomalyInputDialog.java:915)
	at org.eclipse.mylyn.reviews.r4e.ui.internal.properties.tabbed.AnomalyTabPropertySection$7.handleEvent(AnomalyTabPropertySection.java:624)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1392)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3742)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3363)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
Comment 1 Francois Chouinard CLA 2013-07-15 16:23:21 EDT
The ClassCastException occurred because the selected rule violation wasn't a really a rule but a rule *class*. No check is performed before casting hence the exception.

A simple solution would be to perform a class check (instanceof) before casting. If the type is wrong then just skip the whole operation.
Comment 2 Jacques Bouthillier CLA 2013-07-16 08:43:52 EDT
This casting exception occurs only in UNIX environment, does not happen in Window environment. 
We still need to fix it.
Comment 3 Francois Chouinard CLA 2013-07-16 14:08:17 EDT
Added the missing class check before the cast.

Fixed in commit 997e1818e159b301d24d9309e3bbb1da855013d9.
Comment 4 Francois Chouinard CLA 2013-07-17 13:04:39 EDT
Fixed in commit 997e1818e159b301d24d9309e3bbb1da855013d9