8000 Further warning cleanup, "only" 200 left (mostly trying to resolve ge… · killerwhile/async-http-client@8194daf · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Mar 6, 2021. It is now read-only.

Commit 8194daf

Browse files
committed
Further warning cleanup, "only" 200 left (mostly trying to resolve generic type tangle)
1 parent 2b8dc69 commit 8194daf

28 files changed

+58
-63
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ private <T> FilterContext<T> preProcessRequest(FilterContext<T> fc) throws IOExc
555555
builder.setHeader("Range", "bytes=" + request.getRangeOffset() + "-");
556556
request = builder.build();
557557
}
558-
fc = new FilterContext.FilterContextBuilder(fc).request(request).build();
558+
fc = new FilterContext.FilterContextBuilder<T>(fc).request(request).build();
559559
return fc;
560560
}
561561

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public interface ListenableFuture<V> extends Future<V> {
4646
*
4747
* @param callable
4848
*/
49-
void done(Callable callable);
49+
void done(Callable<?> callable);
5050

5151
/**
5252
* Abort the current processing, and propagate the {@link Throwable} to the {@link AsyncHandler} or {@link Future}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,6 @@ public int hashCode() {
257257
* A builder for {@link Realm}
258258
*/
259259
public static class RealmBuilder {
260-
261-
private static final Logger logger = LoggerFactory.getLogger(RealmBuilder.class);
262-
263260
//
264261
// Portions of code (newCnonce, newResponse) are highly inspired be Jetty 6 BasicAuthentication.java class.
265262
// This code is already Apache licenced.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
*/
2626
public class ResumableRandomAccessFileListener implements ResumableListener {
2727
private final RandomAccessFile file;
28-
private final static Logger logger = LoggerFactory.getLogger(ThrottleRequestFilter.class);
2928

3029
public ResumableRandomAccessFileListener(RandomAccessFile file) {
3130
this.file = file;

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
*/
3232
public class ThrottleRequestFilter implements RequestFilter {
3333
private final static Logger logger = LoggerFactory.getLogger(ThrottleRequestFilter.class);
34+
@SuppressWarnings("unused")
3435
private final int maxConnections;
3536
private final Semaphore available;
3637
private final int maxWait;
@@ -51,7 +52,7 @@ public ThrottleRequestFilter(int maxConnections, int maxWait) {
5152
* {@inheritDoc}
5253
*/
5354
/* @Override */
54-
public FilterContext filter(FilterContext ctx) throws FilterException {
55+
public <T> FilterContext<T> filter(FilterContext<T> ctx) throws FilterException {
5556

5657
try {
5758
if (logger.isDebugEnabled()) {
@@ -68,10 +69,10 @@ public FilterContext filter(FilterContext ctx) throws FilterException {
6869
String.format("Interrupted Request %s with AsyncHandler %s", ctx.getRequest(), ctx.getAsyncHandler()));
6970
}
7071

71-
return new FilterContext.FilterContextBuilder(ctx).asyncHandler(new AsyncHandlerWrapper(ctx.getAsyncHandler())).build();
72+
return new FilterContext.FilterContextBuilder<T>(ctx).asyncHandler(new AsyncHandlerWrapper<T>(ctx.getAsyncHandler())).build();
7273
}
7374

74-
private class AsyncHandlerWrapper<T> implements AsyncHandler {
75+
private class AsyncHandlerWrapper<T> implements AsyncHandler<T> {
7576

7677
private final AsyncHandler<T> asyncHandler;
7778

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/ResponseFilter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,5 @@ 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-
public FilterContext filter(FilterContext ctx) throws FilterException;
33-
32+
public <T> FilterContext<T> filter(FilterContext<T> ctx) throws FilterException;
3433
}

src/main/java/com/ning/http/client/providers/apache/ApacheAsyncHttpProvider.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import org.apache.commons.httpclient.Credentials;
4848
import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
4949
import org.apache.commons.httpclient.Header;
50-
import org.apache.commons.httpclient.HostConfiguration;
5150
import org.apache.commons.httpclient.HttpClient;
5251
import org.apache.commons.httpclient.HttpMethodBase;
5352
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
@@ -205,7 +204,7 @@ public <T> ListenableFuture<T> execute(Request request, AsyncHandler<T> handler)
205204
ApacheResponseFuture<T> f = new ApacheResponseFuture<T>(handler, requestTimeout, request, method);
206205
f.touch();
207206

208-
f.setInnerFuture(config.executorService().submit(new ApacheClientRunnable(request, handler, method, f, httpClient)));
207+
f.setInnerFuture(config.executorService().submit(new ApacheClientRunnable<T>(request, handler, method, f, httpClient)));
209208
maxConnections.incrementAndGet();
210209
return f;
211210
}
@@ -456,7 +455,7 @@ public T call() {
456455
int delay = requestTimeout(config, future.getRequest().getPerRequestConfig());
457456
if (delay != -1) {
458457
ReaperFuture reaperFuture = new ReaperFuture(future);
459-
Future scheduledFuture = config.reaper().scheduleAtFixedRate(reaperFuture, delay, 500, TimeUnit.MILLISECONDS);
458+
Future<?> scheduledFuture = config.reaper().scheduleAtFixedRate(reaperFuture, delay, 500, TimeUnit.MILLISECONDS);
460459
reaperFuture.setScheduledFuture(scheduledFuture);
461460
future.setReaperFuture(reaperFuture);
462461
}
@@ -475,7 +474,7 @@ public T call() {
475474
}
476475

477476
ApacheResponseStatus status = new ApacheResponseStatus(uri, method, ApacheAsyncHttpProvider.this);
478-
FilterContext fc = new FilterContext.FilterContextBuilder().asyncHandler(asyncHandler).request(request).responseStatus(status).build();
477+
FilterContext<T> fc = new FilterContext.FilterContextBuilder<T>().asyncHandler(asyncHandler).request(request).responseStatus(status).build();
479478
F438 for (ResponseFilter asyncFilter : config.getResponseFilters()) {
480479
fc = asyncFilter.filter(fc);
481480
if (fc == null) {
@@ -594,7 +593,7 @@ public T call() {
594593
} catch (Throwable t) {
595594

596595
if (IOException.class.isAssignableFrom(t.getClass()) && config.getIOExceptionFilters().size() > 0) {
597-
FilterContext fc = new FilterContext.FilterContextBuilder().asyncHandler(asyncHandler)
596+
FilterContext<T> fc = new FilterContext.FilterContextBuilder<T>().asyncHandler(asyncHandler)
598597
.request(future.getRequest()).ioException(IOException.class.cast(t)).build();
599598

600599
try {
@@ -666,7 +665,7 @@ private Throwable filterException(Throwable t) {
666665
return t;
667666
}
668667

669-
private FilterContext handleIoException(FilterContext fc) throws FilterException {
668+
private FilterContext<T> handleIoException(FilterContext<T> fc) throws FilterException {
670669
for (IOExceptionFilter asyncFilter : config.getIOExceptionFilters()) {
671670
fc = asyncFilter.filter(fc);
672671
if (fc == null) {

src/main/java/com/ning/http/client/providers/grizzly/GrizzlyConnectionsPool.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,7 @@ public void run() {
315315

316316
final TimeoutResolver resolver = delayQueue.resolver;
317317

318-
for (@SuppressWarnings("rawtypes")
319-
Iterator<Connection> it = delayQueue.queue.iterator(); it.hasNext(); ) {
318+
for (Iterator<Connection> it = delayQueue.queue.iterator(); it.hasNext(); ) {
320319
final Connection<?> element = (Connection<?>) it.next();
321320
final Long timeoutMs = resolver.getTimeoutMs(element);
322321

src/main/java/com/ning/http/client/providers/jdk/JDKAsyncHttpProvider.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public <T> ListenableFuture<T> execute(Request request, AsyncHandler<T> handler)
121121
return execute(request, handler, null);
122122
}
123123

124-
public <T> ListenableFuture<T> execute(Request request, AsyncHandler<T> handler, ListenableFuture<?> future) throws IOException {
124+
public <T> ListenableFuture<T> execute(Request request, AsyncHandler<T> handler, ListenableFuture<T> future) throws IOException {
125125
if (isClose.get()) {
126126
throw new IOException("Closed");
127127
}
@@ -133,10 +133,9 @@ public <T> ListenableFuture<T> execute(Request request, AsyncHandler<T> handler,
133133
ProxyServer proxyServer = request.getProxyServer() != null ? request.getProxyServer() : config.getProxyServer();
134134
Realm realm = request.getRealm() != null ? request.getRealm() : config.getRealm();
135135
boolean avoidProxy = ProxyUtils.avoidProxy(proxyServer, request);
136-
Proxy proxy = null;
137136
if (!avoidProxy && (proxyServer != null || realm != null)) {
138137
try {
139-
proxy = configureProxyAndAuth(proxyServer, realm);
138+
/*Proxy proxy =*/ configureProxyAndAuth(proxyServer, realm);
140139
} catch (AuthenticationException e) {
141140
throw new IOException(e.getMessage());
142141
}
@@ -148,15 +147,15 @@ public <T> ListenableFuture<T> execute(Request request, AsyncHandler<T> handler,
148147
int requestTimeout = (conf != null && conf.getRequestTimeoutInMs() != 0) ?
149148
conf.getRequestTimeoutInMs() : config.getRequestTimeoutInMs();
150149

151-
JDKDelegateFuture delegate = null;
150+
JDKDelegateFuture<T> delegate = null;
152151
if (future != null) {
153-
delegate = new JDKDelegateFuture(handler, requestTimeout, future, urlConnection);
152+
delegate = new JDKDelegateFuture<T>(handler, requestTimeout, future, urlConnection);
154153
}
155154

156-
JDKFuture f = delegate == null ? new JDKFuture<T>(handler, requestTimeout, urlConnection) : delegate;
155+
JDKFuture<T> f = (delegate == null) ? new JDKFuture<T>(handler, requestTimeout, urlConnection) : delegate;
157156
f.touch();
158157

159-
f.setInnerFuture(config.executorService().submit(new AsyncHttpUrlConnection(urlConnection, request, handler, f)));
158+
f.setInnerFuture(config.executorService().submit(new AsyncHttpUrlConnection<T>(urlConnection, request, handler, f)));
160159
maxConnections.incrementAndGet();
161160

162161
return f;
@@ -252,7 +251,7 @@ public T call() throws Exception {
252251
logger.debug("\n\nRequest {}\n\nResponse {}\n", request, statusCode);
253252

254253
ResponseStatus status = new ResponseStatus(uri, urlConnection, JDKAsyncHttpProvider.this);
255-
FilterContext fc = new FilterContext.FilterContextBuilder().asyncHandler(asyncHandler).request(request).responseStatus(status).build();
254+
FilterContext<T> fc = new FilterContext.FilterContextBuilder<T>().asyncHandler(asyncHandler).request(request).responseStatus(status).build();
256255
for (ResponseFilter asyncFilter : config.getResponseFilters()) {
257256
fc = asyncFilter.filter(fc);
258257
if (fc == null) {

0 commit comments

Comments
 (0)
0