Skip to content

Commit

Permalink
Merge upstream changes from develop to feature
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddenalpha committed Jun 4, 2024
2 parents cc94fb3 + 183cfb4 commit acbcdac
Show file tree
Hide file tree
Showing 33 changed files with 81 additions and 31 deletions.
2 changes: 1 addition & 1 deletion gateleen-cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-cache</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public void setRoutingContexttHandler(Handler<RoutingContext> 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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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 = "";
Expand Down Expand Up @@ -118,8 +120,9 @@ public HttpClientResponse exceptionHandler(Handler<Throwable> 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));
}
Expand Down Expand Up @@ -214,9 +217,10 @@ public Future<Void> write(String chunk, String enc) {
public Future<Void> 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();
Expand Down
2 changes: 1 addition & 1 deletion gateleen-delegate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-delegate</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-delta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-delta</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-expansion/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-expansion</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-hook-js/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>
<artifactId>gateleen-hook-js</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-hook/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-hook</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-kafka/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-kafka</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-logging/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-logging</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,15 @@ 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");
} else {
sb.append(" with filterProperty ").append(filterPropertyKey).append("=").append(filterPropertyValue);
}
sb.append(" has FilterResult ").append(filterResult.name());
log.info(sb.toString());
log.info("{}", sb);
}
}
}
2 changes: 1 addition & 1 deletion gateleen-merge/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-merge</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-monitoring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-monitoring</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-packing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-packing</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-player/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-player</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-playground/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-playground</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-qos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-qos</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-queue/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-queue</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<AsyncResult<HttpClientResponse>> handler) {
FastFaiHttpClientResponse response = new FastFaiHttpClientResponse() {
Expand Down
2 changes: 1 addition & 1 deletion gateleen-routing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-routing</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-runconfig/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-runconfig</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-scheduler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-scheduler</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-security</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>
<artifactId>gateleen-test</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-testhelper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-testhelper</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-user/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-user</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gateleen-validation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
</parent>

<artifactId>gateleen-validation</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.swisspush.gateleen</groupId>
<artifactId>gateleen</artifactId>
<version>2.1.7-SNAPSHOT</version>
<version>2.1.8-SNAPSHOT</version>
<packaging>pom</packaging>
<name>gateleen</name>
<description>Middleware library based on Vert.x to build advanced JSON/REST communication servers</description>
Expand Down

0 comments on commit acbcdac

Please sign in to comment.