- try {
- Session session = ((JcrFileSystem) path.getFileSystem()).getSession();
- if (!session.itemExists(path.toString()))
- throw new NoSuchFileException(path + " does not exist");
- // TODO check access via JCR api
- } catch (RepositoryException e) {
- throw new IOException("Cannot delete " + path, e);
- }
+ Node node = toNode(path);
+ if (node == null)
+ throw new NoSuchFileException(path + " does not exist");
+ // TODO check access via JCR api