- Node child = result.getNodes().nextNode();
- if (child == null || !child.isNodeType("nt:resource"))
- throw new ArgeoException(
- "ERROR: IN the current implemented model, nt:file file node must have one and only one child of the nt:ressource, where actual data is stored");
+ // Sanity checks
+ if (result == null)
+ throw new ArgeoException("File node not found for ID" + fileId);
+
+ // Ensure that the node have the correct type.
+ if (!result.isNodeType(NodeType.NT_FILE))
+ throw new ArgeoException(
+ "Cannot open file children Node that are not of '"
+ + NodeType.NT_RESOURCE + "' type.");
+
+ // Get the usefull part of the Node
+ Node child = result.getNodes().nextNode();
+ if (child == null || !child.isNodeType(NodeType.NT_RESOURCE))
+ throw new ArgeoException(
+ "ERROR: IN the current implemented model, '"
+ + NodeType.NT_FILE
+ + "' file node must have one and only one child of the nt:ressource, where actual data is stored");
+ return child;