Skip to content
Permalink
Browse files

Merge pull request #8 from ctapobep/master

[FIXED JENKINS-22150] Corrected performance issue in validation of SCM project.
  • Loading branch information...
ctapobep committed Mar 12, 2014
2 parents c6208b9 + eb76597 commit fb110e4380bfec3461e726faa8134e2ea856a9c6
Showing with 24 additions and 6 deletions.
  1. +15 −1 pom.xml
  2. +9 −5 src/main/java/hudson/plugins/templateproject/ProxySCM.java
16 pom.xml
@@ -28,7 +28,21 @@
</plugins>
</pluginManagement>
</build>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
</dependencies>
<scm>
<connection>scm:git:git://github.com/jenkinsci/template-project-plugin.git</connection>
<developerConnection>scm:git:git@github.com:jenkinsci/template-project-plugin.git</developerConnection>
@@ -23,6 +23,7 @@
import java.io.File;
import java.io.IOException;

import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;
@@ -83,12 +84,15 @@ public String getDisplayName() {
public FormValidation doCheckProjectName(@AncestorInPath AccessControlled anc, @QueryParameter String value) {
// Require CONFIGURE permission on this project
if (!anc.hasPermission(Item.CONFIGURE)) return FormValidation.ok();
Item item = Hudson.getInstance().getItemByFullName(
value, Item.class);
if (item == null) {
//this check is important because otherwise plugin will check for similar project which impacts performance
//the check will be performed even if this plugin is not used as SCM for the current project

This comment has been minimized.

Copy link
@oleg-nenashev

oleg-nenashev Mar 24, 2014

Member

@ctapobep
Just for future...
Please follow the indentation approach of initial code sources and avoid the formatting changes if it is not required. Otherwise, it's quite hard to review changes

This comment has been minimized.

Copy link
@ctapobep

ctapobep Mar 24, 2014

Author Member

Okey-dokey!

if(StringUtils.isEmpty(value)) {
return FormValidation.error("Project cannot be empty");
}
Item item = Hudson.getInstance().getItemByFullName(value, Item.class);
if (item == null) {
return FormValidation.error(Messages.BuildTrigger_NoSuchProject(value,
AbstractProject.findNearest(value)
.getName()));
AbstractProject.findNearest(value).getName()));
}
if (!(item instanceof AbstractProject)) {
return FormValidation.error(Messages.BuildTrigger_NotBuildable(value));

0 comments on commit fb110e4

Please sign in to comment.
You can’t perform that action at this time.