Program: 8116
Project: 8116
Buggy source:
/** 
 * Retrieves the counters as per the   {@link CounterRequest} specification.
 * @param request for counters.
 * @return list of {@link Counter}
 * @throws MetricsServiceException
 * @throws TException raised when thrift related issues.
 */
@Override public List<Counter> getCounters(CounterRequest request) throws MetricsServiceException, TException {
  List<Counter> results=Lists.newArrayList();
  validateArguments(request.getArgument());
  String runIdInclusion=null;
  if (request.getArgument() != null && request.getArgument().isSetRunId()) {
    runIdInclusion=String.format("String_Node_Str",request.getArgument().getRunId());
  }
  StringBuffer sql=new StringBuffer();
  if (request.getName() == null || request.getName().size() == 0) {
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    if (runIdInclusion != null) {
      sql.append("String_Node_Str").append("String_Node_Str").append(runIdInclusion).append("String_Node_Str");
    }
    sql.append("String_Node_Str");
  }
 else {
    Iterable<String> iterator=Iterables.transform(request.getName(),new Function<String,String>(){
      @Override public String apply(      @Nullable String input){
        return "String_Node_Str" + input + "String_Node_Str";
      }
    }
);
    String values=Joiner.on("String_Node_Str").join(iterator);
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    if (runIdInclusion != null) {
      sql.append("String_Node_Str").append("String_Node_Str").append(runIdInclusion).append("String_Node_Str");
    }
    sql.append("String_Node_Str").append(values).append("String_Node_Str").append("String_Node_Str");
    sql.append("String_Node_Str");
  }
  Connection connection=null;
  PreparedStatement stmt=null;
  ResultSet rs=null;
  try {
    connection=getConnection();
    stmt=connection.prepareStatement(sql.toString());
    stmt.setString(1,request.getArgument().getAccountId());
    stmt.setString(2,request.getArgument().getApplicationId());
    stmt.setString(3,request.getArgument().getFlowId());
    rs=stmt.executeQuery();
    while (rs.next()) {
      results.add(new Counter(rs.getString("String_Node_Str"),rs.getString("String_Node_Str"),rs.getFloat("String_Node_Str")));
    }
  }
 catch (  SQLException e) {
    Log.warn("String_Node_Str",e.getMessage());
  }
 finally {
    try {
      if (rs != null) {
        rs.close();
      }
      if (stmt != null) {
        stmt.close();
      }
      if (connection != null) {
        connection.close();
      }
    }
 catch (    SQLException e) {
      Log.warn("String_Node_Str",e.getMessage());
    }
  }
  return results;
}

Fixed version (ground truth):
/** 
 * Retrieves the counters as per the   {@link CounterRequest} specification.
 * @param request for counters.
 * @return list of {@link Counter}
 * @throws MetricsServiceException
 * @throws TException raised when thrift related issues.
 */
@Override public List<Counter> getCounters(CounterRequest request) throws MetricsServiceException, TException {
  List<Counter> results=Lists.newArrayList();
  validateArguments(request.getArgument());
  String runIdInclusion=null;
  if (request.getArgument() != null && request.getArgument().isSetRunId()) {
    runIdInclusion=String.format("String_Node_Str",request.getArgument().getRunId());
  }
  StringBuffer sql=new StringBuffer();
  if (request.getName() == null || request.getName().size() == 0) {
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    if (runIdInclusion != null) {
      sql.append("String_Node_Str").append("String_Node_Str").append(runIdInclusion).append("String_Node_Str");
    }
    sql.append("String_Node_Str");
  }
 else {
    Iterable<String> iterator=Iterables.transform(request.getName(),new Function<String,String>(){
      @Override public String apply(      @Nullable String input){
        return "String_Node_Str" + input + "String_Node_Str";
      }
    }
);
    String values=Joiner.on("String_Node_Str").join(iterator);
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    if (runIdInclusion != null) {
      sql.append("String_Node_Str").append(runIdInclusion).append("String_Node_Str");
    }
    sql.append("String_Node_Str").append("String_Node_Str").append(values).append("String_Node_Str").append("String_Node_Str");
    sql.append("String_Node_Str");
  }
  Connection connection=null;
  PreparedStatement stmt=null;
  ResultSet rs=null;
  try {
    connection=getConnection();
    stmt=connection.prepareStatement(sql.toString());
    stmt.setString(1,request.getArgument().getAccountId());
    stmt.setString(2,request.getArgument().getApplicationId());
    stmt.setString(3,request.getArgument().getFlowId());
    rs=stmt.executeQuery();
    while (rs.next()) {
      results.add(new Counter(rs.getString("String_Node_Str"),rs.getString("String_Node_Str"),rs.getFloat("String_Node_Str")));
    }
  }
 catch (  SQLException e) {
    Log.warn("String_Node_Str",e.getMessage());
  }
 finally {
    try {
      if (rs != null) {
        rs.close();
      }
      if (stmt != null) {
        stmt.close();
      }
      if (connection != null) {
        connection.close();
      }
    }
 catch (    SQLException e) {
      Log.warn("String_Node_Str",e.getMessage());
    }
  }
  return results;
}