Source:
<code>private void validateParameters() throws Failure { if (projectName.endsWith(Constants.DOT_GIT_EXT)) { projectName = projectName.substring(0, projectName.length() - Constants.DOT_GIT_EXT.length()); } if (ownerIds != null && !ownerIds.isEmpty()) { ownerIds = new ArrayList<AccountGroup.Id>(new HashSet<AccountGroup.Id>(ownerIds)); } else { ownerIds = new ArrayList<AccountGroup.Id>(); ownerIds.add(authConfig.getAdministratorsGroup()); } <START> if (newParent == null) { <END> try { newParent = projectControlFactory.controlFor(wildProject); } catch (NoSuchProjectException e) { throw new Failure(1, "internal server error"); } } final boolean hasCreateProjectPermissions = newParent.canCreateProject(); if (!hasCreateProjectPermissions) { throw new Failure(1, "fatal: Not permitted to create " + projectName); } final Project.NameKey parentNameKey = newParent.getProject().getNameKey(); if (!parentNameKey.equals(wildProject)) { final String correctProjectPrefix = parentNameKey.get() + "/"; if (!projectName.startsWith(correctProjectPrefix)) { throw new Failure(1, "fatal: Not permitted to create " + projectName + " project name must start with: " + correctProjectPrefix); } } while (branch.startsWith("/")) { branch = branch.substring(1); } if (!branch.startsWith(Constants.R_HEADS)) { branch = Constants.R_HEADS + branch; } if (!Repository.isValidRefName(branch)) { throw new Failure(1, "--branch \"" + branch + "\" is not a valid name"); } }</code><technical_language>Shawn, in case user try create a project name "tools/gerrit" indicating a parent, is a "tools" project created, consider "tools/gerrit" project created inherit Projects? assume user create a "tools/gerrit" project in this scenario I talked (in running gerrit git folder tools folder gerrit project)</technical_language>

Target:
private void validateParameters() throws Failure { if (projectName.endsWith(Constants.DOT_GIT_EXT)) { projectName = projectName.substring(0, projectName.length() - Constants.DOT_GIT_EXT.length()); } final ProjectControl extractedParent = findParent(projectName); if (extractedParent != null) { newParent = extractedParent; } else if (newParent == null) { try { newParent = projectControlFactory.controlFor(wildProject); } catch (NoSuchProjectException e) { throw new Failure(1, "internal server error"); } } if (ownerIds != null && !ownerIds.isEmpty()) { ownerIds = new ArrayList<AccountGroup.Id>(new HashSet<AccountGroup.Id>(ownerIds)); } else { ownerIds = newParent.allGroupsGrantingCreateProject(); if (ownerIds.isEmpty()) { ownerIds.add(authConfig.getAdministratorsGroup()); } } if (!newParent.canCreateProject()) { throw new Failure(1, "fatal: Not permitted to create " + projectName); } final Project.NameKey parentNameKey = newParent.getProject().getNameKey(); if (!parentNameKey.equals(wildProject)) { final String correctProjectPrefix = parentNameKey.get() + "/"; if (!projectName.startsWith(correctProjectPrefix)) { throw new Failure(1, "fatal: Not permitted to create " + projectName + " project name must start with: " + correctProjectPrefix); } } while (branch.startsWith("/")) { branch = branch.substring(1); } if (!branch.startsWith(Constants.R_HEADS)) { branch = Constants.R_HEADS + branch; } if (!Repository.isValidRefName(branch)) { throw new Failure(1, "--branch \"" + branch + "\" is not a valid name"); } }