I'm pretty new to Java so bear with me. I've got a small bit of code that checks to see if a currentNode has a property of "fileReference" and returns its value. Except it doesn't seem like my null check is working because if nothing is in fileReference I get an error. If a reference to fileReference exists it works fine. Here is the error:
Caused by: javax.jcr.PathNotFoundException: fileReference
Here is my code:
if(currentNode != null){
NodeIterator checkNode = currentNode.getNodes();
while (checkNode.hasNext()) {
Node imageNode = checkNode.nextNode();
printNodeTitle = imageNode.getProperty("fileReference").getString();
}
}
public String getImageNode() { (printNodeTitle != null) ? return printNodeTitle : return ""; }
Any help is greatly appreciated!