private FileTime EPOCH = FileTime.fromMillis(0);
public JcrBasicfileAttributes(Node node) {
+ if (node == null)
+ throw new JcrFsException("Node underlying the attributes cannot be null");
this.node = node;
}
@Override
public boolean isDirectory() {
try {
- return node.isNodeType(NodeType.NT_FOLDER);
+ if (node.isNodeType(NodeType.NT_FOLDER))
+ return true;
+ // all other non file nodes
+ return !(node.isNodeType(NodeType.NT_FILE) || node.isNodeType(NodeType.NT_LINKED_FILE));
} catch (RepositoryException e) {
throw new JcrFsException("Cannot check if directory", e);
}
if (isRegularFile()) {
Binary binary = null;
try {
- binary = node.getNode(Property.JCR_DATA).getProperty(Property.JCR_CONTENT).getBinary();
+ binary = node.getNode(Property.JCR_CONTENT).getProperty(Property.JCR_DATA).getBinary();
return binary.getSize();
} catch (RepositoryException e) {
throw new JcrFsException("Cannot check size", e);