Skip to content
Permalink
Browse files

[JENKINS-43507] Fix check of repository source

  • Loading branch information...
stephenc committed Jun 8, 2017
1 parent 18514a4 commit e09089d2ecfcef2cb690b28496f0cddd1ade7f1a
Showing with 17 additions and 16 deletions.
  1. +17 −16 src/main/java/hudson/plugins/mercurial/MercurialStatus.java
@@ -9,35 +9,36 @@
import hudson.scm.SCM;
import hudson.security.ACL;
import hudson.triggers.SCMTrigger;
import jenkins.scm.api.SCMEvent;
import jenkins.scm.api.SCMHeadEvent;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.HttpResponses;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

import javax.servlet.ServletException;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import static javax.servlet.http.HttpServletResponse.*;
import javax.servlet.ServletException;
import jenkins.model.Jenkins;
import jenkins.scm.api.SCMEvent;
import jenkins.scm.api.SCMHeadEvent;
import jenkins.scm.api.SCMSource;
import jenkins.scm.api.SCMSourceOwner;
import jenkins.scm.api.SCMSourceOwners;
import jenkins.triggers.SCMTriggerItem;
import org.acegisecurity.context.SecurityContext;
import org.acegisecurity.context.SecurityContextHolder;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.HttpResponses;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
import static javax.servlet.http.HttpServletResponse.SC_OK;
import static javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE;
/**
* Information screen for the use of Mercurial in Jenkins.
*/
@@ -206,7 +207,7 @@ private HttpResponse handleNotifyCommit(String origin, URI url) throws ServletEx
scmFound = true;
MercurialSCMSource hgSource = (MercurialSCMSource) source;
String repository = hgSource.getSource();
if (repository == null) {
if (StringUtils.isBlank(repository)) {
LOGGER.log(Level.WARNING, "project {0} is using source control but does not identify a repository", project.getFullName());
continue;
}

0 comments on commit e09089d

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