final Node parentNode = current;
try {
// adding the node could cause an exception
// for example if another thread tries to
// create the node "at the same time"
current = parentNode.addNode(names[i], NT_FOLDER);
session.save();
} catch (final RepositoryException re) {
// let's first refresh the session
// we don't catch an exception here, because if
// session refresh fails, we might have a serious problem!