nus-yam/ex-repair huggingface dataset:
Program: 151974
Project: 151974
Buggy source:
public KafkaConsumer(String topic,Properties props,int numThreads){
  LOG.info("String_Node_Str" + numThreads);
  executor=Executors.newFixedThreadPool(numThreads);
  workers=new ArrayList<Future<Void>>(numThreads);
  ConsumerConfig consumerConfig=new ConsumerConfig(props);
  consumerConnector=kafka.consumer.Consumer.createJavaConsumerConnector(consumerConfig);
  streams=consumerConnector.createMessageStreamsByFilter(new Whitelist(topic),numThreads);
  consumed=Metrics.newMeter(new MetricName("String_Node_Str","String_Node_Str",topic + "String_Node_Str"),"String_Node_Str",TimeUnit.SECONDS);
}

Fixed version (ground truth):
public KafkaConsumer(String topic,Properties props,int numThreads){
  LOG.info("String_Node_Str" + numThreads);
  executor=Executors.newFixedThreadPool(numThreads);
  workers=new ArrayList<Future<Void>>(numThreads);
  ConsumerConfig consumerConfig=new ConsumerConfig(props);
  consumerConnector=kafka.consumer.Consumer.createJavaConsumerConnector(consumerConfig);
  streams=consumerConnector.createMessageStreamsByFilter(new Whitelist(topic),numThreads);
  consumed=Metrics.newMeter(new MetricName("String_Node_Str","String_Node_Str",topic + "String_Node_Str"),"String_Node_Str",TimeUnit.SECONDS);
  invalidMessageMeter=Metrics.newMeter(new MetricName("String_Node_Str","String_Node_Str",topic + "String_Node_Str"),"String_Node_Str",TimeUnit.SECONDS);
}
Program: 151978
Project: 151978
Buggy source:
/** 
 * Takes a given id and gives you an hbase shell compatible string that you can use for get command.
 * @param id
 * @param d
 * @return
 * @throws IOException
 */
public static String hbaseShellId(String id,Date d) throws IOException {
  byte[] idBytes=IdUtil.nonRandByteBucketizeId(id,d);
  StringBuilder sb=new StringBuilder("String_Node_Str");
  sb.append(String.format("String_Node_Str",idBytes[0]));
  sb.append((new String(idBytes)).substring(1));
  sb.append("String_Node_Str");
  return sb.toString();
}

Fixed version (ground truth):
public static String hbaseShellId(byte[] idBytes) throws IOException {
  StringBuilder sb=new StringBuilder("String_Node_Str");
  sb.append(String.format("String_Node_Str",idBytes[0]));
  sb.append((new String(idBytes)).substring(1));
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 151979
Project: 151979
Buggy source:
public void run() throws Exception {
  this.configureHealthChecks();
  this.configureWebServer();
  this.configureReporters();
}

Fixed version (ground truth):
public void run() throws Exception {
  this.configureHealthChecks();
  this.configureWebServer();
  this.configureReporters();
  this.configureHttpMetrics();
}
Program: 151980
Project: 151980
Buggy source:
private void updateFailed(HttpMetrics metric,Integer size){
  HttpMetrics global_metric=getHttpMetrics("String_Node_Str");
  metric.failedReqsCount.inc();
  metric.failedReqsSize.inc(size);
  metric.totalReqsCount.inc();
  metric.totalReqsSize.inc(size);
  global_metric.failedReqsCount.inc();
  global_metric.failedReqsSize.inc(size);
  global_metric.totalReqsCount.inc();
  global_metric.totalReqsSize.inc(size);
}

Fixed version (ground truth):
private void updateFailed(String namespace,int size){
  MetricsManager.getInstance().getHttpMetricForNamespace(namespace).updateFailed(size);
  MetricsManager.getInstance().getGlobalHttpMetric().updateFailed(size);
}
Program: 151981
Project: 151981
Buggy source:
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  Object msg=e.getMessage();
  HttpMetrics metric=this.getHttpMetrics("String_Node_Str");
  if (msg instanceof HttpRequest) {
    HttpRequest request=(HttpRequest)e.getMessage();
    PathDecoder pd=new PathDecoder(request.getUri());
    String endpoint=pd.getPathElement(ENDPOINT_PATH_IDX);
    if (endpoint != null && ENDPOINT_SUBMIT.equals(endpoint)) {
      String namespace=pd.getPathElement(NAMESPACE_PATH_IDX);
      String id=pd.getPathElement(ID_PATH_IDX);
      if (id == null) {
        id=UUID.randomUUID().toString();
      }
      IMap<String,String> m=Hazelcast.getMap(namespace);
      if (request.getMethod() == HttpMethod.POST || request.getMethod() == HttpMethod.PUT) {
        handlePost(e,request,namespace,id,m);
      }
 else       if (request.getMethod() == HttpMethod.GET) {
        handleGet(e,request,namespace,id,m);
      }
 else       if (request.getMethod() == HttpMethod.DELETE) {
        handleDelete(e,request,namespace,id,m);
      }
 else {
        writeResponse(NOT_FOUND,e,null);
      }
    }
 else {
      String userAgent=request.getHeader("String_Node_Str");
      String remoteIpAddress=e.getChannel().getRemoteAddress().toString();
      LOG.warn(String.format("String_Node_Str",remoteIpAddress,userAgent));
      writeResponse(NOT_ACCEPTABLE,e,null);
    }
  }
 else {
    writeResponse(INTERNAL_SERVER_ERROR,e,null);
  }
}

