Skip to content

Commit

Permalink
Update airlift to 0.214
Browse files Browse the repository at this point in the history
  • Loading branch information
NikhilCollooru committed Aug 1, 2024
1 parent 8e95218 commit 305d1de
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 33 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<air.maven.version>3.3.9</air.maven.version>

<dep.antlr.version>4.7.1</dep.antlr.version>
<dep.airlift.version>0.209</dep.airlift.version>
<dep.airlift.version>0.214</dep.airlift.version>
<dep.packaging.version>${dep.airlift.version}</dep.packaging.version>
<dep.slice.version>0.38</dep.slice.version>
<dep.testing-mysql-server-5.version>0.6</dep.testing-mysql-server-5.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ public interface BaseResponse<T>
{
int getStatusCode();

String getStatusMessage();

String getHeader(String name);

List<String> getHeaders(String name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public SmileResponse<T> handle(Request request, Response response)
byte[] bytes = readResponseBytes(response);
String contentType = response.getHeader(CONTENT_TYPE);
if ((contentType == null) || !MediaType.parse(contentType).is(MEDIA_TYPE_SMILE)) {
return new SmileResponse<>(response.getStatusCode(), response.getStatusMessage(), response.getHeaders(), bytes);
return new SmileResponse<>(response.getStatusCode(), response.getHeaders(), bytes);
}
return new SmileResponse<>(response.getStatusCode(), response.getStatusMessage(), response.getHeaders(), smileCodec, bytes);
return new SmileResponse<>(response.getStatusCode(), response.getHeaders(), smileCodec, bytes);
}

private static byte[] readResponseBytes(Response response)
Expand All @@ -80,18 +80,16 @@ public static class SmileResponse<T>
implements BaseResponse<T>
{
private final int statusCode;
private final String statusMessage;
private final ListMultimap<HeaderName, String> headers;
private final boolean hasValue;
private final byte[] smileBytes;
private final byte[] responseBytes;
private final T value;
private final IllegalArgumentException exception;

public SmileResponse(int statusCode, String statusMessage, ListMultimap<HeaderName, String> headers, byte[] responseBytes)
public SmileResponse(int statusCode, ListMultimap<HeaderName, String> headers, byte[] responseBytes)
{
this.statusCode = statusCode;
this.statusMessage = statusMessage;
this.headers = ImmutableListMultimap.copyOf(headers);

this.hasValue = false;
Expand All @@ -102,10 +100,9 @@ public SmileResponse(int statusCode, String statusMessage, ListMultimap<HeaderNa
}

@SuppressWarnings("ThrowableInstanceNeverThrown")
public SmileResponse(int statusCode, String statusMessage, ListMultimap<HeaderName, String> headers, SmileCodec<T> smileCodec, byte[] smileBytes)
public SmileResponse(int statusCode, ListMultimap<HeaderName, String> headers, SmileCodec<T> smileCodec, byte[] smileBytes)
{
this.statusCode = statusCode;
this.statusMessage = statusMessage;
this.headers = ImmutableListMultimap.copyOf(headers);

this.smileBytes = requireNonNull(smileBytes, "smileBytes is null");
Expand All @@ -131,12 +128,6 @@ public int getStatusCode()
return statusCode;
}

@Override
public String getStatusMessage()
{
return statusMessage;
}

@Override
public String getHeader(String name)
{
Expand Down Expand Up @@ -201,7 +192,6 @@ public String toString()
{
return toStringHelper(this)
.add("statusCode", statusCode)
.add("statusMessage", statusMessage)
.add("headers", headers)
.add("hasValue", hasValue)
.add("value", value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ public int getStatusCode()
return jsonResponse.getStatusCode();
}

@Override
public String getStatusMessage()
{
return jsonResponse.getStatusMessage();
}

@Override
public String getHeader(String name)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ public BaseResponse<byte[]> handle(Request request, Response response)
{
return new BytesResponse(
response.getStatusCode(),
response.getStatusMessage(),
response.getHeaders(),
readResponseBytes(response));
}
Expand All @@ -388,14 +387,12 @@ private static class BytesResponse
implements BaseResponse<byte[]>
{
private final int statusCode;
private final String statusMessage;
private final ListMultimap<HeaderName, String> headers;
private final byte[] bytes;

public BytesResponse(int statusCode, String statusMessage, ListMultimap<HeaderName, String> headers, byte[] bytes)
public BytesResponse(int statusCode, ListMultimap<HeaderName, String> headers, byte[] bytes)
{
this.statusCode = statusCode;
this.statusMessage = requireNonNull(statusMessage, "statusMessage is null");
this.headers = ImmutableListMultimap.copyOf(requireNonNull(headers, "headers is null"));
this.bytes = bytes;
}
Expand All @@ -406,12 +403,6 @@ public int getStatusCode()
return statusCode;
}

@Override
public String getStatusMessage()
{
return statusMessage;
}

@Override
public String getHeader(String name)
{
Expand Down

0 comments on commit 305d1de

Please sign in to comment.