Skip to content

Commit 44213cf

Browse files
author
Stephane Landelle
committed
Don't report the full url in the ConnectException, close AsyncHttpClient#700
1 parent ed7bddc commit 44213cf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
*/
1414
package com.ning.http.client.providers.netty.request;
1515

16+
import static com.ning.http.util.AsyncHttpProviderUtils.getBaseUrl;
17+
1618
import org.jboss.netty.channel.Channel;
1719
import org.jboss.netty.channel.ChannelFuture;
1820
import org.jboss.netty.channel.ChannelFutureListener;
@@ -137,7 +139,8 @@ private void onFutureFailure(Channel channel, Throwable cause) {
137139
LOGGER.debug("Failed to recover from connect exception: {} with channel {}", cause, channel);
138140

139141
boolean printCause = cause != null && cause.getMessage() != null;
140-
ConnectException e = new ConnectException(printCause ? cause.getMessage() + " to " + future.getUri().toUrl() : future.getUri().toUrl());
142+
String printedCause = printCause ? cause.getMessage() : getBaseUrl(future.getUri());
143+
ConnectException e = new ConnectException(printedCause);
141144
if (cause != null) {
142145
e.initCause(cause);
143146
}

0 commit comments

Comments
 (0)