It's all about the answers!

Ask a question

Exception using ILoadFilter


Jeff Care (1.0k3833) | asked Mar 29 '11, 11:28 a.m.
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:

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.

Comments
Evan Hughes commented Jun 15 '12, 1:35 p.m.
JAZZ DEVELOPER

@carej You should raise a bug.

One answer



permanent link
Jérôme RAULINE (2122) | answered Jun 15 '12, 9:37 a.m.
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
Jeff Care commented Jun 15 '12, 10:00 a.m.

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.


Jérôme RAULINE commented Jun 15 '12, 10:12 a.m. | edited Jun 15 '12, 1:35 p.m.

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);


Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.