Skip to content

Commit d1d744f

Browse files
author
Stephane Landelle
committed
Clean up warnings
1 parent d1a4182 commit d1d744f

15 files changed

+27
-7
lines changed

src/main/java/com/ning/http/client/AsyncHttpClient.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ public BoundRequestBuilder prepareRequest(Request request) {
482482
* @return a {@link Future} of type T
483483
* @throws IOException
484484
*/
485+
@SuppressWarnings({ "rawtypes", "unchecked" })
485486
public <T> ListenableFuture<T> executeRequest(Request request, AsyncHandler<T> handler) throws IOException {
486487

487488
FilterContext fc = new FilterContext.FilterContextBuilder().asyncHandler(handler).request(request).build();
@@ -497,6 +498,7 @@ public <T> ListenableFuture<T> executeRequest(Request request, AsyncHandler<T> h
497498
* @return a {@link Future} of type Response
498499
* @throws IOException
499500
*/
501+
@SuppressWarnings({ "rawtypes", "unchecked" })
500502
public ListenableFuture<Response> executeRequest(Request request) throws IOException {
501503
FilterContext fc = new FilterContext.FilterContextBuilder().asyncHandler(new AsyncCompletionHandlerBase()).request(request).build();
502504
fc = preProcessRequest(fc);
@@ -509,6 +511,7 @@ public ListenableFuture<Response> executeRequest(Request request) throws IOExcep
509511
* @param fc {@link FilterContext}
510512
* @return {@link FilterContext}
511513
*/
514+
@SuppressWarnings("rawtypes")
512515
private FilterContext preProcessRequest(FilterContext fc) throws IOException {
513516
for (RequestFilter asyncFilter : config.getRequestFilters()) {
514517
try {

src/main/java/com/ning/http/client/extra/ResumableRandomAccessFileListener.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414

1515
import com.ning.http.client.resumable.ResumableListener;
1616

17-
import org.slf4j.Logger;
18-
import org.slf4j.LoggerFactory;
19-
2017
import java.io.IOException;
2118
import java.io.RandomAccessFile;
2219
import java.nio.ByteBuffer;
@@ -26,7 +23,6 @@
2623
*/
2724
public class ResumableRandomAccessFileListener implements ResumableListener {
2825
private final RandomAccessFile file;
29-
private final static Logger logger = LoggerFactory.getLogger(ThrottleRequestFilter.class);
3026

3127
public ResumableRandomAccessFileListener(RandomAccessFile file) {
3228
this.file = file;

src/main/java/com/ning/http/client/extra/ThrottleRequestFilter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public ThrottleRequestFilter(int maxConnections, int maxWait) {
4646
}
4747

4848
@Override
49+
@SuppressWarnings({ "rawtypes", "unchecked" })
4950
public FilterContext filter(FilterContext ctx) throws FilterException {
5051

5152
try {

src/main/java/com/ning/http/client/filter/FilterContext.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@
3333
*/
3434
public class FilterContext<T> {
3535

36+
@SuppressWarnings("rawtypes")
3637
private final FilterContextBuilder b;
3738

3839
/**
3940
* Create a new {@link FilterContext}
4041
*
4142
* @param b a {@link FilterContextBuilder}
4243
*/
43-
private FilterContext(FilterContextBuilder b) {
44+
private FilterContext(@SuppressWarnings("rawtypes") FilterContextBuilder b) {
4445
this.b = b;
4546
}
4647

@@ -49,6 +50,7 @@ private FilterContext(FilterContextBuilder b) {
4950
*
5051
* @return the original or decorated {@link AsyncHandler}
5152
*/
53+
@SuppressWarnings("unchecked")
5254
public AsyncHandler<T> getAsyncHandler() {
5355
return b.asyncHandler;
5456
}
@@ -107,6 +109,7 @@ public static class FilterContextBuilder<T> {
107109
public FilterContextBuilder() {
108110
}
109111

112+
@SuppressWarnings({ "rawtypes", "unchecked" })
110113
public FilterContextBuilder(FilterContext clone) {
111114
asyncHandler = clone.getAsyncHandler();
112115
request = clone.getRequest();
@@ -119,6 +122,7 @@ public AsyncHandler<T> getAsyncHandler() {
119122
return asyncHandler;
120123
}
121124

125+
@SuppressWarnings("rawtypes")
122126
public FilterContextBuilder asyncHandler(AsyncHandler<T> asyncHandler) {
123127
this.asyncHandler = asyncHandler;
124128
return this;
@@ -128,34 +132,39 @@ public Request getRequest() {
128132
return request;
129133
}
130134

135+
@SuppressWarnings("rawtypes")
131136
public FilterContextBuilder request(Request request) {
132137
this.request = request;
133138
return this;
134139
}
135140

141+
@SuppressWarnings("rawtypes")
136142
public FilterContextBuilder responseStatus(HttpResponseStatus responseStatus) {
137143
this.responseStatus = responseStatus;
138144
return this;
139145
}
140146

147+
@SuppressWarnings("rawtypes")
141148
public FilterContextBuilder responseHeaders(HttpResponseHeaders headers) {
142149
this.headers = headers;
143150
return this;
144151
}
145152

153+
@SuppressWarnings("rawtypes")
146154
public FilterContextBuilder replayRequest(boolean replayRequest) {
147155
this.replayRequest = replayRequest;
148156
return this;
149157
}
150158

159+
@SuppressWarnings("rawtypes")
151160
public FilterContextBuilder ioException(IOException ioException) {
152161
this.ioException = ioException;
153162
return this;
154163
}
155164

165+
@SuppressWarnings("rawtypes")
156166
public FilterContext build() {
157167
return new FilterContext(this);
158168
}
159169
}
160-
161170
}

src/main/java/com/ning/http/client/filter/FilterException.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* An exception that can be thrown by an {@link com.ning.http.client.AsyncHandler} to interrupt invocation of
1717
* the {@link RequestFilter} and {@link ResponseFilter}. It also interrupt the request and response processing.
1818
*/
19+
@SuppressWarnings("serial")
1920
public class FilterException extends Exception {
2021

2122
/**

src/main/java/com/ning/http/client/filter/IOExceptionFilter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ public interface IOExceptionFilter {
2525
* @return {@link FilterContext}. The {@link FilterContext} instance may not the same as the original one.
2626
* @throws FilterException to interrupt the filter processing.
2727
*/
28+
@SuppressWarnings("rawtypes")
2829
FilterContext filter(FilterContext ctx) throws FilterException;
2930
}

src/main/java/com/ning/http/client/filter/RequestFilter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ public interface RequestFilter {
2626
* @return {@link FilterContext}. The {@link FilterContext} instance may not the same as the original one.
2727
* @throws FilterException to interrupt the filter processing.
2828
*/
29+
@SuppressWarnings("rawtypes")
2930
FilterContext filter(FilterContext ctx) throws FilterException;
3031
}

src/main/java/com/ning/http/client/filter/ResponseFilter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ public interface ResponseFilter {
2929
* @return {@link FilterContext}. The {@link FilterContext} instance may not the same as the original one.
3030
* @throws FilterException to interrupt the filter processing.
3131
*/
32+
@SuppressWarnings("rawtypes")
3233
FilterContext filter(FilterContext ctx) throws FilterException;
3334
}

src/main/java/com/ning/http/client/listener/TransferCompletionHandler.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.ning.http.client.Response;
2323

2424
import java.util.concurrent.ConcurrentLinkedQueue;
25-
import java.util.concurrent.atomic.AtomicLong;
2625

2726
/**
2827
* A {@link org.asynchttpclient.AsyncHandler} that can be used to notify a set of {@link TransferListener}

src/main/java/com/ning/http/client/providers/netty/request/NettyRequestSender.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ private <T> ListenableFuture<T> sendRequestWithCertainForceConnect(//
144144
* Loop until we get a valid channel from the pool and it's still valid
145145
* once the request is built
146146
*/
147+
@SuppressWarnings("unused")
147148
private <T> ListenableFuture<T> sendRequestThroughSslProxy(//
148149
Request request,//
149150
AsyncHandler<T> asyncHandler,//
@@ -450,6 +451,7 @@ public boolean applyIoExceptionFiltersAndReplayRequest(NettyResponseFuture<?> fu
450451

451452
boolean replayed = false;
452453

454+
@SuppressWarnings({ "unchecked", "rawtypes" })
453455
FilterContext<?> fc = new FilterContext.FilterContextBuilder().asyncHandler(future.getAsyncHandler()).request(future.getRequest())
454456
.ioException(e).build();
455457
for (IOExceptionFilter asyncFilter : config.getIOExceptionFilters()) {

src/main/java/com/ning/http/client/resumable/ResumableAsyncHandler.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ public AsyncHandler.STATE onBodyPartReceived(HttpResponseBodyPart bodyPart) thro
147147
return state;
148148
}
149149

150+
@SuppressWarnings("unchecked")
150151
@Override
151152
public T onCompleted() throws Exception {
152153
resumableProcessor.remove(url);
@@ -207,6 +208,7 @@ public Request adjustRequestRange(Request request) {
207208
* @param resumableListener a {@link ResumableListener}
208209
* @return this
209210
*/
211+
@SuppressWarnings("rawtypes")
210212
public ResumableAsyncHandler setResumableListener(ResumableListener resumableListener) {
211213
this.resumableListener = resumableListener;
212214
return this;

src/main/java/com/ning/http/client/resumable/ResumableIOExceptionFilter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* a {@link ResumableAsyncHandler}
2323
*/
2424
public class ResumableIOExceptionFilter implements IOExceptionFilter {
25+
@SuppressWarnings("rawtypes")
2526
public FilterContext filter(FilterContext ctx) throws FilterException {
2627
if (ctx.getIOException() != null && ctx.getAsyncHandler() instanceof ResumableAsyncHandler) {
2728

src/main/java/com/ning/http/client/websocket/WebSocketUpgradeHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class WebSocketUpgradeHandler implements UpgradeHandler<WebSocket>, Async
2828

2929
private WebSocket webSocket;
3030
private final ConcurrentLinkedQueue<WebSocketListener> l;
31+
// FIXME use?
3132
private final String protocol;
3233
private final long maxByteSize;
3334
private final long maxTextSize;

src/main/java/com/ning/http/util/AsyncHttpProviderUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public final static byte[] contentToByte(List<HttpResponseBodyPart> bodyParts) t
8383
}
8484
}
8585

86+
@SuppressWarnings("resource")
8687
public final static InputStream contentToInputStream(List<HttpResponseBodyPart> bodyParts) throws UnsupportedEncodingException {
8788
return bodyParts.isEmpty() ? new ByteArrayInputStream(EMPTY_BYTE_ARRAY) : new HttpResponseBodyPartsInputStream(bodyParts);
8889
}

src/main/java/com/ning/http/util/ProxyHostnameChecker.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public ProxyHostnameChecker() {
3333
private Object getHostnameChecker() {
3434
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
3535
try {
36+
@SuppressWarnings("unchecked")
3637
final Class<Object> hostnameCheckerClass = (Class<Object>) classLoader.loadClass("sun.security.util.HostnameChecker");
3738
final Method instanceMethod = hostnameCheckerClass.getMethod("getInstance", Byte.TYPE);
3839
return instanceMethod.invoke(null, TYPE_TLS);

0 commit comments

Comments
 (0)