Program: 125
Project: 125
Buggy source:
@SuppressWarnings("String_Node_Str") private static HttpRequest construct(AsyncHttpClientConfig config,Request request,HttpMethod m,URI uri,ChannelBuffer buffer) throws IOException {
  String host=uri.getHost();
  if (request.getVirtualHost() != null) {
    host=request.getVirtualHost();
  }
  HttpRequest nettyRequest;
  if (m.equals(HttpMethod.CONNECT)) {
    uri=URI.create(new StringBuilder(uri.getHost()).append("String_Node_Str").append(AsyncHttpProviderUtils.getPort(uri)).toString());
    nettyRequest=new DefaultHttpRequest(HttpVersion.HTTP_1_0,m,uri.toString());
  }
 else   if (config.getProxyServer() != null || request.getProxyServer() != null) {
    nettyRequest=new DefaultHttpRequest(HttpVersion.HTTP_1_1,m,uri.toString());
  }
 else {
    StringBuilder path=new StringBuilder(uri.getRawPath());
    if (uri.getQuery() != null) {
      path.append("String_Node_Str").append(uri.getRawQuery());
    }
    nettyRequest=new DefaultHttpRequest(HttpVersion.HTTP_1_1,m,path.toString());
  }
  if (uri.getPort() == -1) {
    nettyRequest.setHeader(HttpHeaders.Names.HOST,host);
  }
 else {
    nettyRequest.setHeader(HttpHeaders.Names.HOST,host + "String_Node_Str" + uri.getPort());
  }
  if (!m.equals(HttpMethod.CONNECT)) {
    FluentCaseInsensitiveStringsMap h=request.getHeaders();
    if (h != null) {
      for (      String name : h.keySet()) {
        if (!"String_Node_Str".equalsIgnoreCase(name)) {
          for (          String value : h.get(name)) {
            nettyRequest.addHeader(name,value);
          }
        }
      }
    }
    if (config.isCompressionEnabled()) {
      nettyRequest.setHeader(HttpHeaders.Names.ACCEPT_ENCODING,HttpHeaders.Values.GZIP);
    }
  }
  Realm realm=request.getRealm() != null ? request.getRealm() : config.getRealm();
  if (realm != null && realm.getUsePreemptiveAuth()) {
switch (realm.getAuthScheme()) {
case BASIC:
      nettyRequest.setHeader(HttpHeaders.Names.AUTHORIZATION,AuthenticatorUtils.computeBasicAuthentication(realm));
    break;
case DIGEST:
  if (realm.getNonce() != null && !realm.getNonce().equals("String_Node_Str")) {
    try {
      nettyRequest.setHeader(HttpHeaders.Names.AUTHORIZATION,AuthenticatorUtils.computeDigestAuthentication(realm));
    }
 catch (    NoSuchAlgorithmException e) {
      throw new SecurityException(e);
    }
  }
break;
default :
throw new IllegalStateException(String.format("String_Node_Str",realm.toString()));
}
}
String ka=config.getAllowPoolingConnection() ? "String_Node_Str" : "String_Node_Str";
nettyRequest.setHeader(HttpHeaders.Names.CONNECTION,ka);
ProxyServer proxyServer=request.getProxyServer() != null ? request.getProxyServer() : config.getProxyServer();
if (proxyServer != null) {
nettyRequest.setHeader("String_Node_Str",ka);
if (proxyServer.getPrincipal() != null) {
nettyRequest.setHeader(HttpHeaders.Names.PROXY_AUTHORIZATION,AuthenticatorUtils.computeBasicAuthentication(proxyServer));
}
}
if (request.getHeaders().getFirstValue("String_Node_Str") == null) {
nettyRequest.setHeader(HttpHeaders.Names.ACCEPT,"String_Node_Str");
}
if (request.getHeaders().getFirstValue("String_Node_Str") == null && config.getUserAgent() != null) {
nettyRequest.setHeader("String_Node_Str",config.getUserAgent());
}
 else if (config.getUserAgent() != null) {
nettyRequest.setHeader("String_Node_Str",config.getUserAgent());
}
 else if (request.getHeaders().getFirstValue("String_Node_Str") != null) {
nettyRequest.setHeader("String_Node_Str",request.getHeaders().getFirstValue("String_Node_Str"));
}
 else {
nettyRequest.setHeader("String_Node_Str",AsyncHttpProviderUtils.constructUserAgent(NettyAsyncHttpProvider.class));
}
if (!m.equals(HttpMethod.CONNECT)) {
if (request.getCookies() != null && !request.getCookies().isEmpty()) {
CookieEncoder httpCookieEncoder=new CookieEncoder(false);
Iterator<Cookie> ic=request.getCookies().iterator();
Cookie c;
org.jboss.netty.handler.codec.http.Cookie cookie;
while (ic.hasNext()) {
c=ic.next();
cookie=new DefaultCookie(c.getName(),c.getValue());
cookie.setPath(c.getPath());
cookie.setMaxAge(c.getMaxAge());
cookie.setDomain(c.getDomain());
httpCookieEncoder.addCookie(cookie);
}
nettyRequest.setHeader(HttpHeaders.Names.COOKIE,httpCookieEncoder.encode());
}
String reqType=request.getMethod();
if ("String_Node_Str".equals(reqType) || "String_Node_Str".equals(reqType)) {
if (buffer != null && buffer.writerIndex() != 0) {
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH,buffer.writerIndex());
nettyRequest.setContent(buffer);
}
 else if (request.getByteData() != null) {
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH,String.valueOf(request.getByteData().length));
nettyRequest.setContent(ChannelBuffers.copiedBuffer(request.getByteData()));
}
 else if (request.getStringData() != null) {
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH,String.valueOf(request.getStringData().length()));
nettyRequest.setContent(ChannelBuffers.copiedBuffer(request.getStringData(),"String_Node_Str"));
}
 else if (request.getStreamData() != null) {
int[] lengthWrapper=new int[1];
byte[] bytes=AsyncHttpProviderUtils.readFully(request.getStreamData(),lengthWrapper);
int length=lengthWrapper[0];
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH,String.valueOf(length));
nettyRequest.setContent(ChannelBuffers.copiedBuffer(bytes,0,length));
}
 else if (request.getParams() != null) {
StringBuilder sb=new StringBuilder();
for (final Entry<String,List<String>> paramEntry : request.getParams()) {
final String key=paramEntry.getKey();
for (final String value : paramEntry.getValue()) {
  if (sb.length() > 0) {
    sb.append("String_Node_Str");
  }
  UTF8UrlEncoder.appendEncoded(sb,key);
  sb.append("String_Node_Str");
  UTF8UrlEncoder.appendEncoded(sb,value);
}
}
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH,String.valueOf(sb.length()));
nettyRequest.setContent(ChannelBuffers.copiedBuffer(sb.toString().getBytes("String_Node_Str")));
if (!request.getHeaders().containsKey(HttpHeaders.Names.CONTENT_TYPE)) {
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_TYPE,"String_Node_Str");
}
}
 else if (request.getParts() != null) {
int lenght=computeAndSetContentLength(request,nettyRequest);
if (lenght == -1) {
lenght=MAX_BUFFERED_BYTES;
}
MultipartRequestEntity mre=AsyncHttpProviderUtils.createMultipartRequestEntity(request.getParts(),request.getParams());
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_TYPE,mre.getContentType());
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH,String.valueOf(mre.getContentLength()));
ChannelBuffer b=ChannelBuffers.dynamicBuffer(lenght);
mre.writeRequest(new ChannelBufferOutputStream(b));
nettyRequest.setContent(b);
}
 else if (request.getEntityWriter() != null) {
int lenght=computeAndSetContentLength(request,nettyRequest);
if (lenght == -1) {
lenght=MAX_BUFFERED_BYTES;
}
ChannelBuffer b=ChannelBuffers.dynamicBuffer(lenght);
request.getEntityWriter().writeEntity(new ChannelBufferOutputStream(b));
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH,b.writerIndex());
nettyRequest.setContent(b);
}
 else if (request.getFile() != null) {
File file=request.getFile();
if (!file.isFile()) {
throw new IOException(String.format("String_Node_Str",file.getAbsolutePath()));
}
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH,file.length());
}
}
}
return nettyRequest;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private static HttpRequest construct(AsyncHttpClientConfig config,Request request,HttpMethod m,URI uri,ChannelBuffer buffer) throws IOException {
  String host=uri.getHost();
  if (request.getVirtualHost() != null) {
    host=request.getVirtualHost();
  }
  HttpRequest nettyRequest;
  if (m.equals(HttpMethod.CONNECT)) {
    uri=URI.create(new StringBuilder(uri.getHost()).append("String_Node_Str").append(AsyncHttpProviderUtils.getPort(uri)).toString());
    nettyRequest=new DefaultHttpRequest(HttpVersion.HTTP_1_0,m,uri.toString());
  }
 else   if (config.getProxyServer() != null || request.getProxyServer() != null) {
    nettyRequest=new DefaultHttpRequest(HttpVersion.HTTP_1_1,m,uri.toString());
  }
 else {
    StringBuilder path=new StringBuilder(uri.getRawPath());
    if (uri.getQuery() != null) {
      path.append("String_Node_Str").append(uri.getRawQuery());
    }
    nettyRequest=new DefaultHttpRequest(HttpVersion.HTTP_1_1,m,path.toString());
  }
  if (uri.getPort() == -1) {
    nettyRequest.setHeader(HttpHeaders.Names.HOST,host);
  }
 else {
    nettyRequest.setHeader(HttpHeaders.Names.HOST,host + "String_Node_Str" + uri.getPort());
  }
  if (!m.equals(HttpMethod.CONNECT)) {
    FluentCaseInsensitiveStringsMap h=request.getHeaders();
    if (h != null) {
      for (      String name : h.keySet()) {
        if (!"String_Node_Str".equalsIgnoreCase(name)) {
          for (          String value : h.get(name)) {
            nettyRequest.addHeader(name,value);
          }
        }
      }
    }
    if (config.isCompressionEnabled()) {
      nettyRequest.setHeader(HttpHeaders.Names.ACCEPT_ENCODING,HttpHeaders.Values.GZIP);
    }
  }
  Realm realm=request.getRealm() != null ? request.getRealm() : config.getRealm();
  if (realm != null && realm.getUsePreemptiveAuth()) {
switch (realm.getAuthScheme()) {
case BASIC:
      nettyRequest.setHeader(HttpHeaders.Names.AUTHORIZATION,AuthenticatorUtils.computeBasicAuthentication(realm));
    break;
case DIGEST:
  if (realm.getNonce() != null && !realm.getNonce().equals("String_Node_Str")) {
    try {
      nettyRequest.setHeader(HttpHeaders.Names.AUTHORIZATION,AuthenticatorUtils.computeDigestAuthentication(realm));
    }
 catch (    NoSuchAlgorithmException e) {
      throw new SecurityException(e);
    }
  }
break;
default :
throw new IllegalStateException(String.format("String_Node_Str",realm.toString()));
}
}
String ka=config.getAllowPoolingConnection() ? "String_Node_Str" : "String_Node_Str";
nettyRequest.setHeader(HttpHeaders.Names.CONNECTION,ka);
ProxyServer proxyServer=request.getProxyServer() != null ? request.getProxyServer() : config.getProxyServer();
if (proxyServer != null) {
nettyRequest.setHeader("String_Node_Str",ka);
if (proxyServer.getPrincipal() != null) {
nettyRequest.setHeader(HttpHeaders.Names.PROXY_AUTHORIZATION,AuthenticatorUtils.computeBasicAuthentication(proxyServer));
}
}
if (request.getHeaders().getFirstValue("String_Node_Str") == null) {
nettyRequest.setHeader(HttpHeaders.Names.ACCEPT,"String_Node_Str");
}
if (request.getHeaders().getFirstValue("String_Node_Str") == null && config.getUserAgent() != null) {
nettyRequest.setHeader("String_Node_Str",config.getUserAgent());
}
 else if (config.getUserAgent() != null) {
nettyRequest.setHeader("String_Node_Str",config.getUserAgent());
}
 else if (request.getHeaders().getFirstValue("String_Node_Str") != null) {
nettyRequest.setHeader("String_Node_Str",request.getHeaders().getFirstValue("String_Node_Str"));
}
 else {
nettyRequest.setHeader("String_Node_Str",AsyncHttpProviderUtils.constructUserAgent(NettyAsyncHttpProvider.class));
}
if (!m.equals(HttpMethod.CONNECT)) {
if (request.getCookies() != null && !request.getCookies().isEmpty()) {
CookieEncoder httpCookieEncoder=new CookieEncoder(false);
Iterator<Cookie> ic=request.getCookies().iterator();
Cookie c;
org.jboss.netty.handler.codec.http.Cookie cookie;
while (ic.hasNext()) {
c=ic.next();
cookie=new DefaultCookie(c.getName(),c.getValue());
cookie.setPath(c.getPath());
cookie.setMaxAge(c.getMaxAge());
cookie.setDomain(c.getDomain());
httpCookieEncoder.addCookie(cookie);
}
nettyRequest.setHeader(HttpHeaders.Names.COOKIE,httpCookieEncoder.encode());
}
String reqType=request.getMethod();
if ("String_Node_Str".equals(reqType) || "String_Node_Str".equals(reqType)) {
if (buffer != null && buffer.writerIndex() != 0) {
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH,buffer.writerIndex());
nettyRequest.setContent(buffer);
}
 else if (request.getByteData() != null) {
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH,String.valueOf(request.getByteData().length));
nettyRequest.setContent(ChannelBuffers.copiedBuffer(request.getByteData()));
}
 else if (request.getStringData() != null) {
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH,String.valueOf(request.getStringData().length()));
nettyRequest.setContent(ChannelBuffers.copiedBuffer(request.getStringData(),DEFAULT_CHARSET));
}
 else if (request.getStreamData() != null) {
int[] lengthWrapper=new int[1];
byte[] bytes=AsyncHttpProviderUtils.readFully(request.getStreamData(),lengthWrapper);
int length=lengthWrapper[0];
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH,String.valueOf(length));
nettyRequest.setContent(ChannelBuffers.copiedBuffer(bytes,0,length));
}
 else if (request.getParams() != null) {
StringBuilder sb=new StringBuilder();
for (final Entry<String,List<String>> paramEntry : request.getParams()) {
final String key=paramEntry.getKey();
for (final String value : paramEntry.getValue()) {
  if (sb.length() > 0) {
    sb.append("String_Node_Str");
  }
  UTF8UrlEncoder.appendEncoded(sb,key);
  sb.append("String_Node_Str");
  UTF8UrlEncoder.appendEncoded(sb,value);
}
}
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH,String.valueOf(sb.length()));
nettyRequest.setContent(ChannelBuffers.copiedBuffer(sb.toString().getBytes(DEFAULT_CHARSET)));
if (!request.getHeaders().containsKey(HttpHeaders.Names.CONTENT_TYPE)) {
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_TYPE,"String_Node_Str");
}
}
 else if (request.getParts() != null) {
int lenght=computeAndSetContentLength(request,nettyRequest);
if (lenght == -1) {
lenght=MAX_BUFFERED_BYTES;
}
MultipartRequestEntity mre=AsyncHttpProviderUtils.createMultipartRequestEntity(request.getParts(),request.getParams());
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_TYPE,mre.getContentType());
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH,String.valueOf(mre.getContentLength()));
ChannelBuffer b=ChannelBuffers.dynamicBuffer(lenght);
mre.writeRequest(new ChannelBufferOutputStream(b));
nettyRequest.setContent(b);
}
 else if (request.getEntityWriter() != null) {
int lenght=computeAndSetContentLength(request,nettyRequest);
if (lenght == -1) {
lenght=MAX_BUFFERED_BYTES;
}
ChannelBuffer b=ChannelBuffers.dynamicBuffer(lenght);
request.getEntityWriter().writeEntity(new ChannelBufferOutputStream(b));
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH,b.writerIndex());
nettyRequest.setContent(b);
}
 else if (request.getFile() != null) {
File file=request.getFile();
if (!file.isFile()) {
throw new IOException(String.format("String_Node_Str",file.getAbsolutePath()));
}
nettyRequest.setHeader(HttpHeaders.Names.CONTENT_LENGTH,file.length());
}
}
}
return nettyRequest;
}