|| parent.getPrimaryNodeType().isNodeType(NodeType.NT_LINKED_FILE))
throw new JcrFsException(path + " parent is a file");
- node = parent.addNode(path.getFileName().toString(), NodeType.NT_FILE);
+ String fileName = path.getFileName().toString();
+ fileName = Text.escapeIllegalJcrChars(fileName);
+ node = parent.addNode(fileName, NodeType.NT_FILE);
node.addMixin(NodeType.MIX_CREATED);
node.addMixin(NodeType.MIX_LAST_MODIFIED);
}
if (parent.getPrimaryNodeType().isNodeType(NodeType.NT_FILE)
|| parent.getPrimaryNodeType().isNodeType(NodeType.NT_LINKED_FILE))
throw new JcrFsException(dir + " parent is a file");
- node = parent.addNode(dir.getFileName().toString(), NodeType.NT_FOLDER);
+ String fileName = dir.getFileName().toString();
+ fileName = Text.escapeIllegalJcrChars(fileName);
+ node = parent.addNode(fileName, NodeType.NT_FOLDER);
node.addMixin(NodeType.MIX_CREATED);
node.addMixin(NodeType.MIX_LAST_MODIFIED);
node.getSession().save();
try {
// TODO check if assignable
Node node = toNode(path);
+ if(node==null) {
+ throw new JcrFsException("JCR node not found for "+path);
+ }
return (A) new JcrBasicfileAttributes(node);
} catch (RepositoryException e) {
throw new JcrFsException("Cannot read basic attributes of " + path, e);
return ((JcrPath) path).getNode();
}
+ /**
+ * To be overriden in order to support the ~ path, with an implementation
+ * specific concept of user home.
+ *
+ * @return null by default
+ */
+ public Node getUserHome(Session session) {
+ return null;
+ }
}