It's all about the answers!

Ask a question

exception whilst performing load operation


Jeff Care (1.0k3833) | asked Mar 23 '11, 4:17 p.m.
retagged Dec 03 '13, 4:04 p.m. by David Lafreniere (4.8k7)
I'm writing some code to load a baseline set (i.e. snapshot). I gotten this to work already by creating a temporary workspace from the baseline set, but then I noticed com.ibm.team.filesystem.client.operations.ILoadOperation.requestLoad(ISandbox, IRelativeLocation, IBaselineConnection, Collection<extends>) and thought maybe I could skip having to create the workspace.

When I tried I got this exception:

java.lang.ClassCastException: $Proxy20 incompatible with com.ibm.team.scm.common.IFolder

at com.ibm.team.filesystem.client.internal.operations.LoadEvaluator.fetchCompleteItems(LoadEvaluator.java:286)
at com.ibm.team.filesystem.client.internal.operations.HierarchicalLoadEvaluator.fetchInfoForLoadEvaluation(HierarchicalLoadEvaluator.java:382)
at com.ibm.team.filesystem.client.internal.operations.HierarchicalLoadEvaluator.getElementsToLoad(HierarchicalLoadEvaluator.java:245)
at com.ibm.team.filesystem.client.internal.operations.HierarchicalLoadEvaluator.doEvaluation(HierarchicalLoadEvaluator.java:155)
at com.ibm.team.filesystem.client.internal.operations.LoadEvaluator.evaluateLoadRequests(LoadEvaluator.java:86)
at com.ibm.team.filesystem.client.internal.operations.LoadOperation.evaluate(LoadOperation.java:480)
at com.ibm.team.filesystem.client.internal.operations.LoadOperation.evaluateLoadRequests(LoadOperation.java:474)
at com.ibm.team.filesystem.client.internal.operations.LoadOperation$1.run(LoadOperation.java:623)
at com.ibm.team.filesystem.rcp.core.internal.resources.ResourceSharingManager$1.run(ResourceSharingManager.java:200)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
at com.ibm.team.filesystem.rcp.core.internal.resources.ResourceSharingManager.runWithinFileSystemLock(ResourceSharingManager.java:212)
at com.ibm.team.filesystem.client.internal.operations.FileSystemOperation.runWithinFileSystemLock(FileSystemOperation.java:164)
at com.ibm.team.filesystem.client.internal.operations.FileSystemOperation.runWithinFileSystemLock(FileSystemOperation.java:144)
at com.ibm.team.filesystem.client.internal.operations.LoadOperation.execute(LoadOperation.java:657)
at com.ibm.team.filesystem.client.internal.operations.FileSystemOperation.run(FileSystemOperation.java:89)
at com.ibm.mrbuild.rtc.applications.ExtractSnapshot.run(ExtractSnapshot.java:129)
at com.ibm.mrbuild.core.cli.Application.start(Application.java:110)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
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:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287


Here's the relevant code:

      final ILoadOperation loadOp = IOperationFactory.instance.getLoadOperation (new ExtractLoadDilemaHandler ());

loadOp.setDownloadListener (new DownloadListener ());

final IBaselineSet snapshot = fetch (_snapshotHandle);
for (final IBaselineHandle blHandle : (List<IBaselineHandle>) snapshot.getBaselines ()) {

final IBaselineConnection connection = getWorkspaceManager ().getBaselineConnection (blHandle, getMonitor ());

loadOp.requestLoad (sandbox,
null,
connection,
connection.configuration ().childEntriesForRoot (getMonitor ()).values ());
}

loadOp.run (getMonitor ());


Any ideas? I can go back to using a temporary workspace if need be but I would prefer not to.

Comments
Jeff Care commented Mar 29 '11, 11:36 a.m. | edited Oct 23 '13, 10:09 a.m.

Still waiting for an answer on this one.

One answer



permanent link
Jérôme RAULINE (2122) | answered Oct 23 '13, 3:24 a.m.
I got this exception once.
In the RTC component, in my case, I would normally find ONLY directories from Eclipse.
I had a user who managed to put a ".project" file at the root of the component. And my loads where failing this way.

So, I changed my code to detect thoses files which are not directories at the root of a component, and remove them from the files to load.

Collection<IVersionableHandle> filesToLoad = new ArrayList<IVersionableHandle>();

Map<String, IVersionableHandle> children = configuration.childEntriesForRoot(logger.getChild());
Collection<IVersionableHandle> handles = children.values();
if (CollectionUtils.isNotEmpty(handles)) {
	Iterator<IVersionableHandle> it = handles.iterator();
	while (it.hasNext()) {
		IVersionableHandle handle = it.next();
		if (handle instanceof IFolderHandle) {
			// OK
			filesToLoad.add(handle);
		} else {
			// Ignore this one and log a message
		}
	}
}
	


Comments
Tim Mok commented Oct 23 '13, 10:16 a.m.
JAZZ DEVELOPER

This is the correct thing to do. The load expects folders to load. Unfortunately, this isn't documented in the API because it technically isn't API. Whatever is available in the Javadoc is considered supported.

Your answer


Register or to post your answer.