From fbf477f861b049b5ce2478871e2823ef2837a012 Mon Sep 17 00:00:00 2001 From: Lorenz Nickel Date: Fri, 11 Dec 2020 16:39:57 +0100 Subject: [PATCH 1/2] Fix typos --- .../AsyncHttpClientConfig.java | 2 +- .../handler/resumable/ResumableListener.java | 2 +- .../netty/channel/ChannelManager.java | 6 ++--- .../request/body/multipart/FileLikePart.java | 6 ++--- .../request/body/multipart/PartBase.java | 2 +- .../spnego/NamePasswordCallbackHandler.java | 2 +- .../util/StringBuilderPool.java | 2 +- .../org/asynchttpclient/BasicAuthTest.java | 4 ++-- .../org/asynchttpclient/BasicHttpTest.java | 2 +- ...ropertiesBasedResumableProcessorTest.java} | 2 +- .../ReactiveStreamsDownloadTest.java | 6 ++--- .../request/body/ChunkingTest.java | 2 +- .../request/body/FilePartLargeFileTest.java | 2 +- .../request/body/TransferListenerTest.java | 24 +++++++++---------- .../body/multipart/MultipartBodyTest.java | 8 +++---- .../multipart/part/MultipartPartTest.java | 8 +++---- .../RateLimitedThrottleRequestFilter.java | 10 ++++---- .../registry/AsyncHttpClientFactory.java | 2 +- .../extras/rxjava2/RxHttpClient.java | 2 +- .../AbstractMaybeAsyncHandlerBridge.java | 2 +- .../rxjava2/DefaultRxHttpClientTest.java | 6 ++--- .../extras/simple/ResumableBodyConsumer.java | 2 +- .../extras/simple/SimpleAsyncHttpClient.java | 4 ++-- 23 files changed, 54 insertions(+), 54 deletions(-) rename client/src/test/java/org/asynchttpclient/handler/resumable/{PropertiesBasedResumableProcesserTest.java => PropertiesBasedResumableProcessorTest.java} (97%) diff --git a/client/src/main/java/org/asynchttpclient/AsyncHttpClientConfig.java b/client/src/main/java/org/asynchttpclient/AsyncHttpClientConfig.java index ccfe9679d4..a761322dc3 100644 --- a/client/src/main/java/org/asynchttpclient/AsyncHttpClientConfig.java +++ b/client/src/main/java/org/asynchttpclient/AsyncHttpClientConfig.java @@ -255,7 +255,7 @@ public interface AsyncHttpClientConfig { String[] getEnabledCipherSuites(); /** - * @return if insecured cipher suites must be filtered out (only used when not explicitly passing enabled cipher suites) + * @return if insecure cipher suites must be filtered out (only used when not explicitly passing enabled cipher suites) */ boolean isFilterInsecureCipherSuites(); diff --git a/client/src/main/java/org/asynchttpclient/handler/resumable/ResumableListener.java b/client/src/main/java/org/asynchttpclient/handler/resumable/ResumableListener.java index 4e36d74304..03472bd085 100644 --- a/client/src/main/java/org/asynchttpclient/handler/resumable/ResumableListener.java +++ b/client/src/main/java/org/asynchttpclient/handler/resumable/ResumableListener.java @@ -29,7 +29,7 @@ public interface ResumableListener { void onBytesReceived(ByteBuffer byteBuffer) throws IOException; /** - * Invoked when all the bytes has been sucessfully transferred. + * Invoked when all the bytes has been successfully transferred. */ void onAllBytesReceived(); diff --git a/client/src/main/java/org/asynchttpclient/netty/channel/ChannelManager.java b/client/src/main/java/org/asynchttpclient/netty/channel/ChannelManager.java index 22c4b8687b..b93dfb380e 100755 --- a/client/src/main/java/org/asynchttpclient/netty/channel/ChannelManager.java +++ b/client/src/main/java/org/asynchttpclient/netty/channel/ChannelManager.java @@ -342,7 +342,7 @@ private SslHandler createSslHandler(String peerHost, int peerPort) { public Future updatePipelineForHttpTunneling(ChannelPipeline pipeline, Uri requestUri) { - Future whenHanshaked = null; + Future whenHandshaked = null; if (pipeline.get(HTTP_CLIENT_CODEC) != null) pipeline.remove(HTTP_CLIENT_CODEC); @@ -350,7 +350,7 @@ public Future updatePipelineForHttpTunneling(ChannelPipeline pipeline, if (requestUri.isSecured()) { if (!isSslHandlerConfigured(pipeline)) { SslHandler sslHandler = createSslHandler(requestUri.getHost(), requestUri.getExplicitPort()); - whenHanshaked = sslHandler.handshakeFuture(); + whenHandshaked = sslHandler.handshakeFuture(); pipeline.addBefore(INFLATER_HANDLER, SSL_HANDLER, sslHandler); } pipeline.addAfter(SSL_HANDLER, HTTP_CLIENT_CODEC, newHttpClientCodec()); @@ -368,7 +368,7 @@ public Future updatePipelineForHttpTunneling(ChannelPipeline pipeline, pipeline.remove(AHC_HTTP_HANDLER); } - return whenHanshaked; + return whenHandshaked; } public SslHandler addSslHandler(ChannelPipeline pipeline, Uri uri, String virtualHost, boolean hasSocksProxyHandler) { diff --git a/client/src/main/java/org/asynchttpclient/request/body/multipart/FileLikePart.java b/client/src/main/java/org/asynchttpclient/request/body/multipart/FileLikePart.java index ad3a702515..03de497867 100644 --- a/client/src/main/java/org/asynchttpclient/request/body/multipart/FileLikePart.java +++ b/client/src/main/java/org/asynchttpclient/request/body/multipart/FileLikePart.java @@ -47,14 +47,14 @@ public abstract class FileLikePart extends PartBase { * @param charset the charset encoding for this part * @param fileName the fileName * @param contentId the content id - * @param transfertEncoding the transfer encoding + * @param transferEncoding the transfer encoding */ - public FileLikePart(String name, String contentType, Charset charset, String fileName, String contentId, String transfertEncoding) { + public FileLikePart(String name, String contentType, Charset charset, String fileName, String contentId, String transferEncoding) { super(name, computeContentType(contentType, fileName), charset, contentId, - transfertEncoding); + transferEncoding); this.fileName = fileName; } diff --git a/client/src/main/java/org/asynchttpclient/request/body/multipart/PartBase.java b/client/src/main/java/org/asynchttpclient/request/body/multipart/PartBase.java index 950f3987e1..94003a3ea7 100644 --- a/client/src/main/java/org/asynchttpclient/request/body/multipart/PartBase.java +++ b/client/src/main/java/org/asynchttpclient/request/body/multipart/PartBase.java @@ -127,7 +127,7 @@ public String toString() { " name=" + getName() + " contentType=" + getContentType() + " charset=" + getCharset() + - " tranferEncoding=" + getTransferEncoding() + + " transferEncoding=" + getTransferEncoding() + " contentId=" + getContentId() + " dispositionType=" + getDispositionType(); } diff --git a/client/src/main/java/org/asynchttpclient/spnego/NamePasswordCallbackHandler.java b/client/src/main/java/org/asynchttpclient/spnego/NamePasswordCallbackHandler.java index ba79f9883a..680cdcac43 100644 --- a/client/src/main/java/org/asynchttpclient/spnego/NamePasswordCallbackHandler.java +++ b/client/src/main/java/org/asynchttpclient/spnego/NamePasswordCallbackHandler.java @@ -57,7 +57,7 @@ protected boolean handleCallback(Callback callback) { /* * This method is called from the handle(Callback[]) method when the specified callback * did not match any of the known callback classes. It looks for the callback method - * having the specified method name with one of the suppported parameter types. + * having the specified method name with one of the supported parameter types. * If found, it invokes the callback method on the object and returns true. * If not, it returns false. */ diff --git a/client/src/main/java/org/asynchttpclient/util/StringBuilderPool.java b/client/src/main/java/org/asynchttpclient/util/StringBuilderPool.java index 2e89ad78d2..69ed426fed 100644 --- a/client/src/main/java/org/asynchttpclient/util/StringBuilderPool.java +++ b/client/src/main/java/org/asynchttpclient/util/StringBuilderPool.java @@ -19,7 +19,7 @@ public class StringBuilderPool { private final ThreadLocal pool = ThreadLocal.withInitial(() -> new StringBuilder(512)); /** - * BEWARE: MUSN'T APPEND TO ITSELF! + * BEWARE: MUSTN'T APPEND TO ITSELF! * * @return a pooled StringBuilder */ diff --git a/client/src/test/java/org/asynchttpclient/BasicAuthTest.java b/client/src/test/java/org/asynchttpclient/BasicAuthTest.java index f36ef7d48a..1743140bc8 100644 --- a/client/src/test/java/org/asynchttpclient/BasicAuthTest.java +++ b/client/src/test/java/org/asynchttpclient/BasicAuthTest.java @@ -65,7 +65,7 @@ public void setUpGlobal() throws Exception { server2.start(); port2 = connector2.getLocalPort(); - // need noAuth server to verify the preemptive auth mode (see basicAuthTestPreemtiveTest) + // need noAuth server to verify the preemptive auth mode (see basicAuthTestPreemptiveTest) serverNoAuth = new Server(); ServerConnector connectorNoAuth = addHttpConnector(serverNoAuth); serverNoAuth.setHandler(new SimpleHandler()); @@ -170,7 +170,7 @@ public Integer onCompleted() { } @Test - public void basicAuthTestPreemtiveTest() throws IOException, ExecutionException, TimeoutException, InterruptedException { + public void basicAuthTestPreemptiveTest() throws IOException, ExecutionException, TimeoutException, InterruptedException { try (AsyncHttpClient client = asyncHttpClient()) { // send the request to the no-auth endpoint to be able to verify the // auth header is really sent preemptively for the initial call. diff --git a/client/src/test/java/org/asynchttpclient/BasicHttpTest.java b/client/src/test/java/org/asynchttpclient/BasicHttpTest.java index d38c930f91..1b7cd1d564 100755 --- a/client/src/test/java/org/asynchttpclient/BasicHttpTest.java +++ b/client/src/test/java/org/asynchttpclient/BasicHttpTest.java @@ -788,7 +788,7 @@ public void onThrowable(Throwable t) { } @Test - public void nonBlockingNestedRequetsFromIoThreadAreFine() throws Throwable { + public void nonBlockingNestedRequestsFromIoThreadAreFine() throws Throwable { withClient().run(client -> withServer(server).run(server -> { diff --git a/client/src/test/java/org/asynchttpclient/handler/resumable/PropertiesBasedResumableProcesserTest.java b/client/src/test/java/org/asynchttpclient/handler/resumable/PropertiesBasedResumableProcessorTest.java similarity index 97% rename from client/src/test/java/org/asynchttpclient/handler/resumable/PropertiesBasedResumableProcesserTest.java rename to client/src/test/java/org/asynchttpclient/handler/resumable/PropertiesBasedResumableProcessorTest.java index 883a2bb971..1cd0704bfd 100644 --- a/client/src/test/java/org/asynchttpclient/handler/resumable/PropertiesBasedResumableProcesserTest.java +++ b/client/src/test/java/org/asynchttpclient/handler/resumable/PropertiesBasedResumableProcessorTest.java @@ -21,7 +21,7 @@ /** * @author Benjamin Hanzelmann */ -public class PropertiesBasedResumableProcesserTest { +public class PropertiesBasedResumableProcessorTest { @Test public void testSaveLoad() { diff --git a/client/src/test/java/org/asynchttpclient/reactivestreams/ReactiveStreamsDownloadTest.java b/client/src/test/java/org/asynchttpclient/reactivestreams/ReactiveStreamsDownloadTest.java index b6f2b2fc65..536f9c1d82 100644 --- a/client/src/test/java/org/asynchttpclient/reactivestreams/ReactiveStreamsDownloadTest.java +++ b/client/src/test/java/org/asynchttpclient/reactivestreams/ReactiveStreamsDownloadTest.java @@ -93,7 +93,7 @@ static protected class SimpleStreamedAsyncHandler implements StreamedAsyncHandle @Override public State onStream(Publisher publisher) { - LOGGER.debug("SimpleStreamedAsyncHandleronCompleted onStream"); + LOGGER.debug("SimpleStreamedAsyncHandlerOnCompleted onStream"); publisher.subscribe(subscriber); return State.CONTINUE; } @@ -105,7 +105,7 @@ public void onThrowable(Throwable t) { @Override public State onBodyPartReceived(HttpResponseBodyPart bodyPart) { - LOGGER.debug("SimpleStreamedAsyncHandleronCompleted onBodyPartReceived"); + LOGGER.debug("SimpleStreamedAsyncHandlerOnCompleted onBodyPartReceived"); throw new AssertionError("Should not have received body part"); } @@ -121,7 +121,7 @@ public State onHeadersReceived(HttpHeaders headers) { @Override public SimpleStreamedAsyncHandler onCompleted() { - LOGGER.debug("SimpleStreamedAsyncHandleronCompleted onSubscribe"); + LOGGER.debug("SimpleStreamedAsyncHandlerOnCompleted onSubscribe"); return this; } diff --git a/client/src/test/java/org/asynchttpclient/request/body/ChunkingTest.java b/client/src/test/java/org/asynchttpclient/request/body/ChunkingTest.java index 538488c2e5..55bf3248c2 100755 --- a/client/src/test/java/org/asynchttpclient/request/body/ChunkingTest.java +++ b/client/src/test/java/org/asynchttpclient/request/body/ChunkingTest.java @@ -33,7 +33,7 @@ public class ChunkingTest extends AbstractBasicTest { // So we can just test the returned data is the image, - // and doesn't contain the chunked delimeters. + // and doesn't contain the chunked delimiters. @Test public void testBufferLargerThanFileWithStreamBodyGenerator() throws Throwable { doTestWithInputStreamBodyGenerator(new BufferedInputStream(Files.newInputStream(LARGE_IMAGE_FILE.toPath()), 400000)); diff --git a/client/src/test/java/org/asynchttpclient/request/body/FilePartLargeFileTest.java b/client/src/test/java/org/asynchttpclient/request/body/FilePartLargeFileTest.java index 06e33c95a7..d0807b1adc 100644 --- a/client/src/test/java/org/asynchttpclient/request/body/FilePartLargeFileTest.java +++ b/client/src/test/java/org/asynchttpclient/request/body/FilePartLargeFileTest.java @@ -51,7 +51,7 @@ public void handle(String target, Request baseRequest, HttpServletRequest req, H total += count; } resp.setStatus(200); - resp.addHeader("X-TRANFERED", String.valueOf(total)); + resp.addHeader("X-TRANSFERRED", String.valueOf(total)); resp.getOutputStream().flush(); resp.getOutputStream().close(); diff --git a/client/src/test/java/org/asynchttpclient/request/body/TransferListenerTest.java b/client/src/test/java/org/asynchttpclient/request/body/TransferListenerTest.java index b4df376ca4..3a55ccd6bc 100644 --- a/client/src/test/java/org/asynchttpclient/request/body/TransferListenerTest.java +++ b/client/src/test/java/org/asynchttpclient/request/body/TransferListenerTest.java @@ -98,8 +98,8 @@ public void basicPutFileTest() throws Exception { final AtomicReference throwable = new AtomicReference<>(); final AtomicReference hSent = new AtomicReference<>(); final AtomicReference hRead = new AtomicReference<>(); - final AtomicInteger bbReceivedLenght = new AtomicInteger(0); - final AtomicLong bbSentLenght = new AtomicLong(0L); + final AtomicInteger bbReceivedLength = new AtomicInteger(0); + final AtomicLong bbSentLength = new AtomicLong(0L); final AtomicBoolean completed = new AtomicBoolean(false); @@ -120,11 +120,11 @@ public void onResponseHeadersReceived(HttpHeaders headers) { } public void onBytesReceived(byte[] b) { - bbReceivedLenght.addAndGet(b.length); + bbReceivedLength.addAndGet(b.length); } public void onBytesSent(long amount, long current, long total) { - bbSentLenght.addAndGet(amount); + bbSentLength.addAndGet(amount); } public void onRequestResponseCompleted() { @@ -142,8 +142,8 @@ public void onThrowable(Throwable t) { assertEquals(response.getStatusCode(), 200); assertNotNull(hRead.get()); assertNotNull(hSent.get()); - assertEquals(bbReceivedLenght.get(), file.length(), "Number of received bytes incorrect"); - assertEquals(bbSentLenght.get(), file.length(), "Number of sent bytes incorrect"); + assertEquals(bbReceivedLength.get(), file.length(), "Number of received bytes incorrect"); + assertEquals(bbSentLength.get(), file.length(), "Number of sent bytes incorrect"); } } @@ -153,8 +153,8 @@ public void basicPutFileBodyGeneratorTest() throws Exception { final AtomicReference throwable = new AtomicReference<>(); final AtomicReference hSent = new AtomicReference<>(); final AtomicReference hRead = new AtomicReference<>(); - final AtomicInteger bbReceivedLenght = new AtomicInteger(0); - final AtomicLong bbSentLenght = new AtomicLong(0L); + final AtomicInteger bbReceivedLength = new AtomicInteger(0); + final AtomicLong bbSentLength = new AtomicLong(0L); final AtomicBoolean completed = new AtomicBoolean(false); @@ -172,11 +172,11 @@ public void onResponseHeadersReceived(HttpHeaders headers) { } public void onBytesReceived(byte[] b) { - bbReceivedLenght.addAndGet(b.length); + bbReceivedLength.addAndGet(b.length); } public void onBytesSent(long amount, long current, long total) { - bbSentLenght.addAndGet(amount); + bbSentLength.addAndGet(amount); } public void onRequestResponseCompleted() { @@ -194,8 +194,8 @@ public void onThrowable(Throwable t) { assertEquals(response.getStatusCode(), 200); assertNotNull(hRead.get()); assertNotNull(hSent.get()); - assertEquals(bbReceivedLenght.get(), file.length(), "Number of received bytes incorrect"); - assertEquals(bbSentLenght.get(), file.length(), "Number of sent bytes incorrect"); + assertEquals(bbReceivedLength.get(), file.length(), "Number of received bytes incorrect"); + assertEquals(bbSentLength.get(), file.length(), "Number of sent bytes incorrect"); } } diff --git a/client/src/test/java/org/asynchttpclient/request/body/multipart/MultipartBodyTest.java b/client/src/test/java/org/asynchttpclient/request/body/multipart/MultipartBodyTest.java index fc54d396ac..72d7300c3d 100644 --- a/client/src/test/java/org/asynchttpclient/request/body/multipart/MultipartBodyTest.java +++ b/client/src/test/java/org/asynchttpclient/request/body/multipart/MultipartBodyTest.java @@ -122,8 +122,8 @@ public int write(ByteBuffer src) { public void transferWithCopy() throws Exception { for (int bufferLength = 1; bufferLength < MAX_MULTIPART_CONTENT_LENGTH_ESTIMATE + 1; bufferLength++) { try (MultipartBody multipartBody = buildMultipart()) { - long tranferred = transferWithCopy(multipartBody, bufferLength); - assertEquals(tranferred, multipartBody.getContentLength()); + long transferred = transferWithCopy(multipartBody, bufferLength); + assertEquals(transferred, multipartBody.getContentLength()); } } } @@ -132,8 +132,8 @@ public void transferWithCopy() throws Exception { public void transferZeroCopy() throws Exception { for (int bufferLength = 1; bufferLength < MAX_MULTIPART_CONTENT_LENGTH_ESTIMATE + 1; bufferLength++) { try (MultipartBody multipartBody = buildMultipart()) { - long tranferred = transferZeroCopy(multipartBody, bufferLength); - assertEquals(tranferred, multipartBody.getContentLength()); + long transferred = transferZeroCopy(multipartBody, bufferLength); + assertEquals(transferred, multipartBody.getContentLength()); } } } diff --git a/client/src/test/java/org/asynchttpclient/request/body/multipart/part/MultipartPartTest.java b/client/src/test/java/org/asynchttpclient/request/body/multipart/part/MultipartPartTest.java index b66c7975ff..b96d14cd09 100644 --- a/client/src/test/java/org/asynchttpclient/request/body/multipart/part/MultipartPartTest.java +++ b/client/src/test/java/org/asynchttpclient/request/body/multipart/part/MultipartPartTest.java @@ -239,12 +239,12 @@ private class TestFileLikePart extends FileLikePart { this(name, contentType, charset, contentId, null); } - TestFileLikePart(String name, String contentType, Charset charset, String contentId, String transfertEncoding) { - this(name, contentType, charset, contentId, transfertEncoding, null); + TestFileLikePart(String name, String contentType, Charset charset, String contentId, String transferEncoding) { + this(name, contentType, charset, contentId, transferEncoding, null); } - TestFileLikePart(String name, String contentType, Charset charset, String contentId, String transfertEncoding, String fileName) { - super(name, contentType, charset, fileName, contentId, transfertEncoding); + TestFileLikePart(String name, String contentType, Charset charset, String contentId, String transferEncoding, String fileName) { + super(name, contentType, charset, fileName, contentId, transferEncoding); } } diff --git a/extras/guava/src/main/java/org/asynchttpclient/extras/guava/RateLimitedThrottleRequestFilter.java b/extras/guava/src/main/java/org/asynchttpclient/extras/guava/RateLimitedThrottleRequestFilter.java index 102b03df86..6d74a08dbe 100644 --- a/extras/guava/src/main/java/org/asynchttpclient/extras/guava/RateLimitedThrottleRequestFilter.java +++ b/extras/guava/src/main/java/org/asynchttpclient/extras/guava/RateLimitedThrottleRequestFilter.java @@ -13,7 +13,7 @@ * {@link ThrottleRequestFilter} by allowing rate limiting per second in addition to the * number of concurrent connections. *

- * The maxWaitMs argument is respected accross both permit acquistions. For + * The maxWaitMs argument is respected across both permit acquisitions. For * example, if 1000 ms is given, and the filter spends 500 ms waiting for a connection, * it will only spend another 500 ms waiting for the rate limiter. */ @@ -44,9 +44,9 @@ public FilterContext filter(FilterContext ctx) throws FilterException } long startOfWait = System.currentTimeMillis(); - attemptConcurrencyPermitAcquistion(ctx); + attemptConcurrencyPermitAcquisition(ctx); - attemptRateLimitedPermitAcquistion(ctx, startOfWait); + attemptRateLimitedPermitAcquisition(ctx, startOfWait); } catch (InterruptedException e) { throw new FilterException(String.format("Interrupted Request %s with AsyncHandler %s", ctx.getRequest(), ctx.getAsyncHandler())); } @@ -56,7 +56,7 @@ public FilterContext filter(FilterContext ctx) throws FilterException .build(); } - private void attemptRateLimitedPermitAcquistion(FilterContext ctx, long startOfWait) throws FilterException { + private void attemptRateLimitedPermitAcquisition(FilterContext ctx, long startOfWait) throws FilterException { long wait = getMillisRemainingInMaxWait(startOfWait); if (!rateLimiter.tryAcquire(wait, TimeUnit.MILLISECONDS)) { @@ -65,7 +65,7 @@ private void attemptRateLimitedPermitAcquistion(FilterContext ctx, long s } } - private void attemptConcurrencyPermitAcquistion(FilterContext ctx) throws InterruptedException, FilterException { + private void attemptConcurrencyPermitAcquisition(FilterContext ctx) throws InterruptedException, FilterException { if (!available.tryAcquire(maxWaitMs, TimeUnit.MILLISECONDS)) { throw new FilterException(String.format("No slot available for processing Request %s with AsyncHandler %s", ctx.getRequest(), ctx.getAsyncHandler())); diff --git a/extras/registry/src/main/java/org/asynchttpclient/extras/registry/AsyncHttpClientFactory.java b/extras/registry/src/main/java/org/asynchttpclient/extras/registry/AsyncHttpClientFactory.java index 1d56b3b96a..5580496976 100644 --- a/extras/registry/src/main/java/org/asynchttpclient/extras/registry/AsyncHttpClientFactory.java +++ b/extras/registry/src/main/java/org/asynchttpclient/extras/registry/AsyncHttpClientFactory.java @@ -33,7 +33,7 @@ * an instance of that class. If there is an exception while reading the * properties file or system property it throws a RuntimeException * AsyncHttpClientImplException. If any of the constructors of the instance - * throws an exception it thows a AsyncHttpClientImplException. By default if + * throws an exception it throws a AsyncHttpClientImplException. By default if * neither the system property or the property file exists then it will return * the default instance of {@link DefaultAsyncHttpClient} */ diff --git a/extras/rxjava2/src/main/java/org/asynchttpclient/extras/rxjava2/RxHttpClient.java b/extras/rxjava2/src/main/java/org/asynchttpclient/extras/rxjava2/RxHttpClient.java index bf2fa39167..9b60aed759 100644 --- a/extras/rxjava2/src/main/java/org/asynchttpclient/extras/rxjava2/RxHttpClient.java +++ b/extras/rxjava2/src/main/java/org/asynchttpclient/extras/rxjava2/RxHttpClient.java @@ -57,7 +57,7 @@ default Maybe prepare(Request request) { * @param request the request that is to be executed * @param handlerSupplier supplies the desired {@code AsyncHandler} instances that are used to produce results * @return a {@code Maybe} that executes {@code request} upon subscription and that emits the results produced by - * the supplied handers + * the supplied handlers * @throws NullPointerException if at least one of the parameters is {@code null} */ Maybe prepare(Request request, Supplier> handlerSupplier); diff --git a/extras/rxjava2/src/main/java/org/asynchttpclient/extras/rxjava2/maybe/AbstractMaybeAsyncHandlerBridge.java b/extras/rxjava2/src/main/java/org/asynchttpclient/extras/rxjava2/maybe/AbstractMaybeAsyncHandlerBridge.java index 6a5f8dca7a..0d0fcdd91c 100644 --- a/extras/rxjava2/src/main/java/org/asynchttpclient/extras/rxjava2/maybe/AbstractMaybeAsyncHandlerBridge.java +++ b/extras/rxjava2/src/main/java/org/asynchttpclient/extras/rxjava2/maybe/AbstractMaybeAsyncHandlerBridge.java @@ -94,7 +94,7 @@ public State onTrailingHeadersReceived(HttpHeaders headers) throws Exception { * {@inheritDoc} *

*

- * The value returned by the wrapped {@code AsyncHandler} won't be returned by this method, but emtited via RxJava. + * The value returned by the wrapped {@code AsyncHandler} won't be returned by this method, but emitted via RxJava. *

* * @return always {@code null} diff --git a/extras/rxjava2/src/test/java/org/asynchttpclient/extras/rxjava2/DefaultRxHttpClientTest.java b/extras/rxjava2/src/test/java/org/asynchttpclient/extras/rxjava2/DefaultRxHttpClientTest.java index 198f4749f7..953037b8ad 100644 --- a/extras/rxjava2/src/test/java/org/asynchttpclient/extras/rxjava2/DefaultRxHttpClientTest.java +++ b/extras/rxjava2/src/test/java/org/asynchttpclient/extras/rxjava2/DefaultRxHttpClientTest.java @@ -61,7 +61,7 @@ public class DefaultRxHttpClientTest { private ArgumentCaptor> handlerCaptor; @Mock - private ListenableFuture resposeFuture; + private ListenableFuture responseFuture; @InjectMocks private DefaultRxHttpClient underTest; @@ -148,7 +148,7 @@ public void callsSupplierForEachSubscription() { @Test public void cancelsResponseFutureOnDispose() throws Exception { given(handlerSupplier.get()).willReturn(handler); - given(asyncHttpClient.executeRequest(eq(request), any())).willReturn(resposeFuture); + given(asyncHttpClient.executeRequest(eq(request), any())).willReturn(responseFuture); /* when */ underTest.prepare(request, handlerSupplier).subscribe().dispose(); @@ -156,7 +156,7 @@ public void cancelsResponseFutureOnDispose() throws Exception { // then then(asyncHttpClient).should().executeRequest(eq(request), handlerCaptor.capture()); final AsyncHandler bridge = handlerCaptor.getValue(); - then(resposeFuture).should().cancel(true); + then(responseFuture).should().cancel(true); verifyZeroInteractions(handler); assertThat(bridge.onStatusReceived(null), is(AsyncHandler.State.ABORT)); verify(handler).onThrowable(isA(DisposedException.class)); diff --git a/extras/simple/src/main/java/org/asynchttpclient/extras/simple/ResumableBodyConsumer.java b/extras/simple/src/main/java/org/asynchttpclient/extras/simple/ResumableBodyConsumer.java index 46048fca9e..0978e4f770 100644 --- a/extras/simple/src/main/java/org/asynchttpclient/extras/simple/ResumableBodyConsumer.java +++ b/extras/simple/src/main/java/org/asynchttpclient/extras/simple/ResumableBodyConsumer.java @@ -30,7 +30,7 @@ public interface ResumableBodyConsumer extends BodyConsumer { /** * Get the previously transferred bytes, for example the current file size. * - * @return the number of tranferred bytes + * @return the number of transferred bytes * @throws IOException IO exception */ long getTransferredBytes() throws IOException; diff --git a/extras/simple/src/main/java/org/asynchttpclient/extras/simple/SimpleAsyncHttpClient.java b/extras/simple/src/main/java/org/asynchttpclient/extras/simple/SimpleAsyncHttpClient.java index b1926b3988..eb805eed1a 100644 --- a/extras/simple/src/main/java/org/asynchttpclient/extras/simple/SimpleAsyncHttpClient.java +++ b/extras/simple/src/main/java/org/asynchttpclient/extras/simple/SimpleAsyncHttpClient.java @@ -505,8 +505,8 @@ public Builder setMaxConnectionsPerHost(int defaultMaxConnectionsPerHost) { return this; } - public Builder setConnectTimeout(int connectTimeuot) { - configBuilder.setConnectTimeout(connectTimeuot); + public Builder setConnectTimeout(int connectTimeout) { + configBuilder.setConnectTimeout(connectTimeout); return this; } From a7216fc1fb89ee62cce27340238c2b8ecbee1a9e Mon Sep 17 00:00:00 2001 From: Tom Granot <8835035+TomGranot@users.noreply.github.com> Date: Sat, 12 Dec 2020 22:29:28 +0200 Subject: [PATCH 2/2] Fix Failing Github Actions Tests (#1753) * Bump GitHub Actions runner version to Ubuntu 20.04 * AsyncStreamHandlerTest.asyncOptionsTest - Allow for the appearance of the TRACE method in the server's response * MaxTotalConnectionTest.testMaxTotalConnections - https://github.com --> https://www.youtube.com, https://google.com --> https://www.google.com * TextMessageTest.onFailureTest - Refactor logic for more granular testing (accept ConnectException in addition to UnknownHostException, but check for "DNS Name not found" in exception cause) --- .github/workflows/maven.yml | 2 +- .../asynchttpclient/AsyncStreamHandlerTest.java | 15 ++++++++++++--- .../channel/MaxTotalConnectionTest.java | 2 +- .../org/asynchttpclient/ws/TextMessageTest.java | 6 +++++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 324d98d6be..f68e412e12 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -9,7 +9,7 @@ on: jobs: build: - runs-on: ubuntu-16.04 + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - name: Set up JDK 1.8 diff --git a/client/src/test/java/org/asynchttpclient/AsyncStreamHandlerTest.java b/client/src/test/java/org/asynchttpclient/AsyncStreamHandlerTest.java index 1547872aaa..ce7607e92e 100644 --- a/client/src/test/java/org/asynchttpclient/AsyncStreamHandlerTest.java +++ b/client/src/test/java/org/asynchttpclient/AsyncStreamHandlerTest.java @@ -436,7 +436,10 @@ public void asyncOptionsTest() throws Throwable { final AtomicReference responseHeaders = new AtomicReference<>(); + // Some responses contain the TRACE method, some do not - account for both + // FIXME: Actually refactor this test to account for both cases final String[] expected = {"GET", "HEAD", "OPTIONS", "POST"}; + final String[] expectedWithTrace = {"GET", "HEAD", "OPTIONS", "POST", "TRACE"}; Future f = client.prepareOptions("http://www.apache.org/").execute(new AsyncHandlerAdapter() { @Override @@ -455,10 +458,16 @@ public String onCompleted() { HttpHeaders h = responseHeaders.get(); assertNotNull(h); String[] values = h.get(ALLOW).split(",|, "); - assertNotNull(values); - assertEquals(values.length, expected.length); + assertNotNull(values); + // Some responses contain the TRACE method, some do not - account for both + assert(values.length == expected.length || values.length == expectedWithTrace.length); Arrays.sort(values); - assertEquals(values, expected); + // Some responses contain the TRACE method, some do not - account for both + if(values.length == expected.length) { + assertEquals(values, expected); + } else { + assertEquals(values, expectedWithTrace); + } })); } diff --git a/client/src/test/java/org/asynchttpclient/channel/MaxTotalConnectionTest.java b/client/src/test/java/org/asynchttpclient/channel/MaxTotalConnectionTest.java index fcf34896f6..492399e3af 100644 --- a/client/src/test/java/org/asynchttpclient/channel/MaxTotalConnectionTest.java +++ b/client/src/test/java/org/asynchttpclient/channel/MaxTotalConnectionTest.java @@ -69,7 +69,7 @@ public void testMaxTotalConnectionsExceedingException() throws IOException { @Test(groups = "online") public void testMaxTotalConnections() throws Exception { - String[] urls = new String[]{"https://google.com", "https://github.com"}; + String[] urls = new String[]{"https://www.google.com", "https://www.youtube.com"}; final CountDownLatch latch = new CountDownLatch(2); final AtomicReference ex = new AtomicReference<>(); diff --git a/client/src/test/java/org/asynchttpclient/ws/TextMessageTest.java b/client/src/test/java/org/asynchttpclient/ws/TextMessageTest.java index d3249944d4..72c3e1d244 100644 --- a/client/src/test/java/org/asynchttpclient/ws/TextMessageTest.java +++ b/client/src/test/java/org/asynchttpclient/ws/TextMessageTest.java @@ -16,6 +16,7 @@ import org.testng.annotations.Test; import java.net.UnknownHostException; +import java.net.ConnectException; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicReference; @@ -70,11 +71,14 @@ public void onEmptyListenerTest() throws Exception { } } - @Test(timeOut = 60000, expectedExceptions = UnknownHostException.class) + @Test(timeOut = 60000, expectedExceptions = {UnknownHostException.class, ConnectException.class}) public void onFailureTest() throws Throwable { try (AsyncHttpClient c = asyncHttpClient()) { c.prepareGet("ws://abcdefg").execute(new WebSocketUpgradeHandler.Builder().build()).get(); } catch (ExecutionException e) { + + String expectedMessage = "DNS name not found"; + assertTrue(e.getCause().toString().contains(expectedMessage)); throw e.getCause(); } }