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@5005b26c09
This commit is contained in:
Nik Everett 2017-09-18 16:06:05 -04:00 committed by GitHub
parent 759411571e
commit 204e340397
7 changed files with 18 additions and 18 deletions

View File

@ -16,7 +16,7 @@ import java.io.IOException;
/**
* Response sent when there is a server side error.
*/
public class ErrorResponse extends AbstractErrorResponse<RequestType> {
public class ErrorResponse extends AbstractErrorResponse {
public ErrorResponse(RequestType requestType, String message, String cause, String stack) {
super(requestType, message, cause, stack);
}

View File

@ -17,7 +17,7 @@ import java.io.IOException;
/**
* Response sent when there is a client side error.
*/
public class ExceptionResponse extends AbstractExceptionResponse<RequestType> {
public class ExceptionResponse extends AbstractExceptionResponse {
public ExceptionResponse(RequestType requestType, String message, String cause, SqlExceptionType exceptionType) {
super(requestType, message, cause, exceptionType);
}

View File

@ -16,7 +16,7 @@ import java.io.IOException;
/**
* Response sent when there is a server side error.
*/
public class ErrorResponse extends AbstractErrorResponse<RequestType> {
public class ErrorResponse extends AbstractErrorResponse {
public ErrorResponse(RequestType requestType, String message, String cause, String stack) {
super(requestType, message, cause, stack);
}

View File

@ -17,7 +17,7 @@ import java.io.IOException;
/**
* Response sent when there is a client side error.
*/
public class ExceptionResponse extends AbstractExceptionResponse<RequestType> {
public class ExceptionResponse extends AbstractExceptionResponse {
public ExceptionResponse(RequestType requestType, String message, String cause, SqlExceptionType exceptionType) {
super(requestType, message, cause, exceptionType);
}

View File

@ -57,9 +57,9 @@ public abstract class AbstractSqlServer {
}
protected abstract void innerHandle(Request req, ActionListener<Response> 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();

View File

@ -15,18 +15,18 @@ import java.util.Objects;
/**
* Response sent when there is a server side error.
*/
public abstract class AbstractErrorResponse<RequestTypeT extends RequestType> 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<RequestTypeT extends RequestType> ex
}
@Override
public RequestTypeT requestType() { // NOCOMMIT do I need the T?
public RequestType requestType() {
return requestType;
}
@ -58,7 +58,7 @@ public abstract class AbstractErrorResponse<RequestTypeT extends RequestType> 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)

View File

@ -17,12 +17,12 @@ import java.util.Objects;
/**
* Response sent when there is a client side error.
*/
public abstract class AbstractExceptionResponse<RequestTypeT extends RequestType> 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<RequestTypeT extends RequestType
this.exceptionType = exceptionType;
}
protected AbstractExceptionResponse(RequestTypeT requestType, DataInput in) throws IOException {
protected AbstractExceptionResponse(RequestType requestType, DataInput in) throws IOException {
this.requestType = requestType;
message = in.readUTF();
cause = in.readUTF();
@ -56,7 +56,7 @@ public abstract class AbstractExceptionResponse<RequestTypeT extends RequestType
}
@Override
public RequestTypeT requestType() {
public RequestType requestType() {
return requestType;
}
@ -73,7 +73,7 @@ public abstract class AbstractExceptionResponse<RequestTypeT extends RequestType
if (obj == null || obj.getClass() != getClass()) {
return false;
}
AbstractExceptionResponse<?> other = (AbstractExceptionResponse<?>) obj;
AbstractExceptionResponse other = (AbstractExceptionResponse) obj;
return Objects.equals(requestType, other.requestType)
&& Objects.equals(message, other.message)
&& Objects.equals(cause, other.cause)