From 204e34039784ee735f83be109b3f76de05570a32 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Mon, 18 Sep 2017 16:06:05 -0400 Subject: [PATCH] Drop parameterized type from SQL's exception messages (elastic/x-pack-elasticsearch#2540) The type parameter wasn't buying us anything. Original commit: elastic/x-pack-elasticsearch@5005b26c09c1931d4230fda5b565c2aa424b8622 --- .../xpack/sql/cli/net/protocol/ErrorResponse.java | 2 +- .../sql/cli/net/protocol/ExceptionResponse.java | 2 +- .../xpack/sql/jdbc/net/protocol/ErrorResponse.java | 2 +- .../sql/jdbc/net/protocol/ExceptionResponse.java | 2 +- .../xpack/sql/plugin/AbstractSqlServer.java | 4 ++-- .../sql/protocol/shared/AbstractErrorResponse.java | 12 ++++++------ .../protocol/shared/AbstractExceptionResponse.java | 12 ++++++------ 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/sql/cli-proto/src/main/java/org/elasticsearch/xpack/sql/cli/net/protocol/ErrorResponse.java b/sql/cli-proto/src/main/java/org/elasticsearch/xpack/sql/cli/net/protocol/ErrorResponse.java index 70e63448d59..644b64bbb47 100644 --- a/sql/cli-proto/src/main/java/org/elasticsearch/xpack/sql/cli/net/protocol/ErrorResponse.java +++ b/sql/cli-proto/src/main/java/org/elasticsearch/xpack/sql/cli/net/protocol/ErrorResponse.java @@ -16,7 +16,7 @@ import java.io.IOException; /** * Response sent when there is a server side error. */ -public class ErrorResponse extends AbstractErrorResponse { +public class ErrorResponse extends AbstractErrorResponse { public ErrorResponse(RequestType requestType, String message, String cause, String stack) { super(requestType, message, cause, stack); } diff --git a/sql/cli-proto/src/main/java/org/elasticsearch/xpack/sql/cli/net/protocol/ExceptionResponse.java b/sql/cli-proto/src/main/java/org/elasticsearch/xpack/sql/cli/net/protocol/ExceptionResponse.java index 7751802ff8a..ce635671a61 100644 --- a/sql/cli-proto/src/main/java/org/elasticsearch/xpack/sql/cli/net/protocol/ExceptionResponse.java +++ b/sql/cli-proto/src/main/java/org/elasticsearch/xpack/sql/cli/net/protocol/ExceptionResponse.java @@ -17,7 +17,7 @@ import java.io.IOException; /** * Response sent when there is a client side error. */ -public class ExceptionResponse extends AbstractExceptionResponse { +public class ExceptionResponse extends AbstractExceptionResponse { public ExceptionResponse(RequestType requestType, String message, String cause, SqlExceptionType exceptionType) { super(requestType, message, cause, exceptionType); } diff --git a/sql/jdbc-proto/src/main/java/org/elasticsearch/xpack/sql/jdbc/net/protocol/ErrorResponse.java b/sql/jdbc-proto/src/main/java/org/elasticsearch/xpack/sql/jdbc/net/protocol/ErrorResponse.java index 6610384d813..eaa240e0266 100644 --- a/sql/jdbc-proto/src/main/java/org/elasticsearch/xpack/sql/jdbc/net/protocol/ErrorResponse.java +++ b/sql/jdbc-proto/src/main/java/org/elasticsearch/xpack/sql/jdbc/net/protocol/ErrorResponse.java @@ -16,7 +16,7 @@ import java.io.IOException; /** * Response sent when there is a server side error. */ -public class ErrorResponse extends AbstractErrorResponse { +public class ErrorResponse extends AbstractErrorResponse { public ErrorResponse(RequestType requestType, String message, String cause, String stack) { super(requestType, message, cause, stack); } diff --git a/sql/jdbc-proto/src/main/java/org/elasticsearch/xpack/sql/jdbc/net/protocol/ExceptionResponse.java b/sql/jdbc-proto/src/main/java/org/elasticsearch/xpack/sql/jdbc/net/protocol/ExceptionResponse.java index 7fadb708125..4ce83a8d078 100644 --- a/sql/jdbc-proto/src/main/java/org/elasticsearch/xpack/sql/jdbc/net/protocol/ExceptionResponse.java +++ b/sql/jdbc-proto/src/main/java/org/elasticsearch/xpack/sql/jdbc/net/protocol/ExceptionResponse.java @@ -17,7 +17,7 @@ import java.io.IOException; /** * Response sent when there is a client side error. */ -public class ExceptionResponse extends AbstractExceptionResponse { +public class ExceptionResponse extends AbstractExceptionResponse { public ExceptionResponse(RequestType requestType, String message, String cause, SqlExceptionType exceptionType) { super(requestType, message, cause, exceptionType); } diff --git a/sql/server/src/main/java/org/elasticsearch/xpack/sql/plugin/AbstractSqlServer.java b/sql/server/src/main/java/org/elasticsearch/xpack/sql/plugin/AbstractSqlServer.java index c18f3269bee..aaa4699d695 100644 --- a/sql/server/src/main/java/org/elasticsearch/xpack/sql/plugin/AbstractSqlServer.java +++ b/sql/server/src/main/java/org/elasticsearch/xpack/sql/plugin/AbstractSqlServer.java @@ -57,9 +57,9 @@ public abstract class AbstractSqlServer { } protected abstract void innerHandle(Request req, ActionListener listener); - protected abstract AbstractExceptionResponse buildExceptionResponse(Request request, String message, String cause, + protected abstract AbstractExceptionResponse buildExceptionResponse(Request request, String message, String cause, SqlExceptionType exceptionType); - protected abstract AbstractErrorResponse buildErrorResponse(Request request, String message, String cause, String stack); + protected abstract AbstractErrorResponse buildErrorResponse(Request request, String message, String cause, String stack); public static BytesReference write(int clientVersion, Response response) throws IOException { try (BytesStreamOutput array = new BytesStreamOutput(); diff --git a/sql/shared-proto/src/main/java/org/elasticsearch/xpack/sql/protocol/shared/AbstractErrorResponse.java b/sql/shared-proto/src/main/java/org/elasticsearch/xpack/sql/protocol/shared/AbstractErrorResponse.java index bdadeaaeeae..e2f5fa29842 100644 --- a/sql/shared-proto/src/main/java/org/elasticsearch/xpack/sql/protocol/shared/AbstractErrorResponse.java +++ b/sql/shared-proto/src/main/java/org/elasticsearch/xpack/sql/protocol/shared/AbstractErrorResponse.java @@ -15,18 +15,18 @@ import java.util.Objects; /** * Response sent when there is a server side error. */ -public abstract class AbstractErrorResponse extends Response { - private final RequestTypeT requestType; +public abstract class AbstractErrorResponse extends Response { + private final RequestType requestType; public final String message, cause, stack; - protected AbstractErrorResponse(RequestTypeT requestType, String message, String cause, String stack) { + protected AbstractErrorResponse(RequestType requestType, String message, String cause, String stack) { this.requestType = requestType; this.message = message; this.cause = cause; this.stack = stack; } - protected AbstractErrorResponse(RequestTypeT requestType, DataInput in) throws IOException { + protected AbstractErrorResponse(RequestType requestType, DataInput in) throws IOException { this.requestType = requestType; message = in.readUTF(); cause = in.readUTF(); @@ -41,7 +41,7 @@ public abstract class AbstractErrorResponse ex } @Override - public RequestTypeT requestType() { // NOCOMMIT do I need the T? + public RequestType requestType() { return requestType; } @@ -58,7 +58,7 @@ public abstract class AbstractErrorResponse ex if (obj == null || obj.getClass() != getClass()) { return false; } - AbstractErrorResponse other = (AbstractErrorResponse) obj; + AbstractErrorResponse other = (AbstractErrorResponse) obj; return Objects.equals(requestType, other.requestType) && Objects.equals(message, other.message) && Objects.equals(cause, other.cause) diff --git a/sql/shared-proto/src/main/java/org/elasticsearch/xpack/sql/protocol/shared/AbstractExceptionResponse.java b/sql/shared-proto/src/main/java/org/elasticsearch/xpack/sql/protocol/shared/AbstractExceptionResponse.java index 2ba098e9cbd..732b038aea4 100644 --- a/sql/shared-proto/src/main/java/org/elasticsearch/xpack/sql/protocol/shared/AbstractExceptionResponse.java +++ b/sql/shared-proto/src/main/java/org/elasticsearch/xpack/sql/protocol/shared/AbstractExceptionResponse.java @@ -17,12 +17,12 @@ import java.util.Objects; /** * Response sent when there is a client side error. */ -public abstract class AbstractExceptionResponse extends Response { - private final RequestTypeT requestType; +public abstract class AbstractExceptionResponse extends Response { + private final RequestType requestType; public final String message, cause; private SqlExceptionType exceptionType; - protected AbstractExceptionResponse(RequestTypeT requestType, String message, String cause, SqlExceptionType exceptionType) { + protected AbstractExceptionResponse(RequestType requestType, String message, String cause, SqlExceptionType exceptionType) { if (requestType == null) { throw new IllegalArgumentException("[requestType] cannot be null"); } @@ -41,7 +41,7 @@ public abstract class AbstractExceptionResponse other = (AbstractExceptionResponse) obj; + AbstractExceptionResponse other = (AbstractExceptionResponse) obj; return Objects.equals(requestType, other.requestType) && Objects.equals(message, other.message) && Objects.equals(cause, other.cause)