Source:
<code>public void start(final Environment env) throws IOException { startThread(new CommandRunnable() { @Override public void run() throws Exception { <START> PrintWriter p = toPrintWriter(out); <END> try { parseCommandLine(); final ProjectAccess projectAccess = db.projects(); Project.NameKey parentNameKey = new Project.NameKey(parentName); final List<Project.NameKey> grandParents = new ArrayList<Project.NameKey>(); if (parentName != null) { final ProjectState projectState = projectCache.get(parentNameKey); if (projectState == null) { throw new Failure(1, "parent project " + parentName + " does not exist \n"); } else { Project.NameKey grandParent = projectState.getProject().getParent(); while (grandParent != null && !grandParent.equals(wildProject)) { grandParents.add(grandParent); grandParent = projectCache.get(grandParent).getProject().getParent(); } } } else { parentName = wildProject.get(); parentNameKey = new Project.NameKey(parentName); } for (String child : children) { final Project.NameKey childNameKey = new Project.NameKey(child); Project projectChild = projectAccess.get(childNameKey); if (projectChild != null && !child.equals(wildProject.get()) && !child.equals(parentName) && (!grandParents.contains(childNameKey))) { projectChild.setParent(parentNameKey); projectAccess.update(Collections.singleton(projectChild)); } else { p.print("It was not possible to set the parent project " + parentName + " to the following project : " + child + "\n"); p.flush(); } } projectCache.evict(); } catch (Throwable e) { p.print("Error when trying to set a parent to a project: " + e.getMessage() + "\n"); p.flush(); } } }); }</code><technical_language>p is for status/error reporting this err instead of out</technical_language>

Target:
public void start(final Environment env) throws IOException { startThread(new CommandRunnable() { @Override public void run() throws Exception { PrintWriter p = toPrintWriter(err); try { parseCommandLine(); final ProjectAccess projectAccess = db.projects(); Project.NameKey parentNameKey; final List<Project.NameKey> grandParents = new ArrayList<Project.NameKey>(); if (projectControl != null) { parentNameKey = new Project.NameKey(projectControl.getProject().getName()); Project.NameKey grandParent = projectControl.getProject().getParent(); while (grandParent != null && !grandParent.equals(wildProject)) { grandParents.add(grandParent); grandParent = projectCache.get(grandParent).getProject().getParent(); } } else { parentNameKey = new Project.NameKey(wildProject.get()); } for (ProjectControl childPC : children) { Project child = childPC.getProject(); final Project.NameKey childNameKey = new Project.NameKey(child.getName()); if (!childNameKey.equals(wildProject) && !childNameKey.equals(parentNameKey) && (!grandParents.contains(childNameKey))) { child.setParent(parentNameKey); projectAccess.update(Collections.singleton(child)); } else { p.print("It was not possible to set the parent project " + parentNameKey.get() + " to the following project : " + child.getName() + "\n"); p.flush(); } } projectCache.evictAll(); } catch (Throwable e) { p.print("Error when trying to set a parent to a project: " + e.getMessage() + "\n"); p.flush(); } } }); }