How to iterate nodes one by one
I am using the below code to iterate the Node and update the property but it ends up loading the infinite loop.
resource -> launch.getResource().getChild("jcr:content")
Node node = resource.adaptTo(Node.class);
final NodeIterator it=node.getNodes();
do {
LOG.info("NODE PATH IS: "+node.getPath() );
node.setProperty(slingResourceType,conf/data/product/component);
node.getSession().save();
//it.nextNode();
}while(it.hasNext());
Is this the correct approach? It doesn't iterate from one node to other and print infinite time the log