Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-31462] Catching JsonParseException to avoid weird log messages
  • Loading branch information
Manuel Recena committed Dec 3, 2015
1 parent c385eed commit 2fb4d47
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -24,13 +24,15 @@

package org.jenkinsci.plugins.github_branch_source;

import com.fasterxml.jackson.core.JsonParseException;
import hudson.Extension;
import hudson.Util;
import hudson.model.AbstractDescribableImpl;
import hudson.model.Descriptor;
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;
Expand Down Expand Up @@ -114,6 +116,10 @@ public FormValidation doCheckApiUri(@QueryParameter String apiUri) {
GitHub github = GitHub.connectToEnterpriseAnonymously(api.toString());
github.checkApiUrlValidity();
return FormValidation.ok();
} catch (MalformedURLException mue) {
return FormValidation.error("This does not look like a GitHub Enterprise API URL");
} catch (JsonParseException jpe) {
return FormValidation.error("This does not look like a GitHub Enterprise API URL");
} catch (IOException e) {
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 2fb4d47

Please sign in to comment.