Program: 132
Project: 132
Buggy source:
private HttpMethodBase createMethod(HttpClient client,Request request) throws IOException, FileNotFoundException {
  String methodName=request.getReqType();
  HttpMethodBase method=null;
  if (methodName.equalsIgnoreCase("String_Node_Str") || methodName.equalsIgnoreCase("String_Node_Str")) {
    EntityEnclosingMethod post=methodName.equalsIgnoreCase("String_Node_Str") ? new PostMethod(request.getUrl()) : new PutMethod(request.getUrl());
    post.getParams().setContentCharset("String_Node_Str");
    if (request.getByteData() != null) {
      post.setRequestEntity(new ByteArrayRequestEntity(request.getByteData()));
      post.setRequestHeader("String_Node_Str",String.valueOf(request.getByteData().length));
    }
 else     if (request.getStringData() != null) {
      post.setRequestEntity(new StringRequestEntity(request.getStringData(),"String_Node_Str","String_Node_Str"));
      post.setRequestHeader("String_Node_Str",String.valueOf(request.getStringData().length()));
    }
 else     if (request.getStreamData() != null) {
      InputStreamRequestEntity r=new InputStreamRequestEntity(request.getStreamData());
      post.setRequestEntity(r);
      post.setRequestHeader("String_Node_Str",String.valueOf(r.getContentLength()));
    }
 else     if (request.getParams() != null) {
      StringBuilder sb=new StringBuilder();
      for (      final Map.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);
        }
      }
      post.setRequestHeader("String_Node_Str",String.valueOf(sb.length()));
      post.setRequestEntity(new StringRequestEntity(sb.toString(),"String_Node_Str","String_Node_Str"));
      if (!request.getHeaders().containsKey("String_Node_Str")) {
        post.setRequestHeader("String_Node_Str","String_Node_Str");
      }
    }
 else     if (request.getParts() != null) {
      MultipartRequestEntity mre=createMultipartRequestEntity(request.getParts(),post.getParams());
      post.setRequestEntity(mre);
      post.setRequestHeader("String_Node_Str",mre.getContentType());
      post.setRequestHeader("String_Node_Str",String.valueOf(mre.getContentLength()));
    }
 else     if (request.getEntityWriter() != null) {
      post.setRequestEntity(new EntityWriterRequestEntity(request.getEntityWriter(),computeAndSetContentLength(request,post)));
    }
 else     if (request.getFile() != null) {
      File file=request.getFile();
      if (!file.isFile()) {
        throw new IOException(String.format(Thread.currentThread() + "String_Node_Str",file.getAbsolutePath()));
      }
      post.setRequestHeader("String_Node_Str",String.valueOf(file.length()));
      FileInputStream fis=new FileInputStream(file);
      try {
        InputStreamRequestEntity r=new InputStreamRequestEntity(fis);
        post.setRequestEntity(r);
        post.setRequestHeader("String_Node_Str",String.valueOf(r.getContentLength()));
      }
  finally {
        fis.close();
      }
    }
 else     if (request.getBodyGenerator() != null) {
      Body body=request.getBodyGenerator().createBody();
      try {
        int length=(int)body.getContentLength();
        if (length < 0) {
          length=(int)request.getLength();
        }
        if (length >= 0) {
          post.setRequestHeader("String_Node_Str",String.valueOf(length));
        }
        byte[] bytes=new byte[length];
        ByteBuffer buffer=ByteBuffer.wrap(bytes);
        for (; ; ) {
          buffer.clear();
          if (body.read(buffer) < 0) {
            break;
          }
        }
        post.setRequestEntity(new ByteArrayRequestEntity(bytes));
      }
  finally {
        try {
          body.close();
        }
 catch (        IOException e) {
          logger.warn("String_Node_Str",e.getMessage(),e);
        }
      }
    }
    method=post;
  }
 else   if (methodName.equalsIgnoreCase("String_Node_Str")) {
    method=new DeleteMethod(request.getUrl());
  }
 else   if (methodName.equalsIgnoreCase("String_Node_Str")) {
    method=new HeadMethod(request.getUrl());
  }
 else   if (methodName.equalsIgnoreCase("String_Node_Str")) {
    method=new GetMethod(request.getUrl());
  }
 else   if (methodName.equalsIgnoreCase("String_Node_Str")) {
    method=new OptionsMethod(request.getUrl());
  }
 else {
    throw new IllegalStateException(String.format("String_Node_Str",methodName));
  }
  ProxyServer proxyServer=request.getProxyServer() != null ? request.getProxyServer() : config.getProxyServer();
  if (proxyServer != null) {
    if (proxyServer.getPrincipal() != null) {
      Credentials defaultcreds=new UsernamePasswordCredentials(proxyServer.getPrincipal(),proxyServer.getPassword());
      client.getState().setCredentials(new AuthScope(null,-1,AuthScope.ANY_REALM),defaultcreds);
    }
    ProxyHost proxyHost=proxyServer == null ? null : new ProxyHost(proxyServer.getHost(),proxyServer.getPort());
    client.getHostConfiguration().setProxyHost(proxyHost);
  }
  method.setFollowRedirects(false);
  if ((request.getCookies() != null) && !request.getCookies().isEmpty()) {
    for (    Cookie cookie : request.getCookies()) {
      method.setRequestHeader("String_Node_Str",AsyncHttpProviderUtils.encodeCookies(request.getCookies()));
    }
  }
  if (request.getHeaders() != null) {
    for (    String name : request.getHeaders().keySet()) {
      if (!"String_Node_Str".equalsIgnoreCase(name)) {
        for (        String value : request.getHeaders().get(name)) {
          method.setRequestHeader(name,value);
        }
      }
    }
  }
  if (request.getHeaders().getFirstValue("String_Node_Str") == null && config.getUserAgent() != null) {
    method.setRequestHeader("String_Node_Str",config.getUserAgent());
  }
 else {
    method.setRequestHeader("String_Node_Str",AsyncHttpProviderUtils.constructUserAgent(ApacheAsyncHttpProvider.class));
  }
  if (config.isCompressionEnabled()) {
    Header acceptableEncodingHeader=method.getRequestHeader("String_Node_Str");
    if (acceptableEncodingHeader != null) {
      String acceptableEncodings=acceptableEncodingHeader.getValue();
      if (acceptableEncodings.indexOf("String_Node_Str") == -1) {
        StringBuilder buf=new StringBuilder(acceptableEncodings);
        if (buf.length() > 1) {
          buf.append("String_Node_Str");
        }
        buf.append("String_Node_Str");
        method.setRequestHeader("String_Node_Str",buf.toString());
      }
    }
 else {
      method.setRequestHeader("String_Node_Str","String_Node_Str");
    }
  }
  if (request.getVirtualHost() != null) {
    method.getParams().setVirtualHost(request.getVirtualHost());
  }
  return method;
}

