Community
Participate
Working Groups
If the Remote Search view is open and you do a copy/paste you will get a ClassCastException. Log file contains: org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.ClassCastException: java.util.ArrayList cannot be cast to org.eclipse.core.runtime.IAdaptable) at org.eclipse.swt.SWT.error(SWT.java:3563) at org.eclipse.swt.SWT.error(SWT.java:3481) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:126) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3659) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3296) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:504) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443) at org.eclipse.equinox.launcher.Main.run(Main.java:1169) Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to org.eclipse.core.runtime.IAdaptable at org.eclipse.rse.internal.ui.view.SystemTableTreeView.getRemoteObjectIdentifier(SystemTableTreeView.java:1450) at org.eclipse.rse.internal.ui.view.SystemTableTreeView.getRemoteResourceAbsoluteName(SystemTableTreeView.java:1062) at org.eclipse.rse.internal.ui.view.SystemTableTreeView.systemRemoteResourceChanged(SystemTableTreeView.java:905) at org.eclipse.rse.internal.ui.view.search.SystemSearchTableView.systemRemoteResourceChanged(SystemSearchTableView.java:259) at org.eclipse.rse.internal.core.model.SystemRemoteChangeEventManager.notify(SystemRemoteChangeEventManager.java:69) at org.eclipse.rse.ui.internal.model.SystemRegistry.fireRemoteResourceChangeEvent(SystemRegistry.java:2767) at org.eclipse.rse.internal.ui.view.SystemDNDTransferRunnable$RefreshJob.runInUIThread(SystemDNDTransferRunnable.java:659) at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:94) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123) ... 22 more -----------Enter bugs above this line----------- TM 2.0.1 Testing installation : eclipse-SDK-3.3 RSE install : RSE I20070713-0605 java.runtime : Sun 1.5.0_06-b05 os.name: : Windows XP 5.1, Service Pack 2 ------------------------------------------------
Kevin you've been most exposed to search, could you investigate?
Created attachment 74390 [details] Changed mentions of Vector to List so ArrayList is handled. Another case where trying to cast an ArrayList to Vector. Changed it to List's. Also changed getRemoteResourceAbsoluteName(Object) to use an ISystemViewElementAdapter instead of IRemoteObjectIdentifier. Legal Message: I, Kevin Doyle, declare that I developed attached code from scratch, without referencing any 3rd party materials except material licensed under the EPL. I am authorized by my employer, IBM Canada Ltd. to make this contribution under the EPL.
I've committed this to cvs.
(In reply to comment #2) > Another case where trying to cast an ArrayList to Vector. Have you ever analyzed why we keep getting ArrayList passed into methods that expect a Vector? - I'm all in favor of moving away from Vector to the more general List interface, but in the light of getting bugs fixed for 2.0.1 we should also fix the source of the issue, e.g. SystemCommonDeleteAction which fires remoteChangedEvents with an ArrayList. We should also consider updating API docs to read what our API really expects -- ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED talks about "List" being expected although ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE talks about "Vector" being expected. This is inconsistent, and for the sake of being API compatible in 2.0.1 I'd like to see us fire events with the less general "Vector" but expect events with the more general "List". With respect to the API docs, I'm not sure but there might even already exist a bug report asking for this to be sanitized, and if it is not yet there it should be created (I'm in favor of moving to "List" everywhere). > Also changed getRemoteResourceAbsoluteName(Object) to use an > ISystemViewElementAdapter instead of IRemoteObjectIdentifier. Why? This change makes no sense. ISystemViewElementAdapter is a subclass of IRemoteObjectIdentifier, and by moving to a less general interface you're essentially breaking API (somebody who registers an adapter that's just an IRemoteObjectIdentifier but not an ISystemViewElementAdapter would no longer get his adapter called. Reopening to get the previous version of getting the adapter restored, and getting the internal ArrayList replaced by a Vector in SystemCommonDeleteAction.
I do not see a bug open for fixing up the API docs in regards to what is expected. Though I do remember talking about Lists instead of Vector's, but maybe that was for the Validator's only. In regards to making the change to ISystemViewElementAdapter. I think I understood this wrong before. Since the name isn't view specific and ISystemViewElementAdapter is a subclass of IRemoteObjectIdentifier it would be okay to use IRemoteObjectIdentifier for getting the absolute name, but for anything relating to the view itself we should be using ISystemViewElementAdapter. SystemView, SystemScratchpadView, and SystemTableView all use ISystemViewElementAdapter for getRemoteResourceAbsoluteName(). I'm not sure why we are doing it differently in this case. It's weird seeing things done differently in different spots. Though looking back at this I noticed that the code for getting an IRemoteObjectIdentifier adapter doesn't work. It returns null. return (IRemoteObjectIdentifier) ((IAdaptable)o).getAdapter(IRemoteObjectIdentifier.class); Also SystemView has a protected getRemoteObjectIdentifier(Object) method that is never even used. With that same line of code.
(In reply to comment #5) > SystemView, SystemScratchpadView, and SystemTableView all use > ISystemViewElementAdapter for getRemoteResourceAbsoluteName(). I'm not sure > why we are doing it differently in this case. It's weird seeing things done > differently in different spots. That's right. > Though looking back at this I noticed that the code for getting an > IRemoteObjectIdentifier adapter doesn't work. It returns null. I now see why -- the plugin.xml for files.ui has: <!-- TODO Check: These are not in the adapter factories getAdapterList() Although the adapter implements them <adapter type="org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier"/> --> The comments would need to be removed, and the factory class updated, to make it work. I want to think a little bit more about this, but now that it didn't ever work your change certainly is not a regression. Let's keep your code in the repository for now. > Also SystemView has a protected getRemoteObjectIdentifier(Object) method that > is never even used. With that same line of code. We should mark that deprecated right away since it does not work in 2.0.1 as of today.
Created attachment 74471 [details] SystemCommonDeleteAction now pass's Vector instead of ArrayList This patch updates SystemCommonDeleteAction, so Vector's are passed instead of ArrayList's. Also went through all class's implementing ISystemRemoteChangeListener to make sure they used the more general List. SystemMonitorViewPart was the only one that wasn't and it's updated in the patch. Legal Message: I, Kevin Doyle, declare that I developed attached code from scratch, without referencing any 3rd party materials except material licensed under the EPL. I am authorized by my employer, IBM Canada Ltd. to make this contribution under the EPL.
Created attachment 75681 [details] Updated to deprecate getRemoteObjectIdentifier Forgot to deprecate getRemoteObjectIdentifier in the previous patch. Updated patch deprecates it. Legal Message: I, Kevin Doyle, declare that I developed attached code from scratch, without referencing any 3rd party materials except material licensed under the EPL. I am authorized by my employer, IBM Canada Ltd. to make this contribution under the EPL.
The patch looks good.
You forgot to update the Contributor list in SystemView.java. Please add it in. Thanks.
Created attachment 75712 [details] Added Contributer Line Legal Message: I, Kevin Doyle, declare that I developed attached code from scratch, without referencing any 3rd party materials except material licensed under the EPL. I am authorized by my employer, IBM Canada Ltd. to make this contribution under the EPL.
I've committed the patch.
Verified fixed in 2.0.1 RC1.