Fixed version (ground truth):
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  Object msg=e.getMessage();
  if (msg instanceof HttpRequest) {
    HttpRequest request=(HttpRequest)e.getMessage();
    PathDecoder pd=new PathDecoder(request.getUri());
    String endpoint=pd.getPathElement(ENDPOINT_PATH_IDX);
    if (endpoint != null && ENDPOINT_SUBMIT.equals(endpoint)) {
      String namespace=pd.getPathElement(NAMESPACE_PATH_IDX);
      String id=pd.getPathElement(ID_PATH_IDX);
      if (id == null) {
        id=UUID.randomUUID().toString();
      }
      IMap<String,String> m=Hazelcast.getMap(namespace);
      if (request.getMethod() == HttpMethod.POST || request.getMethod() == HttpMethod.PUT) {
        handlePost(e,request,namespace,id,m);
      }
 else       if (request.getMethod() == HttpMethod.GET) {
        handleGet(e,request,namespace,id,m);
      }
 else       if (request.getMethod() == HttpMethod.DELETE) {
        handleDelete(e,request,namespace,id,m);
      }
 else {
        writeResponse(NOT_FOUND,e,null);
      }
    }
 else {
      String userAgent=request.getHeader("String_Node_Str");
      String remoteIpAddress=e.getChannel().getRemoteAddress().toString();
      LOG.warn(String.format("String_Node_Str",remoteIpAddress,userAgent));
      writeResponse(NOT_ACCEPTABLE,e,null);
    }
  }
 else {
    writeResponse(INTERNAL_SERVER_ERROR,e,null);
  }
}
Program: 151982
Project: 151982
Buggy source:
private void handlePost(MessageEvent e,HttpRequest request,String namespace,String id,IMap<String,String> m){
  HttpResponseStatus status=NOT_ACCEPTABLE;
  ChannelBuffer content=request.getContent();
  HttpMetrics ns_metric=getHttpMetrics(namespace);
  if (content.readable() && content.readableBytes() > 0) {
    if (NS_METRICS.equals(namespace)) {
      status=metricsProcessor.process(m,id,content.toString(CharsetUtil.UTF_8),e.getChannel().getRemoteAddress().toString(),request.getHeader("String_Node_Str"));
    }
 else {
      m.put(id,content.toString(CharsetUtil.UTF_8));
      status=CREATED;
    }
  }
  if (status != CREATED) {
    updateFailed(ns_metric,content.readableBytes());
  }
 else {
    updateSuccessful(ns_metric,content.readableBytes());
  }
  writeResponse(status,e,URI.create(id).toString());
}

Fixed version (ground truth):
private void handlePost(MessageEvent e,HttpRequest request,String namespace,String id,IMap<String,String> m){
  HttpResponseStatus status=NOT_ACCEPTABLE;
  ChannelBuffer content=request.getContent();
  if (content.readable() && content.readableBytes() > 0) {
    if (NS_METRICS.equals(namespace)) {
      status=metricsProcessor.process(m,id,content.toString(CharsetUtil.UTF_8),e.getChannel().getRemoteAddress().toString(),request.getHeader("String_Node_Str"));
    }
 else {
      m.put(id,content.toString(CharsetUtil.UTF_8));
      status=CREATED;
    }
  }
  if (status != CREATED) {
    updateFailed(namespace,content.readableBytes());
  }
 else {
    updateSuccesssful(namespace,content.readableBytes());
  }
  writeResponse(status,e,URI.create(id).toString());
}
Program: 151983
Project: 151983
Buggy source:
public void poll() throws InterruptedException {
  while (true) {
    if (!nsMap.isEmpty()) {
      try {
        List<Put> puts=new ArrayList<Put>();
        for (        String k : nsMap.keySet()) {
          String v=nsMap.remove(k);
          if (v != null) {
            byte[] rowId=prefixDate ? IdUtil.bucketizeId(k) : Bytes.toBytes(k);
            Put p=new Put(rowId);
            p.add(family,qualifier,Bytes.toBytes(v));
            puts.add(p);
            if (puts.size() >= batchSize)             break;
          }
        }
        if (puts.size() > 0) {
          workerPool.submit(new HBaseWorkerThread((HTable)hbasePool.getTable(tableName),puts));
        }
      }
 catch (      IOException e) {
        LOG.error("String_Node_Str",e);
        throw new RuntimeException(e);
      }
    }
 else {
      Thread.sleep(sleepTime);
    }
  }
}

