use of org.hudsonci.service.SystemIntegrityViolationException in project hudson-2.x by hudson.
the class ProjectServiceImpl method copyProject.
public <T extends AbstractProject<?, ?>> T copyProject(final T src, final String targetProjectName) throws ServiceRuntimeException {
checkNotNull(src, AbstractProject.class);
checkProjectName(targetProjectName);
this.securityService.checkPermission(Item.CREATE);
this.securityService.checkPermission(src, Item.EXTENDED_READ);
// TODO should this check really be performed here?
if (projectExists(targetProjectName)) {
throw new SystemIntegrityViolationException(String.format("Project %s already exists.", targetProjectName));
}
try {
return getHudson().copy(src, targetProjectName);
} catch (IOException ex) {
throw new ServiceRuntimeException(String.format("Project copy failed from %s to %s", src.getName(), targetProjectName), ex);
}
}
use of org.hudsonci.service.SystemIntegrityViolationException in project hudson-2.x by hudson.
the class ProjectServiceImpl method createProjectFromXML.
public TopLevelItem createProjectFromXML(final String projectName, final InputStream xml) {
checkProjectName(projectName);
checkNotNull(xml, InputStream.class);
this.securityService.checkPermission(Item.CREATE);
// TODO should this check really be performed here?
if (projectExists(projectName)) {
throw new SystemIntegrityViolationException(String.format("Project %s already exists.", projectName));
}
try {
return getHudson().createProjectFromXML(projectName, xml);
} catch (IOException ex) {
throw new ServiceRuntimeException(String.format("Project creation failed for %s", projectName), ex);
}
}
Aggregations