diff --git a/.travis.yml b/.travis.yml index 761e4ee8..a3670e43 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,9 @@ language: java jdk: - oraclejdk8 + - oraclejdk11 + - openjdk10 + - openjdk11 env: matrix: diff --git a/pom.xml b/pom.xml index c3e6ad7a..2b2e070d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,11 +4,11 @@ org.jenkins-ci.plugins plugin - 3.47 + 3.48 - 2.138.1 + 2.164.3 8 UTF-8 diff --git a/src/main/java/jenkins/plugins/rocketchatnotifier/RocketChatNotifier.java b/src/main/java/jenkins/plugins/rocketchatnotifier/RocketChatNotifier.java index 11964d98..5f13d1bd 100644 --- a/src/main/java/jenkins/plugins/rocketchatnotifier/RocketChatNotifier.java +++ b/src/main/java/jenkins/plugins/rocketchatnotifier/RocketChatNotifier.java @@ -30,10 +30,10 @@ import org.kohsuke.stapler.QueryParameter; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.export.Exported; -import sun.security.validator.ValidatorException; import javax.net.ssl.SSLHandshakeException; import java.io.IOException; +import java.security.cert.CertificateException; import java.util.Collections; import java.util.List; import java.util.Map; @@ -542,6 +542,7 @@ public void setBuildServerUrl(String buildServerUrl) { public void setTrustSSL(boolean trustSSL) { this.trustSSL = trustSSL; } + @DataBoundSetter public void setWebhookToken(String webhookToken) { this.webhookToken = webhookToken; @@ -626,7 +627,7 @@ public FormValidation doTestConnection(@QueryParameter("rocketServerUrl") final return FormValidation.ok("Success"); } catch (Exception e) { if (e.getCause() != null && - e.getCause().getClass() == SSLHandshakeException.class || e.getCause().getClass() == ValidatorException.class) { + e.getCause().getClass() == SSLHandshakeException.class || e.getCause().getClass() == CertificateException.class) { LOGGER.log(Level.SEVERE, "SSL error during trying to send rocket message", e); return FormValidation.error(e, "SSL error", e); } else { diff --git a/src/main/java/jenkins/plugins/rocketchatnotifier/RocketClient.java b/src/main/java/jenkins/plugins/rocketchatnotifier/RocketClient.java index 688d3c7d..e73d6d6b 100644 --- a/src/main/java/jenkins/plugins/rocketchatnotifier/RocketClient.java +++ b/src/main/java/jenkins/plugins/rocketchatnotifier/RocketClient.java @@ -1,8 +1,8 @@ package jenkins.plugins.rocketchatnotifier; import jenkins.plugins.rocketchatnotifier.rocket.errorhandling.RocketClientException; -import sun.security.validator.ValidatorException; +import java.security.cert.CertificateException; import java.util.List; import java.util.Map; @@ -16,5 +16,5 @@ public interface RocketClient { boolean publish(String message, String emoji, String avatar, List> attachments); - void validate() throws ValidatorException, RocketClientException; + void validate() throws CertificateException, RocketClientException; } diff --git a/src/main/java/jenkins/plugins/rocketchatnotifier/RocketClientImpl.java b/src/main/java/jenkins/plugins/rocketchatnotifier/RocketClientImpl.java index af1d2b02..a0d8410f 100644 --- a/src/main/java/jenkins/plugins/rocketchatnotifier/RocketClientImpl.java +++ b/src/main/java/jenkins/plugins/rocketchatnotifier/RocketClientImpl.java @@ -3,8 +3,8 @@ import jenkins.plugins.rocketchatnotifier.rocket.RocketChatClient; import jenkins.plugins.rocketchatnotifier.rocket.RocketChatClientImpl; import jenkins.plugins.rocketchatnotifier.rocket.errorhandling.RocketClientException; -import sun.security.validator.ValidatorException; +import java.security.cert.CertificateException; import java.util.List; import java.util.Map; import java.util.logging.Level; @@ -36,12 +36,10 @@ public boolean publish(String message, List> attachments) { LOGGER.fine("Starting sending message to channel " + this.channel); this.client.send(this.channel, message, null, null, attachments); return true; - } - catch (RocketClientException e) { + } catch (RocketClientException e) { LOGGER.log(Level.SEVERE, "I/O error error during publishing message", e); return false; - } - catch (Exception e) { + } catch (Exception e) { LOGGER.log(Level.SEVERE, "Unknown error error during publishing message", e); return false; } @@ -53,19 +51,17 @@ public boolean publish(final String message, final String emoji, final String av LOGGER.fine("Starting sending message to channel " + this.channel); this.client.send(this.channel, message, emoji, avatar, attachments); return true; - } - catch (RocketClientException e) { + } catch (RocketClientException e) { LOGGER.log(Level.SEVERE, "I/O error error during publishing message", e); return false; - } - catch (Exception e) { + } catch (Exception e) { LOGGER.log(Level.SEVERE, "Unknown error error during publishing message", e); return false; } } @Override - public void validate() throws ValidatorException, RocketClientException { + public void validate() throws CertificateException, RocketClientException { LOGGER.fine("Starting validating"); this.client.getChannels(); } diff --git a/src/main/java/jenkins/plugins/rocketchatnotifier/RocketClientWebhookImpl.java b/src/main/java/jenkins/plugins/rocketchatnotifier/RocketClientWebhookImpl.java index 209ecc93..c1ce7f65 100644 --- a/src/main/java/jenkins/plugins/rocketchatnotifier/RocketClientWebhookImpl.java +++ b/src/main/java/jenkins/plugins/rocketchatnotifier/RocketClientWebhookImpl.java @@ -10,8 +10,8 @@ import jenkins.plugins.rocketchatnotifier.rocket.errorhandling.RocketClientException; import org.apache.commons.lang.StringUtils; import org.jenkinsci.plugins.plaincredentials.StringCredentials; -import sun.security.validator.ValidatorException; +import java.security.cert.CertificateException; import java.util.Collections; import java.util.List; import java.util.Map; @@ -62,7 +62,7 @@ public boolean publish(final String message, final String emoji, final String av } @Override - public void validate() throws ValidatorException, RocketClientException { + public void validate() throws CertificateException, RocketClientException { this.client.send("", "Test message from Jenkins via Webhook"); } diff --git a/src/main/java/jenkins/plugins/rocketchatnotifier/rocket/RocketChatClient.java b/src/main/java/jenkins/plugins/rocketchatnotifier/rocket/RocketChatClient.java index 20ac079e..3712130b 100644 --- a/src/main/java/jenkins/plugins/rocketchatnotifier/rocket/RocketChatClient.java +++ b/src/main/java/jenkins/plugins/rocketchatnotifier/rocket/RocketChatClient.java @@ -1,11 +1,10 @@ package jenkins.plugins.rocketchatnotifier.rocket; -import jenkins.plugins.rocketchatnotifier.model.Info; import jenkins.plugins.rocketchatnotifier.model.Room; import jenkins.plugins.rocketchatnotifier.model.User; import jenkins.plugins.rocketchatnotifier.rocket.errorhandling.RocketClientException; -import sun.security.validator.ValidatorException; +import java.security.cert.CertificateException; import java.util.List; import java.util.Map; @@ -46,20 +45,20 @@ public interface RocketChatClient { * * @param room to use (aka channel) * @param message to send - * @throws ValidatorException in case of SSL errors + * @throws CertificateException in case of SSL errors * @throws RocketClientException in case of communication errors with the RocketChat server backend */ - void send(Room room, String message) throws ValidatorException, RocketClientException; + void send(Room room, String message) throws CertificateException, RocketClientException; /** * sends a message to a channel * * @param channelName to use * @param message to send - * @throws ValidatorException in case of SSL errors + * @throws CertificateException in case of SSL errors * @throws RocketClientException in case of communication errors with the RocketChat server backend */ - void send(String channelName, String message) throws ValidatorException, RocketClientException; + void send(String channelName, String message) throws CertificateException, RocketClientException; /** * sends a message to a channel. @@ -69,10 +68,10 @@ public interface RocketChatClient { * @param message to send * @param emoji to display * @param avatar to display - * @throws ValidatorException in case of SSL errors + * @throws CertificateException in case of SSL errors * @throws RocketClientException in case of communication errors with the RocketChat server backend */ - void send(String channelName, String message, String emoji, String avatar) throws ValidatorException, RocketClientException; + void send(String channelName, String message, String emoji, String avatar) throws CertificateException, RocketClientException; /** * sends a message to a channel. @@ -83,11 +82,11 @@ public interface RocketChatClient { * @param emoji to display * @param avatar to display * @param attachments to send - * @throws ValidatorException in case of SSL errors + * @throws CertificateException in case of SSL errors * @throws RocketClientException in case of communication errors with the RocketChat server backend */ void send(String channelName, String message, String emoji, String avatar, List> attachments) - throws ValidatorException, RocketClientException; + throws CertificateException, RocketClientException; /** * Retrieves server information diff --git a/src/main/java/jenkins/plugins/rocketchatnotifier/rocket/RocketChatClientImpl.java b/src/main/java/jenkins/plugins/rocketchatnotifier/rocket/RocketChatClientImpl.java index c7059549..6794304e 100644 --- a/src/main/java/jenkins/plugins/rocketchatnotifier/rocket/RocketChatClientImpl.java +++ b/src/main/java/jenkins/plugins/rocketchatnotifier/rocket/RocketChatClientImpl.java @@ -6,16 +6,15 @@ import com.mashape.unirest.http.exceptions.UnirestException; import com.mashape.unirest.request.GetRequest; import jenkins.plugins.rocketchatnotifier.RocketClientImpl; -import jenkins.plugins.rocketchatnotifier.model.Info; import jenkins.plugins.rocketchatnotifier.model.Response; import jenkins.plugins.rocketchatnotifier.model.Room; import jenkins.plugins.rocketchatnotifier.model.User; import jenkins.plugins.rocketchatnotifier.rocket.errorhandling.RocketClientException; import org.apache.commons.lang.StringUtils; import org.json.simple.JSONValue; -import sun.security.validator.ValidatorException; import java.io.IOException; +import java.security.cert.CertificateException; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -127,24 +126,24 @@ public String getInfo() throws RocketClientException { } @Override - public void send(Room room, String message) throws ValidatorException, RocketClientException { + public void send(Room room, String message) throws CertificateException, RocketClientException { this.send(room.getName(), message); } @Override - public void send(String channelName, String message) throws ValidatorException, RocketClientException { + public void send(String channelName, String message) throws CertificateException, RocketClientException { this.send(channelName, message, null, null); } @Override public void send(final String channelName, final String message, final String emoji, final String avatar) - throws ValidatorException, RocketClientException { + throws CertificateException, RocketClientException { this.send(channelName, message, emoji, avatar, null); } @Override public void send(final String channelName, final String message, final String emoji, final String avatar, final List> attachments) - throws ValidatorException, RocketClientException { + throws CertificateException, RocketClientException { if (!channelName.contains(",")) { sendSingleMessage(channelName, message, emoji, avatar, attachments); return;