Fixed version (ground truth):
public void poll() throws InterruptedException {
  while (true) {
    if (!nsMap.isEmpty()) {
      try {
        List<Put> puts=new ArrayList<Put>();
        for (        String k : nsMap.keySet()) {
          String v=nsMap.remove(k);
          if (v != null) {
            try {
              byte[] rowId=prefixDate ? IdUtil.bucketizeId(k) : Bytes.toBytes(k);
              Put p=new Put(rowId);
              p.add(family,qualifier,Bytes.toBytes(v));
              puts.add(p);
            }
 catch (            NumberFormatException e) {
              LOG.error("String_Node_Str" + k,e);
            }
            if (puts.size() >= batchSize)             break;
          }
        }
        if (puts.size() > 0) {
          workerPool.submit(new HBaseWorkerThread((HTable)hbasePool.getTable(tableName),puts));
        }
      }
 catch (      IOException e) {
        LOG.error("String_Node_Str",e);
        throw new RuntimeException(e);
      }
    }
 else {
      Thread.sleep(sleepTime);
    }
  }
}
Program: 151984
Project: 151984
Buggy source:
@Override public void storeAll(Map<String,String> pairs){
  HTable table=null;
  try {
    List<Put> puts=new ArrayList<Put>(pairs.size());
    for (    Map.Entry<String,String> pair : pairs.entrySet()) {
      byte[] rowId=prefixDate ? IdUtil.bucketizeId(pair.getKey()) : Bytes.toBytes(pair.getKey());
      Put p=new Put(rowId);
      if (outputFormatType == StoreFormatType.SMILE) {
        p.add(family,qualifier,jsonSmileConverter.convertToSmile(pair.getValue()));
      }
 else {
        p.add(family,qualifier,Bytes.toBytes(pair.getValue()));
      }
      puts.add(p);
    }
    table=(HTable)pool.getTable(tableName);
    table.setAutoFlush(false);
    table.put(puts);
    table.flushCommits();
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
 finally {
    if (table != null) {
      pool.putTable(table);
    }
  }
}

Fixed version (ground truth):
@Override public void storeAll(Map<String,String> pairs){
  HTable table=null;
  try {
    List<Put> puts=new ArrayList<Put>(pairs.size());
    for (    Map.Entry<String,String> pair : pairs.entrySet()) {
      try {
        byte[] rowId=prefixDate ? IdUtil.bucketizeId(pair.getKey()) : Bytes.toBytes(pair.getKey());
        Put p=new Put(rowId);
        if (outputFormatType == StoreFormatType.SMILE) {
          p.add(family,qualifier,jsonSmileConverter.convertToSmile(pair.getValue()));
        }
 else {
          p.add(family,qualifier,Bytes.toBytes(pair.getValue()));
        }
        puts.add(p);
      }
 catch (      NumberFormatException nfe) {
        LOG.error("String_Node_Str" + pair.getKey(),nfe);
      }
    }
    table=(HTable)pool.getTable(tableName);
    table.setAutoFlush(false);
    table.put(puts);
    table.flushCommits();
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
 finally {
    if (table != null) {
      pool.putTable(table);
    }
  }
}
Program: 151985
Project: 151985
Buggy source:
@Override public void store(String key,String value){
  HTableInterface table=null;
  try {
    table=pool.getTable(tableName);
    byte[] rowId=prefixDate ? IdUtil.bucketizeId(key) : Bytes.toBytes(key);
    Put p=new Put(rowId);
    if (outputFormatType == StoreFormatType.SMILE) {
      p.add(family,qualifier,jsonSmileConverter.convertToSmile(value));
    }
 else {
      p.add(family,qualifier,Bytes.toBytes(value));
    }
    table.put(p);
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
 finally {
    if (table != null) {
      pool.putTable(table);
    }
  }
}

Fixed version (ground truth):
@Override public void store(String key,String value){
  HTableInterface table=null;
  try {
    table=pool.getTable(tableName);
    try {
      byte[] rowId=prefixDate ? IdUtil.bucketizeId(key) : Bytes.toBytes(key);
      Put p=new Put(rowId);
      if (outputFormatType == StoreFormatType.SMILE) {
        p.add(family,qualifier,jsonSmileConverter.convertToSmile(value));
      }
 else {
        p.add(family,qualifier,Bytes.toBytes(value));
      }
      table.put(p);
    }
 catch (    NumberFormatException nfe) {
      LOG.error("String_Node_Str" + key,nfe);
    }
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
 finally {
    if (table != null) {
      pool.putTable(table);
    }
  }
}
Program: 151986
Project: 151986
Buggy source:
public static void main(String[] args){
  int port=Integer.parseInt(System.getProperty("String_Node_Str","String_Node_Str"));
  Hazelcast.getDefaultInstance();
  Config config=Hazelcast.getConfig();
  for (  Map.Entry<String,MapConfig> entry : config.getMapConfigs().entrySet()) {
    String mapName=entry.getKey();
    if (!mapName.contains("String_Node_Str")) {
      Hazelcast.getMap(entry.getKey());
    }
  }
  NioServerSocketChannelFactory channelFactory=new NioServerSocketChannelFactory(Executors.newCachedThreadPool(),Executors.newCachedThreadPool());
  ServerBootstrap sb=new ServerBootstrap(channelFactory);
  HttpServerPipelineFactory pipeFactory;
  try {
    pipeFactory=new HttpServerPipelineFactory(config.getMapConfigs().keySet());
    sb.setPipelineFactory(pipeFactory);
    sb.bind(new InetSocketAddress(port));
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  int port=Integer.parseInt(System.getProperty("String_Node_Str","String_Node_Str"));
  Hazelcast.getDefaultInstance();
  Config config=Hazelcast.getConfig();
  for (  Map.Entry<String,MapConfig> entry : config.getMapConfigs().entrySet()) {
    String mapName=entry.getKey();
    if (!mapName.contains("String_Node_Str")) {
      Hazelcast.getMap(entry.getKey());
    }
  }
  NioServerSocketChannelFactory channelFactory=new NioServerSocketChannelFactory(Executors.newCachedThreadPool(),Executors.newFixedThreadPool(DEFAULT_IO_THREADS));
  ServerBootstrap sb=new ServerBootstrap(channelFactory);
  HttpServerPipelineFactory pipeFactory;
  try {
    pipeFactory=new HttpServerPipelineFactory(config.getMapConfigs().keySet());
    sb.setPipelineFactory(pipeFactory);
    sb.setOption("String_Node_Str",true);
    sb.setOption("String_Node_Str",false);
    sb.bind(new InetSocketAddress(port));
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
}
Program: 151987
Project: 151987
Buggy source:
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  Object msg=e.getMessage();
  if (msg instanceof HttpRequest) {
    HttpRequest request=(HttpRequest)e.getMessage();
    PathDecoder pd=new PathDecoder(request.getUri());
    String endpoint=pd.getPathElement(ENDPOINT_PATH_IDX);
    if (endpoint != null && ENDPOINT_SUBMIT.equals(endpoint)) {
      String namespace=pd.getPathElement(NAMESPACE_PATH_IDX);
      String id=pd.getPathElement(ID_PATH_IDX);
      if (id == null) {
        id=UUID.randomUUID().toString();
      }
      IMap<String,String> m=Hazelcast.getMap(namespace);
      if (request.getMethod() == HttpMethod.POST || request.getMethod() == HttpMethod.PUT) {
        handlePost(e,request,namespace,id,m);
      }
 else       if (request.getMethod() == HttpMethod.GET) {
        handleGet(e,request,namespace,id,m);
      }
 else       if (request.getMethod() == HttpMethod.DELETE) {
        handleDelete(e,request,namespace,id,m);
      }
 else {
        writeResponse(NOT_FOUND,e,null);
      }
    }
 else     if (endpoint != null && ENDPOINT_STATS.equals("String_Node_Str")) {
      writeResponse(OK,e,null);
    }
 else {
      String userAgent=request.getHeader("String_Node_Str");
      String remoteIpAddress=e.getChannel().getRemoteAddress().toString();
      LOG.warn(String.format("String_Node_Str",remoteIpAddress,userAgent));
      writeResponse(NOT_ACCEPTABLE,e,null);
    }
  }
 else {
    writeResponse(INTERNAL_SERVER_ERROR,e,null);
  }
}

Fixed version (ground truth):
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  Object msg=e.getMessage();
  if (msg instanceof HttpRequest) {
    HttpRequest request=(HttpRequest)e.getMessage();
    PathDecoder pd=new PathDecoder(request.getUri());
    String endpoint=pd.getPathElement(ENDPOINT_PATH_IDX);
    if (endpoint != null && ENDPOINT_SUBMIT.equals(endpoint)) {
      String namespace=pd.getPathElement(NAMESPACE_PATH_IDX);
      String id=pd.getPathElement(ID_PATH_IDX);
      if (id == null) {
        id=UUID.randomUUID().toString();
      }
      IMap<String,String> m=Hazelcast.getMap(namespace);
      if (request.getMethod() == HttpMethod.POST || request.getMethod() == HttpMethod.PUT) {
        handlePost(e,request,namespace,id,m);
      }
 else       if (request.getMethod() == HttpMethod.GET) {
        handleGet(e,request,namespace,id,m);
      }
 else       if (request.getMethod() == HttpMethod.DELETE) {
        handleDelete(e,request,namespace,id,m);
      }
 else {
        writeResponse(NOT_FOUND,e,null);
      }
    }
 else {
      String userAgent=request.getHeader("String_Node_Str");
      String remoteIpAddress=e.getChannel().getRemoteAddress().toString();
      LOG.warn(String.format("String_Node_Str",remoteIpAddress,userAgent));
      writeResponse(NOT_ACCEPTABLE,e,null);
    }
  }
 else {
    writeResponse(INTERNAL_SERVER_ERROR,e,null);
  }
}
Program: 151988
Project: 151988
Buggy source:
@Override public void exceptionCaught(ChannelHandlerContext ctx,ExceptionEvent e) throws Exception {
  Throwable cause=e.getCause();
  HttpResponse response=null;
  if (cause instanceof InvalidJsonException) {
    LOG.error(cause.getMessage());
    response=new DefaultHttpResponse(HTTP_1_1,NOT_ACCEPTABLE);
  }
 else   if (cause instanceof TooLongFrameException) {
    response=new DefaultHttpResponse(HTTP_1_1,REQUEST_ENTITY_TOO_LARGE);
  }
 else   if (cause instanceof InvalidPathException) {
    response=new DefaultHttpResponse(HTTP_1_1,NOT_FOUND);
  }
 else   if (cause instanceof SecurityException) {
    LOG.error(cause.getMessage());
    response=new DefaultHttpResponse(HTTP_1_1,FORBIDDEN);
  }
 else {
    LOG.error(cause.getMessage());
    response=new DefaultHttpResponse(HTTP_1_1,INTERNAL_SERVER_ERROR);
  }
  response.addHeader(CONTENT_TYPE,"String_Node_Str");
  ChannelFuture future=e.getChannel().write(response);
  future.addListener(ChannelFutureListener.CLOSE);
}

Fixed version (ground truth):
@Override public void exceptionCaught(ChannelHandlerContext ctx,ExceptionEvent e) throws Exception {
  Throwable cause=e.getCause();
  HttpResponse response=null;
  if (cause instanceof InvalidJsonException) {
    LOG.error(cause.getMessage());
    response=new DefaultHttpResponse(HTTP_1_1,NOT_ACCEPTABLE);
  }
 else   if (cause instanceof TooLongFrameException) {
    response=new DefaultHttpResponse(HTTP_1_1,REQUEST_ENTITY_TOO_LARGE);
  }
 else   if (cause instanceof InvalidPathException) {
    response=new DefaultHttpResponse(HTTP_1_1,NOT_FOUND);
  }
 else   if (cause instanceof HttpSecurityException) {
    LOG.error(cause.getMessage());
    response=new DefaultHttpResponse(HTTP_1_1,FORBIDDEN);
  }
 else {
    LOG.error(cause.getMessage());
    response=new DefaultHttpResponse(HTTP_1_1,INTERNAL_SERVER_ERROR);
  }
  response.addHeader(CONTENT_TYPE,"String_Node_Str");
  ChannelFuture future=e.getChannel().write(response);
  future.addListener(ChannelFutureListener.CLOSE);
}
Program: 151989
Project: 151989
Buggy source:
private void handlePost(MessageEvent e,HttpRequest request,String namespace,String id,IMap<String,String> m){
  HttpResponseStatus status=NOT_FOUND;
  ChannelBuffer content=request.getContent();
  if (content.readable()) {
    if (NS_METRICS.equals(namespace)) {
      status=metricsProcessor.process(m,id,content.toString(CharsetUtil.UTF_8),e.getChannel().getRemoteAddress().toString(),request.getHeader("String_Node_Str"));
    }
 else {
      m.put(id,content.toString(CharsetUtil.UTF_8));
      status=CREATED;
    }
  }
  writeResponse(status,e,URI.create(id).toString());
}

Fixed version (ground truth):
private void handlePost(MessageEvent e,HttpRequest request,String namespace,String id,IMap<String,String> m){
  HttpResponseStatus status=NOT_ACCEPTABLE;
  ChannelBuffer content=request.getContent();
  if (content.readable() && content.readableBytes() > 0) {
    if (NS_METRICS.equals(namespace)) {
      status=metricsProcessor.process(m,id,content.toString(CharsetUtil.UTF_8),e.getChannel().getRemoteAddress().toString(),request.getHeader("String_Node_Str"));
    }
 else {
      m.put(id,content.toString(CharsetUtil.UTF_8));
      status=CREATED;
    }
  }
  writeResponse(status,e,URI.create(id).toString());
}
Program: 151990
Project: 151990
Buggy source:
public ChannelPipeline getPipeline() throws Exception {
  ChannelPipeline pipeline=Channels.pipeline();
  pipeline.addLast("String_Node_Str",new HttpRequestDecoder());
  pipeline.addLast("String_Node_Str",new HttpChunkAggregator(maxContentLength));
  pipeline.addLast("String_Node_Str",new ContentLengthFilter(maxContentLength));
  pipeline.addLast("String_Node_Str",new HttpContentDecompressor());
  pipeline.addLast("String_Node_Str",new HttpResponseEncoder());
  pipeline.addLast("String_Node_Str",new UriPatternFilter(validator));
  pipeline.addLast("String_Node_Str",new AccessFilter(validator,HazelcastMapHandler.NAMESPACE_PATH_IDX,props));
  pipeline.addLast("String_Node_Str",new JsonFilter(validator));
  pipeline.addLast("String_Node_Str",new HazelcastMapHandler(metricsProcessor));
  return pipeline;
}

Fixed version (ground truth):
public ChannelPipeline getPipeline() throws Exception {
  ChannelPipeline pipeline=Channels.pipeline();
  pipeline.addLast("String_Node_Str",new HttpRequestDecoder());
  pipeline.addLast("String_Node_Str",new RootResponse());
  pipeline.addLast("String_Node_Str",new StatsHandler());
  pipeline.addLast("String_Node_Str",new HttpChunkAggregator(maxContentLength));
  pipeline.addLast("String_Node_Str",new ContentLengthFilter(maxContentLength));
  pipeline.addLast("String_Node_Str",new AccessFilter(validator,HazelcastMapHandler.NAMESPACE_PATH_IDX,props));
  pipeline.addLast("String_Node_Str",new HttpContentDecompressor());
  pipeline.addLast("String_Node_Str",new JsonFilter(validator));
  pipeline.addLast("String_Node_Str",new HttpResponseEncoder());
  pipeline.addLast("String_Node_Str",new HazelcastMapHandler(metricsProcessor));
  return pipeline;
}
Program: 151991
Project: 151991
Buggy source:
public AccessFilter(NamespaceValidator nsValidator,int nsPathIdx,WildcardProperties props){
  this.nsValidator=nsValidator;
  this.nsPathIdx=nsPathIdx;
  this.props=props;
}

Fixed version (ground truth):
public AccessFilter(Validator validator,int nsPathIdx,WildcardProperties props){
  this.validator=validator;
  this.nsPathIdx=nsPathIdx;
  this.props=props;
}
Program: 151993
Project: 151993
Buggy source:
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  Object msg=e.getMessage();
  if (msg instanceof HttpRequest) {
    HttpRequest request=(HttpRequest)e.getMessage();
    ChannelBuffer content=request.getContent();
    if (content.readable()) {
      if (!jsonValidator.isValidJson(content.toString(CharsetUtil.UTF_8))) {
        throw new InvalidJsonException("String_Node_Str");
      }
 else {
        Channels.fireMessageReceived(ctx,request,e.getRemoteAddress());
      }
    }
  }
 else {
    ctx.sendUpstream(e);
  }
}

Fixed version (ground truth):
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  Object msg=e.getMessage();
  if (msg instanceof HttpRequest) {
    HttpRequest request=(HttpRequest)e.getMessage();
    ChannelBuffer content=request.getContent();
    if (content.readable()) {
      if (!jsonValidator.isValidJson(content.toString(CharsetUtil.UTF_8))) {
        throw new InvalidJsonException("String_Node_Str");
      }
    }
    Channels.fireMessageReceived(ctx,request,e.getRemoteAddress());
  }
 else {
    ctx.sendUpstream(e);
  }
}
Program: 151994
Project: 151994
Buggy source:
public HttpResponseStatus process(IMap<String,String> hcMap,String id,String newDocument,String remoteAddr,String obsoleteDocId){
  HttpResponseStatus status=NOT_ACCEPTABLE;
  try {
    ObjectNode aggregate=objectMapper.readValue(newDocument,ObjectNode.class);
    if (isValidDocument(aggregate)) {
      setGeoLocation(aggregate,remoteAddr);
      hcMap.put(id,objectMapper.writeValueAsString(aggregate));
      if (obsoleteDocId != null) {
        hcMap.remove(id);
      }
      status=HttpResponseStatus.CREATED;
    }
 else {
      LOG.error("String_Node_Str");
    }
  }
 catch (  JsonParseException e) {
    LOG.error("String_Node_Str",e);
  }
catch (  JsonMappingException e) {
    LOG.error("String_Node_Str",e);
  }
catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
  return status;
}

Fixed version (ground truth):
public HttpResponseStatus process(IMap<String,String> hcMap,String id,String newDocument,String remoteAddr,String obsoleteDocId){
  HttpResponseStatus status=NOT_ACCEPTABLE;
  try {
    ObjectNode aggregate=objectMapper.readValue(newDocument,ObjectNode.class);
    if (isValidDocument(aggregate)) {
      setGeoLocation(aggregate,remoteAddr);
      hcMap.put(id,objectMapper.writeValueAsString(aggregate));
      if (obsoleteDocId != null) {
        hcMap.remove(obsoleteDocId);
      }
      status=HttpResponseStatus.CREATED;
    }
 else {
      LOG.error("String_Node_Str");
    }
  }
 catch (  JsonParseException e) {
    LOG.error("String_Node_Str",e);
  }
catch (  JsonMappingException e) {
    LOG.error("String_Node_Str",e);
  }
catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
  return status;
}
Program: 151995
Project: 151995
Buggy source:
@GET @Produces(MediaType.TEXT_PLAIN) public Response getStats(){
  StringBuilder sb=new StringBuilder();
  for (  Map.Entry<String,Stats> entry : rs.getStatsMap().entrySet()) {
    Stats stats=entry.getValue();
    sb.append("String_Node_Str").append(entry.getKey()).append("String_Node_Str");
    sb.append("String_Node_Str").append(stats.numRequests.get()).append("String_Node_Str");
    sb.append("String_Node_Str").append(stats.numValidRequests.get()).append("String_Node_Str");
    sb.append("String_Node_Str").append(stats.numInvalidRequests.get()).append("String_Node_Str");
    sb.append("String_Node_Str").append(stats.numForbiddenRequests.get()).append("String_Node_Str");
    sb.append("String_Node_Str").append(stats.numPuts.get()).append("String_Node_Str");
    sb.append("String_Node_Str").append(stats.numGets.get()).append("String_Node_Str");
    sb.append("String_Node_Str").append(stats.numDels.get());
  }
  return Response.ok(sb.toString(),MediaType.APPLICATION_JSON).build();
}

Fixed version (ground truth):
@GET @Produces(MediaType.TEXT_PLAIN) public Response getStats(){
  StringBuilder sb=new StringBuilder();
  for (  Map.Entry<String,Stats> entry : rs.getStatsMap().entrySet()) {
    Stats stats=entry.getValue();
    sb.append("String_Node_Str").append(entry.getKey()).append("String_Node_Str");
    sb.append("String_Node_Str").append(stats.numRequests.get()).append("String_Node_Str");
    sb.append("String_Node_Str").append(stats.numValidRequests.get()).append("String_Node_Str");
    sb.append("String_Node_Str").append(stats.numInvalidRequests.get()).append("String_Node_Str");
    sb.append("String_Node_Str").append(stats.numForbiddenRequests.get()).append("String_Node_Str");
    sb.append("String_Node_Str").append(stats.numPuts.get()).append("String_Node_Str");
    sb.append("String_Node_Str").append(stats.numGets.get()).append("String_Node_Str");
    sb.append("String_Node_Str").append(stats.numDels.get()).append("String_Node_Str");
  }
  return Response.ok(sb.toString(),MediaType.APPLICATION_JSON).build();
}
Program: 151996
Project: 151996
Buggy source:
/** 
 * Add a collection of rules to the Gnip stream
 * @param account The account name for the power track API. (For example: acme)
 * @param streamName the streamName
 * @param rule The Rules object to add to the tracker
 */
void addRules(String account,String streamName,Rules rules);

Fixed version (ground truth):
/** 
 * Add a collection of rules to the Gnip stream
 * @param account The account name for the power track API. (For example: acme)
 * @param streamName the streamName
 * @param rules The Rules object to add to the tracker
 */
void addRules(String account,String streamName,Rules rules);
Program: 151997
Project: 151997
Buggy source:
/** 
 * Constructs a   {@link Base64.OutputStream} in either ENCODE or DECODEmode. <p> Valid options: <pre> ENCODE or DECODE: Encode or Decode as data is read. DO_BREAK_LINES: don't break lines at 76 characters (only meaningful when encoding)</i> </pre> <p> Example: <code>new Base64.OutputStream( out, Base64.ENCODE )</code>
 * @param out the <tt>java.io.OutputStream</tt> to which data will be written.
 * @param options Specified options.
 * @see Base64#ENCODE
 * @see Base64#DECODE
 * @see Base64#DO_BREAK_LINES
 * @since 1.3
 */
public OutputStream(final java.io.OutputStream out,final int options){
  super(out);
  this.breakLines=(options & DO_BREAK_LINES) != 0;
  this.encode=(options & ENCODE) != 0;
  this.bufferLength=encode ? 3 : 4;
  this.buffer=new byte[bufferLength];
  this.position=0;
  this.lineLength=0;
  this.suspendEncoding=false;
  this.b4=new byte[4];
  this.options=options;
  this.decodabet=getDecodabet(options);
}

Fixed version (ground truth):
/** 
 * Constructs a   {@link Base64.OutputStream} in either ENCODE or DECODEmode. <p> Valid options: <pre> ENCODE or DECODE: Encode or Decode as data is read. DO_BREAK_LINES: don't break lines at 76 characters (only meaningful when encoding) </pre> <p> Example: <code>new Base64.OutputStream( out, Base64.ENCODE )</code>
 * @param out the <tt>java.io.OutputStream</tt> to which data will be written.
 * @param options Specified options.
 * @see Base64#ENCODE
 * @see Base64#DECODE
 * @see Base64#DO_BREAK_LINES
 * @since 1.3
 */
public OutputStream(final java.io.OutputStream out,final int options){
  super(out);
  this.breakLines=(options & DO_BREAK_LINES) != 0;
  this.encode=(options & ENCODE) != 0;
  this.bufferLength=encode ? 3 : 4;
  this.buffer=new byte[bufferLength];
  this.position=0;
  this.lineLength=0;
  this.suspendEncoding=false;
  this.b4=new byte[4];
  this.options=options;
  this.decodabet=getDecodabet(options);
}
Program: 151998
Project: 151998
Buggy source:
/** 
 * Constructs a   {@link Base64.InputStream} in either ENCODE or DECODEmode. <p> Valid options: <pre> ENCODE or DECODE: Encode or Decode as data is read. DO_BREAK_LINES: break lines at 76 characters (only meaningful when encoding)</i> </pre> <p> Example: <code>new Base64.InputStream( in, Base64.DECODE )</code>
 * @param in the <tt>java.io.InputStream</tt> from which to read data.
 * @param options Specified options
 * @see Base64#ENCODE
 * @see Base64#DECODE
 * @see Base64#DO_BREAK_LINES
 * @since 2.0
 */
public InputStream(final java.io.InputStream in,final int options){
  super(in);
  this.options=options;
  this.breakLines=(options & DO_BREAK_LINES) > 0;
  this.encode=(options & ENCODE) > 0;
  this.bufferLength=encode ? 4 : 3;
  this.buffer=new byte[bufferLength];
  this.position=-1;
  this.lineLength=0;
  this.decodabet=getDecodabet(options);
}

Fixed version (ground truth):
/** 
 * Constructs a   {@link Base64.InputStream} in either ENCODE or DECODEmode. <p> Valid options: <pre> ENCODE or DECODE: Encode or Decode as data is read. DO_BREAK_LINES: break lines at 76 characters (only meaningful when encoding) </pre> <p> Example: <code>new Base64.InputStream( in, Base64.DECODE )</code>
 * @param in the <tt>java.io.InputStream</tt> from which to read data.
 * @param options Specified options
 * @see Base64#ENCODE
 * @see Base64#DECODE
 * @see Base64#DO_BREAK_LINES
 * @since 2.0
 */
public InputStream(final java.io.InputStream in,final int options){
  super(in);
  this.options=options;
  this.breakLines=(options & DO_BREAK_LINES) > 0;
  this.encode=(options & ENCODE) > 0;
  this.bufferLength=encode ? 4 : 3;
  this.buffer=new byte[bufferLength];
  this.position=-1;
  this.lineLength=0;
  this.decodabet=getDecodabet(options);
}
Program: 151999
Project: 151999
Buggy source:
/** 
 * Creates the NextChunkIterator.
 * @param channel
 * @param iterator
 */
public NextChunkUnlimited(final Collection<String> activities){
  super(activities);
}

Fixed version (ground truth):
public NextChunkUnlimited(final Collection<String> activities){
  super(activities);
}
Program: 152000
Project: 152000
Buggy source:
@Override public void process(InputStream is) throws IOException, ParseException {
  BufferedReader rdr=new BufferedReader(new InputStreamReader(is));
  logger.debug("String_Node_Str",streamName);
  while (!Thread.interrupted()) {
    final String activity=rdr.readLine();
    handle(activity);
  }
}

Fixed version (ground truth):
@Override public void process(InputStream is) throws IOException, ParseException {
  BufferedReader rdr=new BufferedReader(new InputStreamReader(is));
  logger.debug("String_Node_Str",streamName);
  while (!Thread.interrupted()) {
    final String activity=rdr.readLine();
    if (activity.length() > 0) {
      handle(activity);
    }
  }
}
Program: 152001
Project: 152001
Buggy source:
@Override public final void process(final InputStream is) throws IOException, ParseException {
  final BufferedReader reader=new BufferedReader(new InputStreamReader(is,"String_Node_Str"));
  String s=null;
  while ((s=reader.readLine()) != null) {
    if (!s.isEmpty()) {
      handle(unmarshaller.unmarshall(s));
    }
    if (Thread.interrupted()) {
      break;
    }
  }
}

Fixed version (ground truth):
@Override public final void process(final InputStream is,final ModifiableStreamStats stats) throws IOException, ParseException {
  final BufferedReader reader=new BufferedReader(new InputStreamReader(is,"String_Node_Str"));
  String s=null;
  while ((s=reader.readLine()) != null) {
    if (!s.isEmpty()) {
      handle(unmarshaller.unmarshall(s));
      if (stats != null) {
        stats.incrementTransferedActivities();
      }
    }
    if (Thread.interrupted()) {
      break;
    }
  }
}
Program: 152002
Project: 152002
Buggy source:
/** 
 * process the content of a gnip feed. must be interrumplible 
 */
void process(final InputStream is) throws IOException, ParseException ;

Fixed version (ground truth):
/** 
 * process the content of a gnip feed. must be interrumplible 
 */
void process(final InputStream is,final ModifiableStreamStats stats) throws IOException, ParseException ;
Program: 152003
Project: 152003
Buggy source:
@Override public final void process(final InputStream is) throws IOException {
  final JsonParser parser=JsonActivityFeedProcessor.getObjectMapper().getJsonFactory().createJsonParser(is);
  logger.debug("String_Node_Str",streamName);
  while (!Thread.interrupted()) {
    final Activity activity=parser.readValueAs(Activity.class);
    handle(activity);
  }
}

Fixed version (ground truth):
@Override public final void process(final InputStream is,final ModifiableStreamStats stats) throws IOException {
  final JsonParser parser=JsonActivityFeedProcessor.getObjectMapper().getJsonFactory().createJsonParser(is);
  logger.info("String_Node_Str",streamName);
  while (!Thread.interrupted()) {
    final Activity activity=parser.readValueAs(Activity.class);
    handle(activity);
    if (activity != null && stats != null) {
      stats.incrementTransferedActivities();
    }
  }
}
Program: 152004
Project: 152004
Buggy source:
@Override public void process(InputStream is) throws IOException, ParseException {
  BufferedReader rdr=new BufferedReader(new InputStreamReader(is));
  logger.debug("String_Node_Str",streamName);
  while (!Thread.interrupted()) {
    final String activity=rdr.readLine();
    if (activity.length() > 0) {
      handle(activity);
    }
  }
}

Fixed version (ground truth):
@Override public void process(InputStream is,final ModifiableStreamStats stats) throws IOException, ParseException {
  BufferedReader rdr=new BufferedReader(new InputStreamReader(is));
  logger.debug("String_Node_Str",streamName);
  while (!Thread.interrupted()) {
    final String activity=rdr.readLine();
    if (activity.length() > 0) {
      handle(activity);
      if (stats != null) {
        stats.incrementTransferedActivities();
      }
    }
  }
}
Program: 152005
Project: 152005
Buggy source:
@Override public final void process(final InputStream is) throws IOException, ParseException {
  final BufferedReader reader=new BufferedReader(new InputStreamReader(is,"String_Node_Str"));
  String s=null;
  StringBuilder sb=new StringBuilder(6 * 1024);
  while ((s=reader.readLine()) != null) {
    if (startPattern.matcher(s).matches()) {
      if (sb.length() != 0) {
        sb=new StringBuilder(6 * 1024);
      }
      sb.append(s);
    }
 else     if (endPattern.matcher(s).matches()) {
      sb.append(s);
      handle(unmarshaller.unmarshall(sb.toString()));
    }
 else {
      sb.append(s);
    }
  }
}

Fixed version (ground truth):
@Override public final void process(final InputStream is,final ModifiableStreamStats stats) throws IOException, ParseException {
  final BufferedReader reader=new BufferedReader(new InputStreamReader(is,"String_Node_Str"));
  String s=null;
  StringBuilder sb=new StringBuilder(6 * 1024);
  while ((s=reader.readLine()) != null) {
    if (startPattern.matcher(s).matches()) {
      if (sb.length() != 0) {
        sb=new StringBuilder(6 * 1024);
      }
      sb.append(s);
    }
 else     if (endPattern.matcher(s).matches()) {
      sb.append(s);
      handle(unmarshaller.unmarshall(sb.toString()));
    }
 else {
      sb.append(s);
    }
    if (!s.isEmpty() && stats != null) {
      stats.incrementTransferedActivities();
    }
  }
}
Program: 152006
Project: 152006
Buggy source:
/** 
 * Creates the StreamStatsInputStream. 
 */
public StreamStatsInputStream(final ModifiableStreamStats stats,final InputStream target){
  super(target,new OutputStream(){
    @Override public void write(    final int b) throws IOException {
      stats.incrementTransferedBytes();
      if (b == '\n') {
        stats.incrementTransferedActivities();
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Creates the StreamStatsInputStream. 
 */
public StreamStatsInputStream(final ModifiableStreamStats stats,final InputStream target){
  super(target,new OutputStream(){
    @Override public void write(    final int b) throws IOException {
      stats.incrementTransferedBytes();
    }
  }
);
}
Program: 152007
Project: 152007
Buggy source:
@Override public void write(final int b) throws IOException {
  stats.incrementTransferedBytes();
  if (b == '\n') {
    stats.incrementTransferedActivities();
  }
}

Fixed version (ground truth):
@Override public void write(final int b) throws IOException {
  stats.incrementTransferedBytes();
}
Program: 152008
Project: 152008
Buggy source:
/** 
 * test 
 */
@Test public final void test() throws IOException, ParseException {
  final InputStream is=getClass().getResourceAsStream("String_Node_Str");
  try {
    final AtomicInteger i=new AtomicInteger();
    final ObjectMapper mapper=JsonActivityFeedProcessor.getObjectMapper();
    final FeedProcessor p=new XMLActivityStreamFeedProcessor<Activity>("String_Node_Str",new DirectExecuteService(),new StreamNotificationAdapter<Activity>(){
      @Override public void notify(      final Activity activity,      final GnipStream stream){
        i.incrementAndGet();
        try {
          final byte[] data0=mapper.writeValueAsBytes(activity);
          final Activity e=mapper.reader(Activity.class).readValue(data0);
          final byte[] data1=mapper.writeValueAsBytes(e);
          assertArrayEquals(data0,data1);
          final ObjectOutputStream os=new ObjectOutputStream(new ByteArrayOutputStream());
          os.writeObject(activity);
          os.close();
        }
 catch (        final Exception e) {
          throw new RuntimeException(e);
        }
      }
    }
,new ActivityUnmarshaller("String_Node_Str"));
    p.process(is);
    assertEquals(23,i.get());
  }
  finally {
    IOUtils.closeQuietly(is);
  }
}

Fixed version (ground truth):
/** 
 * test 
 */
@Test public final void test() throws IOException, ParseException {
  final InputStream is=getClass().getResourceAsStream("String_Node_Str");
  try {
    final AtomicInteger i=new AtomicInteger();
    final ObjectMapper mapper=JsonActivityFeedProcessor.getObjectMapper();
    final FeedProcessor p=new XMLActivityStreamFeedProcessor<Activity>("String_Node_Str",new DirectExecuteService(),new StreamNotificationAdapter<Activity>(){
      @Override public void notify(      final Activity activity,      final GnipStream stream){
        i.incrementAndGet();
        try {
          final byte[] data0=mapper.writeValueAsBytes(activity);
          final Activity e=mapper.reader(Activity.class).readValue(data0);
          final byte[] data1=mapper.writeValueAsBytes(e);
          assertArrayEquals(data0,data1);
          final ObjectOutputStream os=new ObjectOutputStream(new ByteArrayOutputStream());
          os.writeObject(activity);
          os.close();
        }
 catch (        final Exception e) {
          throw new RuntimeException(e);
        }
      }
    }
,new ActivityUnmarshaller("String_Node_Str"));
    p.process(is,null);
    assertEquals(23,i.get());
  }
  finally {
    IOUtils.closeQuietly(is);
  }
}
Program: 152009
Project: 152009
Buggy source:
/** 
 * applies content enconding transformation 
 */
static InputStream getRealInputStream(final URLConnection uc,InputStream is) throws IOException {
  final String encoding=uc.getContentEncoding();
  if (encoding != null && encoding.equalsIgnoreCase("String_Node_Str")) {
    is=new GZIPInputStream(is);
  }
 else   if (encoding != null && encoding.equalsIgnoreCase("String_Node_Str")) {
    is=new InflaterInputStream(is,new Inflater(true));
  }
  return is;
}

Fixed version (ground truth):
/** 
 * applies content enconding transformation 
 */
static InputStream getRealInputStream(final URLConnection uc,InputStream is) throws IOException {
  final String encoding=uc.getContentEncoding();
  if (encoding != null && encoding.equalsIgnoreCase("String_Node_Str")) {
    is=new StreamingGZIPInputStream(is);
  }
 else   if (encoding != null && encoding.equalsIgnoreCase("String_Node_Str")) {
    is=new InflaterInputStream(is,new Inflater(true));
  }
  return is;
}
Program: 152010
Project: 152010
Buggy source:
@Override public final void postResource(final URI uri,final Object resource) throws AuthenticationGnipException, TransportGnipException {
  OutputStream outStream=null;
  try {
    final URLConnection uc=uri.toURL().openConnection();
    HttpURLConnection huc=null;
    if (uc instanceof HttpURLConnection) {
      huc=(HttpURLConnection)uc;
    }
    uc.setAllowUserInteraction(false);
    uc.setDefaultUseCaches(false);
    uc.setConnectTimeout(connectTimeout);
    uc.setReadTimeout(readTimeout);
    uc.setDoOutput(true);
    uc.setRequestProperty("String_Node_Str","String_Node_Str");
    uc.setRequestProperty("String_Node_Str",USER_AGENT);
    uc.setRequestProperty("String_Node_Str","String_Node_Str" + encoder.encode(authentication));
    uc.setRequestProperty("String_Node_Str","String_Node_Str");
    doConfiguration(uc);
    outStream=uc.getOutputStream();
    outStream.write(new ObjectMapper().writeValueAsString(resource).getBytes());
    if (huc != null) {
      validateStatusLine(uri,huc.getResponseCode(),huc.getResponseMessage(),new DefaultErrorProvider(huc));
    }
  }
 catch (  final MalformedURLException e) {
    throw new TransportGnipException(e);
  }
catch (  final IOException e) {
    throw new TransportGnipException(e);
  }
 finally {
    try {
      if (outStream != null) {
        outStream.close();
      }
    }
 catch (    final IOException e) {
    }
  }
}

Fixed version (ground truth):
@Override public final void postResource(final URI uri,final Object resource) throws AuthenticationGnipException, TransportGnipException {
  OutputStream outStream=null;
  try {
    final URLConnection uc=uri.toURL().openConnection();
    HttpURLConnection huc=null;
    if (uc instanceof HttpURLConnection) {
      huc=(HttpURLConnection)uc;
    }
    uc.setAllowUserInteraction(false);
    uc.setDefaultUseCaches(false);
    uc.setConnectTimeout(connectTimeout);
    uc.setReadTimeout(readTimeout);
    uc.setDoOutput(true);
    uc.setRequestProperty("String_Node_Str","String_Node_Str");
    uc.setRequestProperty("String_Node_Str",USER_AGENT);
    uc.setRequestProperty("String_Node_Str","String_Node_Str" + encoder.encode(authentication));
    uc.setRequestProperty("String_Node_Str","String_Node_Str");
    doConfiguration(uc);
    outStream=uc.getOutputStream();
    outStream.write(mapper.writeValueAsString(resource).getBytes("String_Node_Str"));
    if (huc != null) {
      validateStatusLine(uri,huc.getResponseCode(),huc.getResponseMessage(),new DefaultErrorProvider(huc));
    }
  }
 catch (  final MalformedURLException e) {
    throw new TransportGnipException(e);
  }
catch (  final IOException e) {
    throw new TransportGnipException(e);
  }
 finally {
    try {
      if (outStream != null) {
        outStream.close();
      }
    }
 catch (    final IOException e) {
    }
  }
}
Program: 152011
Project: 152011
Buggy source:
/** 
 * Re-connects the stream
 */
private void reconnect(){
  try {
    final int attempt=reConnectionAttempt.incrementAndGet();
    logger.debug("String_Node_Str",reConnectionWaitTime);
    reConnectionWaitTime=(long)(reConnectionWaitTime * 1.10);
    reConnectionWaitTime=(reConnectionWaitTime > MAX_RE_CONNECTION_WAIT_TIME) ? MAX_RE_CONNECTION_WAIT_TIME : reConnectionWaitTime;
    try {
      Thread.sleep(reConnectionWaitTime);
    }
 catch (    InterruptedException e) {
      throw new GnipException(e);
    }
    activityService.execute(new Runnable(){
      @Override public void run(){
        getNotification().notifyReConnection(attempt,0L);
      }
    }
);
    logger.debug("String_Node_Str");
    response=handshake();
    logger.debug("String_Node_Str");
    reConnectionAttempt.set(0);
  }
 catch (  final GnipException e) {
    logger.error("String_Node_Str",e);
    activityService.execute(new Runnable(){
      @Override public void run(){
        getNotification().notifyReConnectionError(e);
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * Re-connects the stream
 */
private void reconnect(){
  try {
    final int attempt=reConnectionAttempt.incrementAndGet();
    logger.debug("String_Node_Str",reConnectionWaitTime);
    reConnectionWaitTime=(long)(reConnectionWaitTime * 1.10);
    reConnectionWaitTime=(reConnectionWaitTime > MAX_RE_CONNECTION_WAIT_TIME) ? MAX_RE_CONNECTION_WAIT_TIME : reConnectionWaitTime;
    try {
      Thread.sleep(reConnectionWaitTime);
    }
 catch (    InterruptedException e) {
      throw new GnipException(e);
    }
    activityService.execute(new Runnable(){
      @Override public void run(){
        getNotification().notifyReConnection(attempt,reConnectionWaitTime);
      }
    }
);
    logger.debug("String_Node_Str");
    response=handshake();
    logger.debug("String_Node_Str");
    reConnectionAttempt.set(0);
  }
 catch (  final GnipException e) {
    logger.error("String_Node_Str",e);
    activityService.execute(new Runnable(){
      @Override public void run(){
        getNotification().notifyReConnectionError(e);
      }
    }
);
  }
}