Delete resource with references to non-existing resource #98
-
|
Hi, I'm trying to delete a resource with references to a non-existing (external) resource. It tries to find that resource on the file system. I get the following stacktrace: How can I tell the ResourceSet of the transaction not to load external resources? Code: CDOTransaction transaction = session.openTransaction();
CDOResource resource = transaction.getResource(node.getPath());
resource.delete(null);
transaction.commit();I also tried |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
I fixed this by opening a transaction with the following self-defined ResourceSet: public class NonExternalResourceSetImpl extends ResourceSetImpl {
public NonExternalResourceSetImpl() {
super();
}
@Override
public Resource getResource(URI uri, boolean loadOnDemand) {
try {
Resource resource = super.getResource(uri, loadOnDemand);
return resource;
} catch (Exception e) {
System.out.println("getResource() for " + uri);
Resource resource = super.getResource(uri, false);
System.err.println("Cannot find " + uri + ", ignore loading this resource!");
return resource;
}
}
}It sets |
Beta Was this translation helpful? Give feedback.
-
|
Hi Ewoud, Sorry for the late reply. If I'm not mistaken, I think you are on the right track. I#m going to close this discussion. Please reopen if you think there's something to do in CDO... |
Beta Was this translation helpful? Give feedback.
I fixed this by opening a transaction with the following self-defined ResourceSet:
It sets
loadOnDemandto false for files that cannot be found, effect…