diff --git a/gateleen-cache/pom.xml b/gateleen-cache/pom.xml index c4563981..ec1ab879 100644 --- a/gateleen-cache/pom.xml +++ b/gateleen-cache/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-cache diff --git a/gateleen-core/pom.xml b/gateleen-core/pom.xml index c6124598..7ca3e99e 100644 --- a/gateleen-core/pom.xml +++ b/gateleen-core/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-core diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/exception/GateleenExceptionFactory.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/exception/GateleenExceptionFactory.java index af7db1e5..6e0ab500 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/exception/GateleenExceptionFactory.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/exception/GateleenExceptionFactory.java @@ -36,6 +36,14 @@ public interface GateleenExceptionFactory { public Exception newException(String msg, Throwable cause); + /** Convenience overload for {@link #newIllegalStateException(String, Throwable)}. */ + public default IllegalStateException newIllegalStateException(String msg) { return newIllegalStateException(msg, null); } + + /** Convenience overload for {@link #newIllegalStateException(String, Throwable)}. */ + public default IllegalStateException newIllegalStateException(Throwable cause) { return newIllegalStateException(null, cause); } + + public IllegalStateException newIllegalStateException(String msg, Throwable cause); + public ReplyException newReplyException(ReplyFailure failureType, int failureCode, String message); diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/exception/GateleenThriftyExceptionFactory.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/exception/GateleenThriftyExceptionFactory.java index 1a26ae48..1ce9631a 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/exception/GateleenThriftyExceptionFactory.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/exception/GateleenThriftyExceptionFactory.java @@ -16,6 +16,12 @@ public Exception newException(String message, Throwable cause) { return new GateleenNoStacktraceException(message, cause); } + @Override + public IllegalStateException newIllegalStateException(String msg, Throwable cause) { + if (cause instanceof IllegalStateException) return (IllegalStateException) cause; + return new NoStackIllegalStateException(msg); + } + @Override public ReplyException newReplyException(ReplyFailure failureType, int failureCode, String message) { return new GateleenNoStackReplyException(failureType, failureCode, message); diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/exception/GateleenWastefulExceptionFactory.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/exception/GateleenWastefulExceptionFactory.java index 1fc0889c..b15e3719 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/exception/GateleenWastefulExceptionFactory.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/exception/GateleenWastefulExceptionFactory.java @@ -15,6 +15,11 @@ public Exception newException(String message, Throwable cause) { return new Exception(message, cause); } + @Override + public IllegalStateException newIllegalStateException(String msg, Throwable cause) { + return new IllegalStateException(msg, cause); + } + @Override public ReplyException newReplyException(ReplyFailure failureType, int failureCode, String message) { return new ReplyException(failureType, failureCode, message); diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/exception/NoStackIllegalStateException.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/exception/NoStackIllegalStateException.java new file mode 100644 index 00000000..e773a9c0 --- /dev/null +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/exception/NoStackIllegalStateException.java @@ -0,0 +1,26 @@ +package org.swisspush.gateleen.core.exception; + +public class NoStackIllegalStateException extends IllegalStateException { + + public NoStackIllegalStateException() { + super(); + } + + public NoStackIllegalStateException(String s) { + super(s); + } + + public NoStackIllegalStateException(String message, Throwable cause) { + super(message, cause); + } + + public NoStackIllegalStateException(Throwable cause) { + super(cause); + } + + @Override + public Throwable fillInStackTrace() { + return this; + } + +} diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpClient.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpClient.java index 2d02b7ef..823a4c65 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpClient.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpClient.java @@ -28,6 +28,6 @@ public void setRoutingContexttHandler(Handler wrappedRoutingCont @Override protected HttpClientRequest doRequest(HttpMethod method, String uri) { - return new LocalHttpClientRequest(method, uri, vertx, wrappedRoutingContexttHandler, exceptionFactory, new LocalHttpServerResponse(vertx)); + return new LocalHttpClientRequest(method, uri, vertx, wrappedRoutingContexttHandler, exceptionFactory, new LocalHttpServerResponse(vertx, exceptionFactory)); } } diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpServerResponse.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpServerResponse.java index d6ad0845..0f1cd1ca 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpServerResponse.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpServerResponse.java @@ -6,6 +6,7 @@ import io.vertx.core.http.impl.headers.HeadersMultiMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.swisspush.gateleen.core.exception.GateleenExceptionFactory; import org.swisspush.gateleen.core.util.StatusCode; /** @@ -16,6 +17,7 @@ public class LocalHttpServerResponse extends BufferBridge implements FastFailHttpServerResponse { private static final Logger logger = LoggerFactory.getLogger(LocalHttpServerResponse.class); + private final GateleenExceptionFactory exceptionFactory; private int statusCode; private String statusMessage; private static final String EMPTY = ""; @@ -118,8 +120,9 @@ public HttpClientResponse exceptionHandler(Handler handler) { }; - public LocalHttpServerResponse(Vertx vertx) { + public LocalHttpServerResponse(Vertx vertx, GateleenExceptionFactory exceptionFactory) { super(vertx); + this.exceptionFactory = exceptionFactory; // Attach most simple possible exception handler to base. setExceptionHandler(thr -> logger.error("Processing of response failed.", thr)); } @@ -214,9 +217,10 @@ public Future write(String chunk, String enc) { public Future write(Buffer data) { // emulate Vertx's HttpServerResponseImpl if (!chunked && !headers.contains(HttpHeaders.CONTENT_LENGTH)) { - IllegalStateException ex = new IllegalStateException("You must set the Content-Length header to be the total size of the message " + IllegalStateException ex = exceptionFactory.newIllegalStateException("" + + "You must set the Content-Length header to be the total size of the message " + "body BEFORE sending any data if you are not using HTTP chunked encoding."); - logger.error("non-proper HttpServerResponse occured", ex); + logger.debug("non-proper HttpServerResponse occurred", ex); throw ex; } ensureBound(); diff --git a/gateleen-delegate/pom.xml b/gateleen-delegate/pom.xml index 3374b224..76f73423 100644 --- a/gateleen-delegate/pom.xml +++ b/gateleen-delegate/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-delegate diff --git a/gateleen-delta/pom.xml b/gateleen-delta/pom.xml index 1fecc47b..707c2b70 100644 --- a/gateleen-delta/pom.xml +++ b/gateleen-delta/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-delta diff --git a/gateleen-expansion/pom.xml b/gateleen-expansion/pom.xml index cd4fa1dd..6fd869f9 100644 --- a/gateleen-expansion/pom.xml +++ b/gateleen-expansion/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-expansion diff --git a/gateleen-hook-js/pom.xml b/gateleen-hook-js/pom.xml index 59455301..6790dd29 100644 --- a/gateleen-hook-js/pom.xml +++ b/gateleen-hook-js/pom.xml @@ -4,7 +4,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-hook-js jar diff --git a/gateleen-hook/pom.xml b/gateleen-hook/pom.xml index d0c5e3ca..95761392 100644 --- a/gateleen-hook/pom.xml +++ b/gateleen-hook/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-hook diff --git a/gateleen-kafka/pom.xml b/gateleen-kafka/pom.xml index c58d33a0..ab53b09f 100644 --- a/gateleen-kafka/pom.xml +++ b/gateleen-kafka/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-kafka diff --git a/gateleen-logging/pom.xml b/gateleen-logging/pom.xml index 8a6ba5a5..446f6168 100644 --- a/gateleen-logging/pom.xml +++ b/gateleen-logging/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-logging diff --git a/gateleen-logging/src/main/java/org/swisspush/gateleen/logging/RequestPropertyFilter.java b/gateleen-logging/src/main/java/org/swisspush/gateleen/logging/RequestPropertyFilter.java index c33d7a24..291762a8 100644 --- a/gateleen-logging/src/main/java/org/swisspush/gateleen/logging/RequestPropertyFilter.java +++ b/gateleen-logging/src/main/java/org/swisspush/gateleen/logging/RequestPropertyFilter.java @@ -81,6 +81,7 @@ private static void logFilterResult(HttpServerRequest request, String filterProp private static void logFilterResult(HttpServerRequest request, String filterPropertyKey, String filterPropertyValue, FilterResult filterResult, boolean noMatchingProperty){ if(FilterResult.NO_MATCH != filterResult) { Logger log = RequestLoggerFactory.getLogger(RequestPropertyFilter.class, request); + if (!log.isInfoEnabled()) return; StringBuilder sb = new StringBuilder("Request to ").append(request.uri()); if (noMatchingProperty) { sb.append(" with no matching filterProperty"); @@ -88,7 +89,7 @@ private static void logFilterResult(HttpServerRequest request, String filterProp sb.append(" with filterProperty ").append(filterPropertyKey).append("=").append(filterPropertyValue); } sb.append(" has FilterResult ").append(filterResult.name()); - log.info(sb.toString()); + log.info("{}", sb); } } } diff --git a/gateleen-merge/pom.xml b/gateleen-merge/pom.xml index 1ac048c6..a33161ac 100644 --- a/gateleen-merge/pom.xml +++ b/gateleen-merge/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-merge diff --git a/gateleen-monitoring/pom.xml b/gateleen-monitoring/pom.xml index d5fbb3a8..4242c177 100644 --- a/gateleen-monitoring/pom.xml +++ b/gateleen-monitoring/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-monitoring diff --git a/gateleen-packing/pom.xml b/gateleen-packing/pom.xml index 5298ffb3..00d80423 100644 --- a/gateleen-packing/pom.xml +++ b/gateleen-packing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-packing diff --git a/gateleen-player/pom.xml b/gateleen-player/pom.xml index de137f48..32e1414f 100644 --- a/gateleen-player/pom.xml +++ b/gateleen-player/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-player diff --git a/gateleen-playground/pom.xml b/gateleen-playground/pom.xml index e1cf9a81..50e9ac12 100644 --- a/gateleen-playground/pom.xml +++ b/gateleen-playground/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-playground diff --git a/gateleen-qos/pom.xml b/gateleen-qos/pom.xml index 7bb5aea4..8cca1b4c 100644 --- a/gateleen-qos/pom.xml +++ b/gateleen-qos/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-qos diff --git a/gateleen-queue/pom.xml b/gateleen-queue/pom.xml index 7cc56c55..5f42bd0a 100644 --- a/gateleen-queue/pom.xml +++ b/gateleen-queue/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-queue diff --git a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/QueueProcessorTest.java b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/QueueProcessorTest.java index c05d9d3e..b9c0c0c1 100644 --- a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/QueueProcessorTest.java +++ b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/QueueProcessorTest.java @@ -217,7 +217,7 @@ private void setHttpClientRespondStatusCode(StatusCode statusCode) { String url = (String) invocation.getArguments()[1]; LocalHttpClientRequest request = new LocalHttpClientRequest(httpMethod, url, vertx, event -> { - }, exceptionFactory, new LocalHttpServerResponse(vertx)) { + }, exceptionFactory, new LocalHttpServerResponse(vertx, exceptionFactory)) { @Override public HttpClientRequest response(Handler> handler) { FastFaiHttpClientResponse response = new FastFaiHttpClientResponse() { diff --git a/gateleen-routing/pom.xml b/gateleen-routing/pom.xml index 07b9b4db..85ab49b4 100644 --- a/gateleen-routing/pom.xml +++ b/gateleen-routing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-routing diff --git a/gateleen-runconfig/pom.xml b/gateleen-runconfig/pom.xml index 8d4324df..c6e4daa8 100644 --- a/gateleen-runconfig/pom.xml +++ b/gateleen-runconfig/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-runconfig diff --git a/gateleen-scheduler/pom.xml b/gateleen-scheduler/pom.xml index 1fcfbf67..25367dc4 100644 --- a/gateleen-scheduler/pom.xml +++ b/gateleen-scheduler/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-scheduler diff --git a/gateleen-security/pom.xml b/gateleen-security/pom.xml index 0fc3067c..9173fc01 100644 --- a/gateleen-security/pom.xml +++ b/gateleen-security/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-security diff --git a/gateleen-test/pom.xml b/gateleen-test/pom.xml index 8611850d..79bc6c1a 100644 --- a/gateleen-test/pom.xml +++ b/gateleen-test/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-test jar diff --git a/gateleen-testhelper/pom.xml b/gateleen-testhelper/pom.xml index 05882f11..ec439ba5 100644 --- a/gateleen-testhelper/pom.xml +++ b/gateleen-testhelper/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-testhelper diff --git a/gateleen-user/pom.xml b/gateleen-user/pom.xml index 4f69e7b6..92cc2d30 100644 --- a/gateleen-user/pom.xml +++ b/gateleen-user/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-user diff --git a/gateleen-validation/pom.xml b/gateleen-validation/pom.xml index 391d4c53..5afcddce 100644 --- a/gateleen-validation/pom.xml +++ b/gateleen-validation/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT gateleen-validation diff --git a/pom.xml b/pom.xml index 5cecd732..19ae1663 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.7-SNAPSHOT + 2.1.8-SNAPSHOT pom gateleen Middleware library based on Vert.x to build advanced JSON/REST communication servers