diff --git a/pom.xml b/pom.xml index f27b4cb3..4f89bd5a 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ 0.6.3 3.20.0 2.6.1.Final - 5.9 + 5.10 5.11.2 @@ -70,30 +70,16 @@ jackson-databind ${jackson.version} - - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - ${jackson.version} - - - - com.squareup.okhttp3 - okhttp - ${okhttp.version} - - org.ahocorasick ahocorasick ${ahocorasick.version} - org.apache.commons commons-lang3 ${commons.lang3.version} - org.cache2k cache2k-api @@ -105,7 +91,6 @@ ${cache2k.version} runtime - org.slf4j slf4j-api @@ -155,7 +140,6 @@ ${maven.compiler.release} - org.apache.maven.plugins maven-surefire-plugin @@ -164,13 +148,11 @@ false - org.apache.maven.plugins maven-jar-plugin 3.5.0 - org.jacoco jacoco-maven-plugin @@ -191,7 +173,6 @@ - com.github.spotbugs spotbugs-maven-plugin @@ -214,7 +195,6 @@ - org.apache.maven.plugins maven-source-plugin @@ -228,7 +208,6 @@ - org.apache.maven.plugins maven-javadoc-plugin @@ -245,7 +224,6 @@ - org.codehaus.mojo versions-maven-plugin @@ -254,7 +232,6 @@ .*-M.*,.*-alpha.*,.*-beta.* - org.sonarsource.scanner.maven sonar-maven-plugin diff --git a/src/test/java/com/imsweb/staging/updater/BadRequestException.java b/src/test/java/com/imsweb/staging/updater/BadRequestException.java deleted file mode 100644 index a2e0dca3..00000000 --- a/src/test/java/com/imsweb/staging/updater/BadRequestException.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2015 Information Management Services, Inc. - */ -package com.imsweb.staging.updater; - -public class BadRequestException extends SeerApiException { - - public BadRequestException() { - super(); - } - - public BadRequestException(String message) { - super(message); - } - - public BadRequestException(String message, Throwable cause) { - super(message, cause); - } - - public BadRequestException(Throwable cause) { - super(cause); - } - -} diff --git a/src/test/java/com/imsweb/staging/updater/ErrorInterceptor.java b/src/test/java/com/imsweb/staging/updater/ErrorInterceptor.java deleted file mode 100644 index 2b8cc9a8..00000000 --- a/src/test/java/com/imsweb/staging/updater/ErrorInterceptor.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2015 Information Management Services, Inc. - */ -package com.imsweb.staging.updater; - -import java.io.IOException; - -import org.jetbrains.annotations.NotNull; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import okhttp3.Interceptor; -import okhttp3.Response; -import okhttp3.ResponseBody; - -/** - * Interceptor to catch all non-200 responses and convert them to exceptions. - */ -class ErrorInterceptor implements Interceptor { - - @NotNull - @Override - public Response intercept(Chain chain) throws IOException { - Response response = chain.proceed(chain.request()); - - if (response.code() != 200) { - // convert body to error response - ErrorResponse error = null; - - ResponseBody body = response.body(); - if (body != null) { - try { - error = new ObjectMapper().readValue(body.byteStream(), ErrorResponse.class); - } - catch (IOException e) { - // sometimes the error message is not right format (like for 404 errors) - } - } - - String message = error == null ? "Error code " + response.code() : error.getMessage(); - - switch (response.code()) { - case 401: // unauthorized - throw new NotAuthorizedException(message); - case 400: // bad request - throw new BadRequestException(message); - case 404: - throw new NotFoundException(message); - default: - throw new SeerApiException(message); - } - } - - return response; - } -} diff --git a/src/test/java/com/imsweb/staging/updater/ErrorResponse.java b/src/test/java/com/imsweb/staging/updater/ErrorResponse.java deleted file mode 100644 index 8bca8788..00000000 --- a/src/test/java/com/imsweb/staging/updater/ErrorResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.imsweb.staging.updater; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class ErrorResponse { - - @JsonProperty("code") - protected Integer _id; - @JsonProperty("message") - protected String _message; - - /** - * Return the error identifier - * @return an error identifier - */ - public Integer getId() { - return _id; - } - - /** - * Return the error message - * @return an error message - */ - public String getMessage() { - return _message; - } -} diff --git a/src/test/java/com/imsweb/staging/updater/NotAuthorizedException.java b/src/test/java/com/imsweb/staging/updater/NotAuthorizedException.java deleted file mode 100644 index df918f31..00000000 --- a/src/test/java/com/imsweb/staging/updater/NotAuthorizedException.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2015 Information Management Services, Inc. - */ -package com.imsweb.staging.updater; - -public class NotAuthorizedException extends SeerApiException { - - public NotAuthorizedException() { - super(); - } - - public NotAuthorizedException(String message) { - super(message); - } - - public NotAuthorizedException(String message, Throwable cause) { - super(message, cause); - } - - public NotAuthorizedException(Throwable cause) { - super(cause); - } - -} diff --git a/src/test/java/com/imsweb/staging/updater/NotFoundException.java b/src/test/java/com/imsweb/staging/updater/NotFoundException.java deleted file mode 100644 index e597cbd0..00000000 --- a/src/test/java/com/imsweb/staging/updater/NotFoundException.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2015 Information Management Services, Inc. - */ -package com.imsweb.staging.updater; - -public class NotFoundException extends SeerApiException { - - public NotFoundException() { - super(); - } - - public NotFoundException(String message) { - super(message); - } - - public NotFoundException(String message, Throwable cause) { - super(message, cause); - } - - public NotFoundException(Throwable cause) { - super(cause); - } - -} diff --git a/src/test/java/com/imsweb/staging/updater/SeerApiException.java b/src/test/java/com/imsweb/staging/updater/SeerApiException.java deleted file mode 100644 index 2f3a55a9..00000000 --- a/src/test/java/com/imsweb/staging/updater/SeerApiException.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2015 Information Management Services, Inc. - */ -package com.imsweb.staging.updater; - -public class SeerApiException extends RuntimeException { - - public SeerApiException() { - super(); - } - - public SeerApiException(String message) { - super(message); - } - - public SeerApiException(String message, Throwable cause) { - super(message, cause); - } - - public SeerApiException(Throwable cause) { - super(cause); - } - -}