Source:
<code>protected boolean createFolderNode(HierarchialElement el, ResourceResolver r) throws RepositoryException, PersistenceException { if (el == null || !el.isFolder()) { return false; } if (dryRunMode) { return true; } String folderPath = el.getNodePath(); String name = el.getName(); Session s = r.adaptTo(Session.class); if (s.nodeExists(folderPath)) { Node folderNode = s.getNode(folderPath); Node folderContentNode = folderNode.hasNode(JcrConstants.JCR_CONTENT) ? folderNode.getNode(JcrConstants.JCR_CONTENT) : null; if (folderPath.equals(jcrBasePath) || (null != folderContentNode && folderContentNode.hasProperty(JcrConstants.JCR_TITLE) && folderContentNode.getProperty(JcrConstants.JCR_TITLE).getString().equals(name))) { return false; } else { folderContentNode = folderNode.addNode(JcrConstants.JCR_CONTENT,JcrConstants.NT_UNSTRUCTURED); folderContentNode.setProperty(JcrConstants.JCR_TITLE, name); r.commit(); r.refresh(); return true; } } HierarchialElement parent = el.getParent(); String parentPath; <START> if (parent == null) { <END> parentPath = jcrBasePath; } else { parentPath = parent.getNodePath(); } if (!jcrBasePath.equals(parentPath)) { createFolderNode(parent, r); } Node child = s.getNode(parentPath).addNode(el.getNodeName(), DEFAULT_FOLDER_TYPE); trackDetailedActivity(el.getNodePath(), "Create Folder", "Create folder", 0L); incrementCount(createdFolders, 1L); if (!folderPath.equals(jcrBasePath)) { if(child.hasNode(JcrConstants.JCR_CONTENT)){ child.getNode(JcrConstants.JCR_CONTENT).setProperty(JcrConstants.JCR_TITLE, name); }else{ child.addNode(JcrConstants.JCR_CONTENT, JcrConstants.NT_UNSTRUCTURED).setProperty(JcrConstants.JCR_TITLE, name); } } r.commit(); r.refresh(); return true; }</code><technical_language>Refactor content of this "setTitle"</technical_language>

Target:
protected boolean createFolderNode(HierarchialElement el, ResourceResolver r) throws RepositoryException, PersistenceException { if (el == null || !el.isFolder()) { return false; } if (dryRunMode) { return true; } String folderPath = el.getNodePath(); String name = el.getName(); Session s = r.adaptTo(Session.class); if (s.nodeExists(folderPath)) { Node folderNode = s.getNode(folderPath); Node folderContentNode = folderNode.hasNode(JcrConstants.JCR_CONTENT) ? folderNode.getNode(JcrConstants.JCR_CONTENT) : null; if (folderNode.getPath().equals(jcrBasePath) || (null != folderContentNode && folderContentNode.hasProperty(JcrConstants.JCR_TITLE) && folderContentNode.getProperty(JcrConstants.JCR_TITLE).getString().equals(name))) { return false; } else { folderContentNode = folderNode.addNode(JcrConstants.JCR_CONTENT,JcrConstants.NT_UNSTRUCTURED); folderContentNode.setProperty(JcrConstants.JCR_TITLE, name); r.commit(); r.refresh(); return true; } } HierarchialElement parent = el.getParent(); String parentPath; if (parent == null) { parentPath = jcrBasePath; } else { parentPath = parent.getNodePath(); } if (!jcrBasePath.equals(parentPath)) { createFolderNode(parent, r); } Node child = s.getNode(parentPath).addNode(el.getNodeName(), DEFAULT_FOLDER_TYPE); trackDetailedActivity(el.getNodePath(), "Create Folder", "Create folder", 0L); setFolderTitle(child,folderPath,name); incrementCount(createdFolders, 1L); r.commit(); r.refresh(); return true; }