Skip to content

Commit

Permalink
[JENKINS-31462] github-api has been upgrade to 1.71
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Recena committed Dec 3, 2015
1 parent 7bf7ae0 commit c385eed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions pom.xml
Expand Up @@ -36,11 +36,10 @@
<artifactId>git</artifactId>
<version>2.3</version>
</dependency>
<!-- TODO: Update when org.jenkins-ci.plugins:github-api is released -->
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>github-api</artifactId>
<version>1.71-SNAPSHOT</version>
<version>1.71</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand Down
Expand Up @@ -31,8 +31,9 @@
import hudson.util.FormValidation;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Logger;
import java.util.logging.Level;

import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
Expand Down Expand Up @@ -96,6 +97,8 @@ public int hashCode() {
@Extension
public static class DesciptorImpl extends Descriptor<Endpoint> {

private static final Logger LOGGER = Logger.getLogger(DesciptorImpl.class.getName());

@Override
public String getDisplayName() {
return "";
Expand All @@ -104,19 +107,16 @@ public String getDisplayName() {
@Restricted(NoExternalUse.class)
public FormValidation doCheckApiUri(@QueryParameter String apiUri) {
if (Util.fixEmptyAndTrim(apiUri) == null) {
return FormValidation.warning("You must specify the API URI");
return FormValidation.warning("You must specify the API URL");
}
try {
URL api = new URL(apiUri);
GitHub github = GitHub.connectToEnterpriseAnonymously(api.toString());
if (github.isApiUrlValid()) {
return FormValidation.ok();
}
return FormValidation.warning("This does not look like a GitHub Enterprise API URI");
} catch (MalformedURLException mue) {
return FormValidation.error("This does not look like a GitHub Enterprise API URI");
github.checkApiUrlValidity();
return FormValidation.ok();
} catch (IOException e) {
return FormValidation.error(e.getMessage());
LOGGER.log(Level.WARNING, e.getMessage());
return FormValidation.error("This does not look like a GitHub Enterprise API URL");
}
}

Expand Down

0 comments on commit c385eed

Please sign in to comment.