Fixed version (ground truth):
private HttpMethodBase createMethod(HttpClient client,Request request) throws IOException, FileNotFoundException {
  String methodName=request.getReqType();
  HttpMethodBase method=null;
  if (methodName.equalsIgnoreCase("String_Node_Str") || methodName.equalsIgnoreCase("String_Node_Str")) {
    EntityEnclosingMethod post=methodName.equalsIgnoreCase("String_Node_Str") ? new PostMethod(request.getUrl()) : new PutMethod(request.getUrl());
    post.getParams().setContentCharset("String_Node_Str");
    if (request.getByteData() != null) {
      post.setRequestEntity(new ByteArrayRequestEntity(request.getByteData()));
      post.setRequestHeader("String_Node_Str",String.valueOf(request.getByteData().length));
    }
 else     if (request.getStringData() != null) {
      post.setRequestEntity(new StringRequestEntity(request.getStringData(),"String_Node_Str","String_Node_Str"));
      post.setRequestHeader("String_Node_Str",String.valueOf(request.getStringData().length()));
    }
 else     if (request.getStreamData() != null) {
      InputStreamRequestEntity r=new InputStreamRequestEntity(request.getStreamData());
      post.setRequestEntity(r);
      post.setRequestHeader("String_Node_Str",String.valueOf(r.getContentLength()));
    }
 else     if (request.getParams() != null) {
      StringBuilder sb=new StringBuilder();
      for (      final Map.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);
        }
      }
      post.setRequestHeader("String_Node_Str",String.valueOf(sb.length()));
      post.setRequestEntity(new StringRequestEntity(sb.toString(),"String_Node_Str","String_Node_Str"));
      if (!request.getHeaders().containsKey("String_Node_Str")) {
        post.setRequestHeader("String_Node_Str","String_Node_Str");
      }
    }
 else     if (request.getParts() != null) {
      MultipartRequestEntity mre=createMultipartRequestEntity(request.getParts(),post.getParams());
      post.setRequestEntity(mre);
      post.setRequestHeader("String_Node_Str",mre.getContentType());
      post.setRequestHeader("String_Node_Str",String.valueOf(mre.getContentLength()));
    }
 else     if (request.getEntityWriter() != null) {
      post.setRequestEntity(new EntityWriterRequestEntity(request.getEntityWriter(),computeAndSetContentLength(request,post)));
    }
 else     if (request.getFile() != null) {
      File file=request.getFile();
      if (!file.isFile()) {
        throw new IOException(String.format(Thread.currentThread() + "String_Node_Str",file.getAbsolutePath()));
      }
      post.setRequestHeader("String_Node_Str",String.valueOf(file.length()));
      FileInputStream fis=new FileInputStream(file);
      try {
        InputStreamRequestEntity r=new InputStreamRequestEntity(fis);
        post.setRequestEntity(r);
        post.setRequestHeader("String_Node_Str",String.valueOf(r.getContentLength()));
      }
  finally {
        fis.close();
      }
    }
 else     if (request.getBodyGenerator() != null) {
      Body body=request.getBodyGenerator().createBody();
      try {
        int length=(int)body.getContentLength();
        if (length < 0) {
          length=(int)request.getLength();
        }
        if (length >= 0) {
          post.setRequestHeader("String_Node_Str",String.valueOf(length));
          byte[] bytes=new byte[length];
          ByteBuffer buffer=ByteBuffer.wrap(bytes);
          for (; ; ) {
            buffer.clear();
            if (body.read(buffer) < 0) {
              break;
            }
          }
          post.setRequestEntity(new ByteArrayRequestEntity(bytes));
        }
      }
  finally {
        try {
          body.close();
        }
 catch (        IOException e) {
          logger.warn("String_Node_Str",e.getMessage(),e);
        }
      }
    }
    method=post;
  }
 else   if (methodName.equalsIgnoreCase("String_Node_Str")) {
    method=new DeleteMethod(request.getUrl());
  }
 else   if (methodName.equalsIgnoreCase("String_Node_Str")) {
    method=new HeadMethod(request.getUrl());
  }
 else   if (methodName.equalsIgnoreCase("String_Node_Str")) {
    method=new GetMethod(request.getUrl());
  }
 else   if (methodName.equalsIgnoreCase("String_Node_Str")) {
    method=new OptionsMethod(request.getUrl());
  }
 else {
    throw new IllegalStateException(String.format("String_Node_Str",methodName));
  }
  ProxyServer proxyServer=request.getProxyServer() != null ? request.getProxyServer() : config.getProxyServer();
  if (proxyServer != null) {
    if (proxyServer.getPrincipal() != null) {
      Credentials defaultcreds=new UsernamePasswordCredentials(proxyServer.getPrincipal(),proxyServer.getPassword());
      client.getState().setCredentials(new AuthScope(null,-1,AuthScope.ANY_REALM),defaultcreds);
    }
    ProxyHost proxyHost=proxyServer == null ? null : new ProxyHost(proxyServer.getHost(),proxyServer.getPort());
    client.getHostConfiguration().setProxyHost(proxyHost);
  }
  method.setFollowRedirects(false);
  if ((request.getCookies() != null) && !request.getCookies().isEmpty()) {
    for (    Cookie cookie : request.getCookies()) {
      method.setRequestHeader("String_Node_Str",AsyncHttpProviderUtils.encodeCookies(request.getCookies()));
    }
  }
  if (request.getHeaders() != null) {
    for (    String name : request.getHeaders().keySet()) {
      if (!"String_Node_Str".equalsIgnoreCase(name)) {
        for (        String value : request.getHeaders().get(name)) {
          method.setRequestHeader(name,value);
        }
      }
    }
  }
  if (request.getHeaders().getFirstValue("String_Node_Str") == null && config.getUserAgent() != null) {
    method.setRequestHeader("String_Node_Str",config.getUserAgent());
  }
 else {
    method.setRequestHeader("String_Node_Str",AsyncHttpProviderUtils.constructUserAgent(ApacheAsyncHttpProvider.class));
  }
  if (config.isCompressionEnabled()) {
    Header acceptableEncodingHeader=method.getRequestHeader("String_Node_Str");
    if (acceptableEncodingHeader != null) {
      String acceptableEncodings=acceptableEncodingHeader.getValue();
      if (acceptableEncodings.indexOf("String_Node_Str") == -1) {
        StringBuilder buf=new StringBuilder(acceptableEncodings);
        if (buf.length() > 1) {
          buf.append("String_Node_Str");
        }
        buf.append("String_Node_Str");
        method.setRequestHeader("String_Node_Str",buf.toString());
      }
    }
 else {
      method.setRequestHeader("String_Node_Str","String_Node_Str");
    }
  }
  if (request.getVirtualHost() != null) {
    method.getParams().setVirtualHost(request.getVirtualHost());
  }
  return method;
}