Exception using ILoadFilter
I have a simple ILoadFilter implemention (see below) that I'm trying to use with an ILoadOperation. Here's the exception that's being raised when I try to use it:
Here's the filter code:
Any suggestions on what I can do to work around this? Seems like a bug to me.
java.lang.ClassCastException: com.ibm.mrbuild.rtc.applications.ExtractSnapshot$ExtractFilter incompatible with com.ibm.team.filesystem.client.internal.load.LoadFilter
at com.ibm.team.filesystem.client.internal.load.LoadFilter.toBytes(LoadFilter.java:36)
at com.ibm.team.filesystem.client.internal.load.MergeLoadMutator.getClientDataForSharingDescriptor(MergeLoadMutator.java:785)
at com.ibm.team.filesystem.client.internal.load.MergeLoadMutator.createNewFolder(MergeLoadMutator.java:1391)
at com.ibm.team.filesystem.rcp.core.internal.resources.EclipseWorkspaceMergeLoadMutator.createNewFolder(EclipseWorkspaceMergeLoadMutator.java:94)
at com.ibm.team.filesystem.client.internal.load.MergeLoadMutator.load(MergeLoadMutator.java:528)
at com.ibm.team.filesystem.client.internal.load.MergeLoadMutator.execute(MergeLoadMutator.java:285)
at com.ibm.team.filesystem.client.internal.operations.FileSystemOperation.run(FileSystemOperation.java:89)
at com.ibm.team.filesystem.client.internal.operations.LoadOperation.load(LoadOperation.java:972)
at com.ibm.team.filesystem.client.internal.operations.LoadOperation$1.run(LoadOperation.java:626)
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:158)
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 filter code:
private static class ExtractFilter implements ILoadFilter {
@Override
public boolean include (final String name) {
System.out.printf ("filter %1$s%n", name);
return true;
}
}
Any suggestions on what I can do to work around this? Seems like a bug to me.
One answer
Hi,
Thanks to the code, you can't "simply" implement the java interface :-(
You can do it this way :
ILoadFilter myFilter = new LoadFilter(new String[0]) {
public boolean include(String name) {
// Your code here
return false;
}
};
Comments
I can see how that would work but the LoadFilter class that you refer to is internal. I still say this is a bug: the interface specifies ILoadFilter so ANY ILoadFilter should work.
Off course it's a bug, I totally agree.
There is another internal class I use to load a workspace on disk from API : com.ibm.team.filesystem.client.internal.PathLocation
org.eclipse.core.runtime.IPath rootPath = ....
ISandbox sandbox = FileSystemCore.getSharingManager().getSandbox(new PathLocation(rootPath), false);
Comments
Evan Hughes
JAZZ DEVELOPER Jun 15 '12, 1:35 p.m.@carej You should raise a bug.