Buggy code:
public abstract class LoadBalancerContext < T extends ClientRequest , S extends IResponse > implements IClientConfigAware { private static final Logger logger = LoggerFactory . getLogger ( LoadBalancerContext . class ) ; protected String clientName = "default" ; protected String vipAddresses ; protected int maxAutoRetriesNextServer = DefaultClientConfigImpl . DEFAULT_MAX_AUTO_RETRIES_NEXT_SERVER ; protected int maxAutoRetries = DefaultClientConfigImpl . DEFAULT_MAX_AUTO_RETRIES ; protected int overridePort = DefaultClientConfigImpl . DEFAULT_PORT ; protected boolean shouldUseOverridePort = false ; protected LoadBalancerErrorHandler < ? super T , ? super S > errorHandler = new DefaultLoadBalancerErrorHandler < ClientRequest , IResponse > ( ) ; boolean okToRetryOnAllOperations = DEFAULT_OK_TO_RETRY_ON_ALL_OPERATIONS . booleanValue ( ) ; private ILoadBalancer lb ; private volatile Timer tracer ; public LoadBalancerContext ( ) { } public LoadBalancerContext ( IClientConfig clientConfig ) { } @ Override public void initWithNiwsConfig ( IClientConfig clientConfig ) { } protected Timer getExecuteTracer ( ) { } public String getClientName ( ) { } public ILoadBalancer getLoadBalancer ( ) { } public void setLoadBalancer ( ILoadBalancer lb ) { } public int getMaxAutoRetriesNextServer ( ) { } public void setMaxAutoRetriesNextServer ( int maxAutoRetriesNextServer ) { } public int getMaxAutoRetries ( ) { } public void setMaxAutoRetries ( int maxAutoRetries ) { } protected Throwable getDeepestCause ( Throwable e ) { } private boolean isPresentAsCause ( Throwable throwableToSearchIn , Class < ? extends Throwable > throwableToSearchFor ) { } static Throwable isPresentAsCauseHelper ( Throwable throwableToSearchIn , Class < ? extends Throwable > throwableToSearchFor ) { } public static boolean isPresentAsCause ( Throwable throwableToSearchIn , Collection < Class < ? extends Throwable > > throwableToSearchFor ) { } protected ClientException generateNIWSException ( String uri , Throwable e ) { } private boolean isPresentAsCause ( Throwable throwableToSearchIn , Class < ? extends Throwable > throwableToSearchFor , String messageSubStringToSearchFor ) { } private ClientException generateTimeoutNIWSException ( String uri , Throwable e ) { } protected void noteRequestCompletion ( ServerStats stats , ClientRequest request , IResponse response , Throwable e , long responseTime ) { } protected void noteOpenConnection ( ServerStats serverStats , ClientRequest request ) { } protected Pair < String , Integer > deriveSchemeAndPortFromPartialUri ( T request ) { } protected int getDefaultPortFromScheme ( String scheme ) { } protected Pair < String , Integer > deriveHostAndPortFromVipAddress ( String vipAddress ) throws ClientException , URISyntaxException { } private boolean isVipRecognized ( String vipEmbeddedInUri ) { } @ SuppressWarnings ( "unchecked" ) protected T computeFinalUriWithLoadBalancer ( T original ) throws ClientException { URI newURI ; URI theUrl = original . getUri ( ) ; if ( theUrl == null ) { throw new ClientException ( ErrorType . GENERAL , "NULL<seq2seq4repair_space>URL<seq2seq4repair_space>passed<seq2seq4repair_space>in" ) ; } String host = theUrl . getHost ( ) ; Pair < String , Integer > schemeAndPort = deriveSchemeAndPortFromPartialUri ( original ) ; String scheme = schemeAndPort . first ( ) ; int port = schemeAndPort . second ( ) ; ILoadBalancer lb = getLoadBalancer ( ) ; Object loadBalancerKey = original . getLoadBalancerKey ( ) ; if ( host == null ) { if ( lb != null ) { Server svc = lb . chooseServer ( loadBalancerKey ) ; if ( svc == null ) { throw new ClientException ( ErrorType . GENERAL , ( "LoadBalancer<seq2seq4repair_space>returned<seq2seq4repair_space>null<seq2seq4repair_space>Server<seq2seq4repair_space>for<seq2seq4repair_space>:" + ( clientName ) ) ) ; } host = svc . getHost ( ) ; if ( shouldUseOverridePort ) { <START_BUG> LoadBalancerContext . logger . debug ( "Using<seq2seq4repair_space>override<seq2seq4repair_space>port<seq2seq4repair_space>of<seq2seq4repair_space>%d<seq2seq4repair_space>on<seq2seq4repair_space>client<seq2seq4repair_space>%s" , clientName ) ; <END_BUG> port = overridePort ; } else { port = svc . getPort ( ) ; } if ( host == null ) { throw new ClientException ( ErrorType . GENERAL , ( "Invalid<seq2seq4repair_space>Server<seq2seq4repair_space>for<seq2seq4repair_space>:" + svc ) ) ; } if ( LoadBalancerContext . logger . isDebugEnabled ( ) ) { LoadBalancerContext . logger . debug ( ( ( ( ( ( clientName ) + "<seq2seq4repair_space>using<seq2seq4repair_space>LB<seq2seq4repair_space>returned<seq2seq4repair_space>Server:" ) + svc ) + "for<seq2seq4repair_space>request:" ) + theUrl ) ) ; } } else { if ( ( ( vipAddresses ) != null ) && ( vipAddresses . contains ( "," ) ) ) { throw new ClientException ( ErrorType . GENERAL , ( ( ( ( ( ( this . clientName ) + "Partial<seq2seq4repair_space>URI<seq2seq4repair_space>of<seq2seq4repair_space>(" ) + theUrl ) + ")<seq2seq4repair_space>has<seq2seq4repair_space>been<seq2seq4repair_space>sent<seq2seq4repair_space>in<seq2seq4repair_space>to<seq2seq4repair_space>RestClient<seq2seq4repair_space>(with<seq2seq4repair_space>no<seq2seq4repair_space>LB)<seq2seq4repair_space>to<seq2seq4repair_space>be<seq2seq4repair_space>executed." ) + "<seq2seq4repair_space>Also,<seq2seq4repair_space>there<seq2seq4repair_space>are<seq2seq4repair_space>multiple<seq2seq4repair_space>vipAddresses<seq2seq4repair_space>and<seq2seq4repair_space>hence<seq2seq4repair_space>RestClient<seq2seq4repair_space>cant<seq2seq4repair_space>pick" ) + "one<seq2seq4repair_space>vipAddress<seq2seq4repair_space>to<seq2seq4repair_space>complete<seq2seq4repair_space>this<seq2seq4repair_space>partial<seq2seq4repair_space>uri" ) ) ; } else if ( ( vipAddresses ) != null ) { try { Pair < String , Integer > hostAndPort = deriveHostAndPortFromVipAddress ( vipAddresses ) ; host = hostAndPort . first ( ) ; port = hostAndPort . second ( ) ; } catch ( URISyntaxException e ) { throw new ClientException ( ErrorType . GENERAL , ( ( ( ( ( this . clientName ) + "Partial<seq2seq4repair_space>URI<seq2seq4repair_space>of<seq2seq4repair_space>(" ) + theUrl ) + ")<seq2seq4repair_space>has<seq2seq4repair_space>been<seq2seq4repair_space>sent<seq2seq4repair_space>in<seq2seq4repair_space>to<seq2seq4repair_space>RestClient<seq2seq4repair_space>(with<seq2seq4repair_space>no<seq2seq4repair_space>LB)<seq2seq4repair_space>to<seq2seq4repair_space>be<seq2seq4repair_space>executed." ) + "<seq2seq4repair_space>Also,<seq2seq4repair_space>the<seq2seq4repair_space>configured//registered<seq2seq4repair_space>vipAddress<seq2seq4repair_space>is<seq2seq4repair_space>unparseable<seq2seq4repair_space>(to<seq2seq4repair_space>determine<seq2seq4repair_space>host<seq2seq4repair_space>and<seq2seq4repair_space>port)" ) ) ; } } else { throw new ClientException ( ErrorType . GENERAL , ( ( ( this . clientName ) + "<seq2seq4repair_space>has<seq2seq4repair_space>no<seq2seq4repair_space>LoadBalancer<seq2seq4repair_space>registered<seq2seq4repair_space>and<seq2seq4repair_space>passed<seq2seq4repair_space>in<seq2seq4repair_space>a<seq2seq4repair_space>partial<seq2seq4repair_space>URL<seq2seq4repair_space>request<seq2seq4repair_space>(with<seq2seq4repair_space>no<seq2seq4repair_space>host:port)." ) + "<seq2seq4repair_space>Also<seq2seq4repair_space>has<seq2seq4repair_space>no<seq2seq4repair_space>vipAddress<seq2seq4repair_space>registered" ) ) ; } } } else { boolean shouldInterpretAsVip = false ; if ( lb != null ) { shouldInterpretAsVip = isVipRecognized ( original . getUri ( ) . getAuthority ( ) ) ; } if ( shouldInterpretAsVip ) { Server svc = lb . chooseServer ( loadBalancerKey ) ; if ( svc != null ) { host = svc . getHost ( ) ; port = svc . getPort ( ) ; if ( host == null ) { throw new ClientException ( ErrorType . GENERAL , ( "Invalid<seq2seq4repair_space>Server<seq2seq4repair_space>for<seq2seq4repair_space>:" + svc ) ) ; } if ( LoadBalancerContext . logger . isDebugEnabled ( ) ) { LoadBalancerContext . logger . debug ( ( ( ( "using<seq2seq4repair_space>LB<seq2seq4repair_space>returned<seq2seq4repair_space>Server:" + svc ) + "for<seq2seq4repair_space>request:" ) + theUrl ) ) ; } } else { if ( LoadBalancerContext . logger . isDebugEnabled ( ) ) { LoadBalancerContext . logger . debug ( ( ( ( host + ":" ) + port ) + "<seq2seq4repair_space>assumed<seq2seq4repair_space>to<seq2seq4repair_space>be<seq2seq4repair_space>a<seq2seq4repair_space>valid<seq2seq4repair_space>VIP<seq2seq4repair_space>address<seq2seq4repair_space>or<seq2seq4repair_space>exists<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>DNS" ) ) ; } } }

Fix:
LoadBalancerContext . logger . debug ( "Using<seq2seq4repair_space>override<seq2seq4repair_space>port<seq2seq4repair_space>of<seq2seq4repair_space>%d<seq2seq4repair_space>on<seq2seq4repair_space>client<seq2seq4repair_space>%s" , overridePort , clientName ) ;