nus-yam/ex-repair huggingface dataset:
Program: 12393
Project: 12393
Buggy source:
/** 
 * Saves an object in the database, using HTTP <tt>PUT</tt> request. <p>If the object doesn't have an <code>_id</code> value, the code will assign a <code>UUID</code> as the document id.
 * @param object The object to save
 * @param writeQuorum the write Quorum
 * @throws DocumentConflictException If a conflict is detected during the save.
 * @return {@link Response}
 */
public com.cloudant.client.api.model.Response save(Object object,int writeQuorum){
  Response couchDbResponse=client.put(getDBUri(),object,true,writeQuorum,getGson());
  com.cloudant.client.api.model.Response response=new com.cloudant.client.api.model.Response(couchDbResponse);
  return response;
}

Fixed version (ground truth):
/** 
 * Saves an object in the database, using HTTP <tt>PUT</tt> request. <p>If the object doesn't have an <code>_id</code> value, the code will assign a <code>UUID</code> as the document id.
 * @param object The object to save
 * @param writeQuorum the write Quorum
 * @throws DocumentConflictException If a conflict is detected during the save.
 * @return {@link Response}
 */
public com.cloudant.client.api.model.Response save(Object object,int writeQuorum){
  Response couchDbResponse=client.put(getDBUri(),object,true,writeQuorum,client.getGson());
  com.cloudant.client.api.model.Response response=new com.cloudant.client.api.model.Response(couchDbResponse);
  return response;
}
Program: 12394
Project: 12394
Buggy source:
/** 
 * Updates an object in the database, the object must have the correct <code>_id</code> and <code>_rev</code> values.
 * @param object The object to update
 * @param writeQuorum the write Quorum
 * @throws DocumentConflictException If a conflict is detected during the update.
 * @return {@link Response}
 */
public com.cloudant.client.api.model.Response update(Object object,int writeQuorum){
  Response couchDbResponse=client.put(getDBUri(),object,false,writeQuorum,getGson());
  com.cloudant.client.api.model.Response response=new com.cloudant.client.api.model.Response(couchDbResponse);
  return response;
}

Fixed version (ground truth):
/** 
 * Updates an object in the database, the object must have the correct <code>_id</code> and <code>_rev</code> values.
 * @param object The object to update
 * @param writeQuorum the write Quorum
 * @throws DocumentConflictException If a conflict is detected during the update.
 * @return {@link Response}
 */
public com.cloudant.client.api.model.Response update(Object object,int writeQuorum){
  Response couchDbResponse=client.put(getDBUri(),object,false,writeQuorum,client.getGson());
  com.cloudant.client.api.model.Response response=new com.cloudant.client.api.model.Response(couchDbResponse);
  return response;
}
Program: 12395
Project: 12395
Buggy source:
/** 
 * Set permissions for a user/apiKey on the database
 * @param userNameorApikey
 * @param permissions permissions to grant
 */
public void setPermissions(String userNameorApikey,EnumSet<Permissions> permissions){
  assertNotEmpty(userNameorApikey,"String_Node_Str");
  assertNotEmpty(permissions,"String_Node_Str");
  final JsonArray jsonPermissions=new JsonArray();
  for (  Permissions s : permissions) {
    final JsonPrimitive permission=new JsonPrimitive(s.toString());
    jsonPermissions.add(permission);
  }
  URI uri=buildUri(getDBUri()).path("String_Node_Str").build();
  JsonObject perms=client.get(uri,JsonObject.class);
  JsonElement elem=perms.getAsJsonObject().get("String_Node_Str");
  if (elem == null) {
    perms.addProperty("String_Node_Str","String_Node_Str");
    elem=new JsonObject();
    perms.add("String_Node_Str",elem);
  }
  elem.getAsJsonObject().add(userNameorApikey,jsonPermissions);
  HttpResponse response=null;
  HttpPut put=new HttpPut(buildUri(uri).build());
  setEntity(put,getGson().toJson(perms),"String_Node_Str");
  try {
    response=executeRequest(put);
    String ok=getAsString(response,"String_Node_Str");
    if (!ok.equalsIgnoreCase("String_Node_Str")) {
    }
  }
  finally {
    close(response);
  }
}

Fixed version (ground truth):
/** 
 * Set permissions for a user/apiKey on the database
 * @param userNameorApikey
 * @param permissions permissions to grant
 */
public void setPermissions(String userNameorApikey,EnumSet<Permissions> permissions){
  assertNotEmpty(userNameorApikey,"String_Node_Str");
  assertNotEmpty(permissions,"String_Node_Str");
  final JsonArray jsonPermissions=new JsonArray();
  for (  Permissions s : permissions) {
    final JsonPrimitive permission=new JsonPrimitive(s.toString());
    jsonPermissions.add(permission);
  }
  URI uri=buildUri(getDBUri()).path("String_Node_Str").build();
  JsonObject perms=client.get(uri,JsonObject.class);
  JsonElement elem=perms.getAsJsonObject().get("String_Node_Str");
  if (elem == null) {
    perms.addProperty("String_Node_Str","String_Node_Str");
    elem=new JsonObject();
    perms.add("String_Node_Str",elem);
  }
  elem.getAsJsonObject().add(userNameorApikey,jsonPermissions);
  HttpResponse response=null;
  HttpPut put=new HttpPut(buildUri(uri).build());
  setEntity(put,client.getGson().toJson(perms),"String_Node_Str");
  try {
    response=executeRequest(put);
    String ok=getAsString(response,"String_Node_Str");
    if (!ok.equalsIgnoreCase("String_Node_Str")) {
    }
  }
  finally {
    close(response);
  }
}
Program: 12396
Project: 12396
Buggy source:
/** 
 * Delete an index
 * @param indexName name of the index
 * @param designDocId ID of the design doc
 */
public void deleteIndex(String indexName,String designDocId){
  assertNotEmpty(indexName,"String_Node_Str");
  assertNotEmpty(designDocId,"String_Node_Str");
  URI uri=buildUri(getDBUri()).path("String_Node_Str").path(designDocId).path("String_Node_Str").path(indexName).build();
  HttpResponse response=null;
  try {
    response=client.executeRequest(new HttpDelete(uri));
    getResponse(response,Response.class,getGson());
  }
  finally {
    close(response);
  }
}

Fixed version (ground truth):
/** 
 * Delete an index
 * @param indexName name of the index
 * @param designDocId ID of the design doc
 */
public void deleteIndex(String indexName,String designDocId){
  assertNotEmpty(indexName,"String_Node_Str");
  assertNotEmpty(designDocId,"String_Node_Str");
  URI uri=buildUri(getDBUri()).path("String_Node_Str").path(designDocId).path("String_Node_Str").path(indexName).build();
  HttpResponse response=null;
  try {
    response=client.executeRequest(new HttpDelete(uri));
    getResponse(response,Response.class,client.getGson());
  }
  finally {
    close(response);
  }
}
Program: 12397
Project: 12397
Buggy source:
/** 
 * Saves an object in the database using HTTP <tt>POST</tt> request with specificied write quorum <p>The database will be responsible for generating the document id.
 * @param object The object to save
 * @param writeQuorum the write Quorum
 * @return {@link Response}
 */
public com.cloudant.client.api.model.Response post(Object object,int writeQuorum){
  assertNotEmpty(object,"String_Node_Str");
  HttpResponse response=null;
  try {
    URI uri=buildUri(getDBUri()).query("String_Node_Str",writeQuorum).build();
    response=client.executeRequest(createPost(uri,getGson().toJson(object),"String_Node_Str"));
    Response couchDbResponse=getResponse(response,Response.class,getGson());
    com.cloudant.client.api.model.Response cloudantResponse=new com.cloudant.client.api.model.Response(couchDbResponse);
    return cloudantResponse;
  }
  finally {
    close(response);
  }
}

Fixed version (ground truth):
/** 
 * Saves an object in the database using HTTP <tt>POST</tt> request with specificied write quorum <p>The database will be responsible for generating the document id.
 * @param object The object to save
 * @param writeQuorum the write Quorum
 * @return {@link Response}
 */
public com.cloudant.client.api.model.Response post(Object object,int writeQuorum){
  assertNotEmpty(object,"String_Node_Str");
  HttpResponse response=null;
  try {
    URI uri=buildUri(getDBUri()).query("String_Node_Str",writeQuorum).build();
    response=client.executeRequest(createPost(uri,client.getGson().toJson(object),"String_Node_Str"));
    Response couchDbResponse=getResponse(response,Response.class,client.getGson());
    com.cloudant.client.api.model.Response cloudantResponse=new com.cloudant.client.api.model.Response(couchDbResponse);
    return cloudantResponse;
  }
  finally {
    close(response);
  }
}
Program: 12399
Project: 12399
Buggy source:
/** 
 * Returns the Permissions on the database from the /db/_security document
 * @return Map<String,EnumSet<Permissions>> the map of userNames to their Permissions
 */
public Map<String,EnumSet<Permissions>> getPermissions(){
  HttpResponse resp=null;
  HttpGet get=new HttpGet(buildUri(getDBUri()).path("String_Node_Str").build());
  try {
    resp=client.executeRequest(get);
    return getResponseMap(resp,ownGSON,new TypeToken<Map<String,EnumSet<Permissions>>>(){
    }
.getType());
  }
  finally {
    close(resp);
  }
}

Fixed version (ground truth):
/** 
 * Returns the Permissions on the database from the /db/_security document
 * @return Map<String,EnumSet<Permissions>> the map of userNames to their Permissions
 */
public Map<String,EnumSet<Permissions>> getPermissions(){
  HttpResponse resp=null;
  HttpGet get=new HttpGet(buildUri(getDBUri()).path("String_Node_Str").build());
  try {
    resp=client.executeRequest(get);
    return getResponseMap(resp,client.getGson(),new TypeToken<Map<String,EnumSet<Permissions>>>(){
    }
.getType());
  }
  finally {
    close(resp);
  }
}
Program: 12400
Project: 12400
Buggy source:
/** 
 * Find documents using an index 
 * @param selectorJson JSON object describing criteria used to select documents.Is of the form "selector": { <your data here> }  @see <a href="http://docs.cloudant.com/api/cloudant-query.html#cloudant-query-selectors">selector syntax</a>
 * @param options   {@link FindByIndexOptions query Index options} 
 * @param classOfT The class of Java objects to be returned
 * @return List of classOfT objects
 */
public <T>List<T> findByIndex(String selectorJson,Class<T> classOfT,FindByIndexOptions options){
  assertNotEmpty(selectorJson,"String_Node_Str");
  assertNotEmpty(options,"String_Node_Str");
  URI uri=buildUri(getDBUri()).path("String_Node_Str").build();
  String body=getFindByIndexBody(selectorJson,options);
  InputStream stream=null;
  try {
    stream=getStream(client.executeRequest(createPost(uri,body,"String_Node_Str")));
    Reader reader=new InputStreamReader(stream);
    JsonArray jsonArray=new JsonParser().parse(reader).getAsJsonObject().getAsJsonArray("String_Node_Str");
    List<T> list=new ArrayList<T>();
    for (    JsonElement jsonElem : jsonArray) {
      JsonElement elem=jsonElem.getAsJsonObject();
      T t=ownGSON.fromJson(elem,classOfT);
      list.add(t);
    }
    return list;
  }
  finally {
    close(stream);
  }
}

Fixed version (ground truth):
/** 
 * Find documents using an index 
 * @param selectorJson JSON object describing criteria used to select documents.Is of the form "selector": { <your data here> }  @see <a href="http://docs.cloudant.com/api/cloudant-query.html#cloudant-query-selectors">selector syntax</a>
 * @param options   {@link FindByIndexOptions query Index options} 
 * @param classOfT The class of Java objects to be returned
 * @return List of classOfT objects
 */
public <T>List<T> findByIndex(String selectorJson,Class<T> classOfT,FindByIndexOptions options){
  assertNotEmpty(selectorJson,"String_Node_Str");
  assertNotEmpty(options,"String_Node_Str");
  URI uri=buildUri(getDBUri()).path("String_Node_Str").build();
  String body=getFindByIndexBody(selectorJson,options);
  InputStream stream=null;
  try {
    stream=getStream(client.executeRequest(createPost(uri,body,"String_Node_Str")));
    Reader reader=new InputStreamReader(stream);
    JsonArray jsonArray=new JsonParser().parse(reader).getAsJsonObject().getAsJsonArray("String_Node_Str");
    List<T> list=new ArrayList<T>();
    for (    JsonElement jsonElem : jsonArray) {
      JsonElement elem=jsonElem.getAsJsonObject();
      T t=client.getGson().fromJson(elem,classOfT);
      list.add(t);
    }
    return list;
  }
  finally {
    close(stream);
  }
}
Program: 12401
Project: 12401
Buggy source:
/** 
 * Get info about the shards in the database
 * @return List of shards
 */
public List<Shard> getShards(){
  HttpResponse response=null;
  HttpGet get=new HttpGet(buildUri(db.getDBUri()).path("String_Node_Str").build());
  try {
    response=client.executeRequest(get);
    return getResponseList(response,ownGSON,Shard.class,new TypeToken<List<Shard>>(){
    }
.getType());
  }
  finally {
    close(response);
  }
}

Fixed version (ground truth):
/** 
 * Get info about the shards in the database
 * @return List of shards
 */
public List<Shard> getShards(){
  HttpResponse response=null;
  HttpGet get=new HttpGet(buildUri(db.getDBUri()).path("String_Node_Str").build());
  try {
    response=client.executeRequest(get);
    return getResponseList(response,client.getGson(),Shard.class,new TypeToken<List<Shard>>(){
    }
.getType());
  }
  finally {
    close(response);
  }
}
Program: 12402
Project: 12402
Buggy source:
static Gson getGson(){
  return ownGSON;
}

Fixed version (ground truth):
Gson getGson(){
  return client.getGson();
}
Program: 12403
Project: 12403
Buggy source:
/** 
 * Queries a Search Index and returns grouped results in a map where key of the map is the groupName. In case the query didnt use grouping, an empty map is returned
 * @param < T > Object type T
 * @param query the Lucene query to be passed to the Search index
 * @param classOfT The class of type T
 * @return The result of the grouped search query as a ordered {@code Map<String,T> }
 */
public <T>Map<String,List<T>> queryGroups(String query,Class<T> classOfT){
  InputStream instream=null;
  try {
    Reader reader=new InputStreamReader(instream=queryForStream(query));
    JsonObject json=new JsonParser().parse(reader).getAsJsonObject();
    Map<String,List<T>> result=new LinkedHashMap<String,List<T>>();
    if (json.has("String_Node_Str")) {
      for (      JsonElement e : json.getAsJsonArray("String_Node_Str")) {
        String groupName=e.getAsJsonObject().get("String_Node_Str").getAsString();
        List<T> orows=new ArrayList<T>();
        if (!includeDocs) {
          log.warn("String_Node_Str" + "String_Node_Str");
        }
        for (        JsonElement rows : e.getAsJsonObject().getAsJsonArray("String_Node_Str")) {
          orows.add(JsonToObject(Database.getGson(),rows,"String_Node_Str",classOfT));
        }
        result.put(groupName,orows);
      }
    }
 else {
      log.warn("String_Node_Str");
    }
    return result;
  }
  finally {
    close(instream);
  }
}

Fixed version (ground truth):
/** 
 * Queries a Search Index and returns grouped results in a map where key of the map is the groupName. In case the query didnt use grouping, an empty map is returned
 * @param < T > Object type T
 * @param query the Lucene query to be passed to the Search index
 * @param classOfT The class of type T
 * @return The result of the grouped search query as a ordered {@code Map<String,T> }
 */
public <T>Map<String,List<T>> queryGroups(String query,Class<T> classOfT){
  InputStream instream=null;
  try {
    Reader reader=new InputStreamReader(instream=queryForStream(query));
    JsonObject json=new JsonParser().parse(reader).getAsJsonObject();
    Map<String,List<T>> result=new LinkedHashMap<String,List<T>>();
    if (json.has("String_Node_Str")) {
      for (      JsonElement e : json.getAsJsonArray("String_Node_Str")) {
        String groupName=e.getAsJsonObject().get("String_Node_Str").getAsString();
        List<T> orows=new ArrayList<T>();
        if (!includeDocs) {
          log.warn("String_Node_Str" + "String_Node_Str");
        }
        for (        JsonElement rows : e.getAsJsonObject().getAsJsonArray("String_Node_Str")) {
          orows.add(JsonToObject(db.getGson(),rows,"String_Node_Str",classOfT));
        }
        result.put(groupName,orows);
      }
    }
 else {
      log.warn("String_Node_Str");
    }
    return result;
  }
  finally {
    close(instream);
  }
}
Program: 12404
Project: 12404
Buggy source:
/** 
 * Queries a Search Index and returns ungrouped results. In case the query used grouping, an empty list is returned
 * @param < T > Object type T
 * @param query the Lucene query to be passed to the Search index
 * @param classOfT The class of type T
 * @return The result of the search query as a {@code List<T> }
 */
public <T>List<T> query(String query,Class<T> classOfT){
  InputStream instream=null;
  List<T> result=new ArrayList<T>();
  try {
    Reader reader=new InputStreamReader(instream=queryForStream(query));
    JsonObject json=new JsonParser().parse(reader).getAsJsonObject();
    if (json.has("String_Node_Str")) {
      if (!includeDocs) {
        log.warn("String_Node_Str" + "String_Node_Str");
      }
      for (      JsonElement e : json.getAsJsonArray("String_Node_Str")) {
        result.add(JsonToObject(Database.getGson(),e,"String_Node_Str",classOfT));
      }
    }
 else {
      log.warn("String_Node_Str");
    }
    return result;
  }
  finally {
    close(instream);
  }
}

Fixed version (ground truth):
/** 
 * Queries a Search Index and returns ungrouped results. In case the query used grouping, an empty list is returned
 * @param < T > Object type T
 * @param query the Lucene query to be passed to the Search index
 * @param classOfT The class of type T
 * @return The result of the search query as a {@code List<T> }
 */
public <T>List<T> query(String query,Class<T> classOfT){
  InputStream instream=null;
  List<T> result=new ArrayList<T>();
  try {
    Reader reader=new InputStreamReader(instream=queryForStream(query));
    JsonObject json=new JsonParser().parse(reader).getAsJsonObject();
    if (json.has("String_Node_Str")) {
      if (!includeDocs) {
        log.warn("String_Node_Str" + "String_Node_Str");
      }
      for (      JsonElement e : json.getAsJsonArray("String_Node_Str")) {
        result.add(JsonToObject(db.getGson(),e,"String_Node_Str",classOfT));
      }
    }
 else {
      log.warn("String_Node_Str");
    }
    return result;
  }
  finally {
    close(instream);
  }
}
Program: 12405
Project: 12405
Buggy source:
private <T>List<SearchResult<T>.SearchResultRows> getRows(JsonArray jsonrows,SearchResult<T> sr,Class<T> classOfT){
  List<SearchResult<T>.SearchResultRows> ret=new ArrayList<SearchResult<T>.SearchResultRows>();
  for (  JsonElement e : jsonrows) {
    SearchResult<T>.SearchResultRows row=sr.new SearchResultRows();
    JsonObject oe=e.getAsJsonObject();
    row.setId(oe.get("String_Node_Str").getAsString());
    row.setOrder(JsonToObject(Database.getGson(),e,"String_Node_Str",Object[].class));
    row.setFields(JsonToObject(Database.getGson(),e,"String_Node_Str",classOfT));
    if (includeDocs) {
      row.setDoc(JsonToObject(Database.getGson(),e,"String_Node_Str",classOfT));
    }
    ret.add(row);
  }
  return ret;
}

Fixed version (ground truth):
private <T>List<SearchResult<T>.SearchResultRows> getRows(JsonArray jsonrows,SearchResult<T> sr,Class<T> classOfT){
  List<SearchResult<T>.SearchResultRows> ret=new ArrayList<SearchResult<T>.SearchResultRows>();
  for (  JsonElement e : jsonrows) {
    SearchResult<T>.SearchResultRows row=sr.new SearchResultRows();
    JsonObject oe=e.getAsJsonObject();
    row.setId(oe.get("String_Node_Str").getAsString());
    row.setOrder(JsonToObject(db.getGson(),e,"String_Node_Str",Object[].class));
    row.setFields(JsonToObject(db.getGson(),e,"String_Node_Str",classOfT));
    if (includeDocs) {
      row.setDoc(JsonToObject(db.getGson(),e,"String_Node_Str",classOfT));
    }
    ret.add(row);
  }
  return ret;
}
Program: 12406
Project: 12406
Buggy source:
Changes(CouchDbClientBase dbc){
  this.dbc=dbc;
  this.gson=dbc.getGson();
  this.uriBuilder=URIBuilder.builder(dbc.getDBUri()).path("String_Node_Str");
}

Fixed version (ground truth):
Changes(CouchDbClientBase dbc){
  this.dbc=dbc;
  this.gson=dbc.getGson();
  this.uriBuilder=URIBuilder.buildUri(dbc.getDBUri()).path("String_Node_Str");
}
Program: 12407
Project: 12407
Buggy source:
/** 
 * <p>Requests Change notifications of feed type continuous. <p>Feed notifications are accessed in an <i>iterator</i> style.
 */
public Changes continuousChanges(){
  URI uri=uriBuilder.query("String_Node_Str","String_Node_Str").build();
  httpGet=new HttpGet(uri);
  InputStream in=dbc.get(httpGet);
  InputStreamReader is=new InputStreamReader(in);
  setReader(new BufferedReader(is));
  return this;
}

Fixed version (ground truth):
/** 
 * Requests Change notifications of feed type continuous. <p>Feed notifications are accessed in an <i>iterator</i> style.
 */
public Changes continuousChanges(){
  final URI uri=uriBuilder.query("String_Node_Str","String_Node_Str").build();
  httpGet=new HttpGet(uri);
  final InputStream in=dbc.get(httpGet);
  final InputStreamReader is=new InputStreamReader(in);
  setReader(new BufferedReader(is));
  return this;
}
Program: 12408
Project: 12408
Buggy source:
/** 
 * Requests Change notifications of feed type normal.
 */
public ChangesResult getChanges(){
  URI uri=uriBuilder.query("String_Node_Str","String_Node_Str").build();
  return dbc.get(uri,ChangesResult.class);
}

Fixed version (ground truth):
/** 
 * Requests Change notifications of feed type normal.
 */
public ChangesResult getChanges(){
  final URI uri=uriBuilder.query("String_Node_Str","String_Node_Str").build();
  return dbc.get(uri,ChangesResult.class);
}
Program: 12409
Project: 12409
Buggy source:
/** 
 * @return {@link DefaultHttpClient} instance.
 */
@Override HttpClient createHttpClient(CouchDbProperties props){
  DefaultHttpClient httpclient=null;
  try {
    SchemeRegistry schemeRegistry=createRegistry(props);
    HttpParams params=new BasicHttpParams();
    params.setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET,"String_Node_Str");
    params.setParameter(CoreConnectionPNames.SO_TIMEOUT,props.getSocketTimeout());
    params.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,props.getConnectionTimeout());
    ThreadSafeClientConnManager ccm=new ThreadSafeClientConnManager(params,schemeRegistry);
    httpclient=new DefaultHttpClient(ccm,params);
    if (props.getProxyHost() != null) {
      HttpHost proxy=new HttpHost(props.getProxyHost(),props.getProxyPort());
      httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,proxy);
    }
    if (props.getUsername() != null && props.getPassword() != null) {
      httpclient.getCredentialsProvider().setCredentials(new AuthScope(props.getHost(),props.getPort()),new UsernamePasswordCredentials(props.getUsername(),props.getPassword()));
      props.clearPassword();
    }
    registerInterceptors(httpclient);
  }
 catch (  Exception e) {
    throw new IllegalStateException("String_Node_Str",e);
  }
  return httpclient;
}

Fixed version (ground truth):
/** 
 * @return {@link DefaultHttpClient} instance.
 */
@Override HttpClient createHttpClient(CouchDbProperties props){
  DefaultHttpClient httpclient=null;
  try {
    final SchemeRegistry schemeRegistry=createRegistry(props);
    final HttpParams params=new BasicHttpParams();
    params.setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET,"String_Node_Str");
    params.setParameter(CoreConnectionPNames.SO_TIMEOUT,props.getSocketTimeout());
    params.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,props.getConnectionTimeout());
    final ThreadSafeClientConnManager ccm=new ThreadSafeClientConnManager(params,schemeRegistry);
    httpclient=new DefaultHttpClient(ccm,params);
    if (props.getProxyHost() != null) {
      HttpHost proxy=new HttpHost(props.getProxyHost(),props.getProxyPort());
      httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,proxy);
    }
    if (props.getUsername() != null && props.getPassword() != null) {
      httpclient.getCredentialsProvider().setCredentials(new AuthScope(props.getHost(),props.getPort()),new UsernamePasswordCredentials(props.getUsername(),props.getPassword()));
      props.clearPassword();
    }
    registerInterceptors(httpclient);
  }
 catch (  Exception e) {
    throw new IllegalStateException("String_Node_Str",e);
  }
  return httpclient;
}
Program: 12410
Project: 12410
Buggy source:
/** 
 * Queries a view.
 * @param < K > Object type K (key)
 * @param < V > Object type V (value)
 * @param classOfK The class of type K.
 * @param classOfV The class of type V.
 * @param classOfT The class of type T.
 * @return The View result entries.
 */
public <K,V,T>ViewResult<K,V,T> queryView(Class<K> classOfK,Class<V> classOfV,Class<T> classOfT){
  InputStream instream=null;
  try {
    Reader reader=new InputStreamReader(instream=queryForStream());
    JsonObject json=new JsonParser().parse(reader).getAsJsonObject();
    ViewResult<K,V,T> vr=new ViewResult<K,V,T>();
    vr.setTotalRows(getElementAsLong(json,"String_Node_Str"));
    vr.setOffset(getElementAsInt(json,"String_Node_Str"));
    vr.setUpdateSeq(getElementAsLong(json,"String_Node_Str"));
    JsonArray jsonArray=json.getAsJsonArray("String_Node_Str");
    if (jsonArray.size() == 0) {
      throw new NoDocumentException("String_Node_Str");
    }
    for (    JsonElement e : jsonArray) {
      ViewResult<K,V,T>.Rows row=vr.new Rows();
      row.setId(JsonToObject(gson,e,"String_Node_Str",String.class));
      row.setKey(JsonToObject(gson,e,"String_Node_Str",classOfK));
      row.setValue(JsonToObject(gson,e,"String_Node_Str",classOfV));
      if (includeDocs == Boolean.TRUE) {
        row.setDoc(JsonToObject(gson,e,"String_Node_Str",classOfT));
      }
      vr.getRows().add(row);
    }
    return vr;
  }
  finally {
    close(instream);
  }
}

Fixed version (ground truth):
/** 
 * Queries a view.
 * @param < K > Object type K (key)
 * @param < V > Object type V (value)
 * @param classOfK The class of type K.
 * @param classOfV The class of type V.
 * @param classOfT The class of type T.
 * @return The View result entries.
 */
public <K,V,T>ViewResult<K,V,T> queryView(Class<K> classOfK,Class<V> classOfV,Class<T> classOfT){
  InputStream instream=null;
  try {
    Reader reader=new InputStreamReader(instream=queryForStream());
    JsonObject json=new JsonParser().parse(reader).getAsJsonObject();
    ViewResult<K,V,T> vr=new ViewResult<K,V,T>();
    vr.setTotalRows(getElementAsLong(json,"String_Node_Str"));
    vr.setOffset(getElementAsInt(json,"String_Node_Str"));
    vr.setUpdateSeq(getElementAsLong(json,"String_Node_Str"));
    JsonArray jsonArray=json.getAsJsonArray("String_Node_Str");
    if (jsonArray.size() == 0) {
      throw new NoDocumentException("String_Node_Str");
    }
    for (    JsonElement e : jsonArray) {
      ViewResult<K,V,T>.Rows row=vr.new Rows();
      row.setId(JsonToObject(gson,e,"String_Node_Str",String.class));
      row.setKey(JsonToObject(gson,e,"String_Node_Str",classOfK));
      row.setValue(JsonToObject(gson,e,"String_Node_Str",classOfV));
      if (Boolean.TRUE.equals(this.includeDocs)) {
        row.setDoc(JsonToObject(gson,e,"String_Node_Str",classOfT));
      }
      vr.getRows().add(row);
    }
    return vr;
  }
  finally {
    close(instream);
  }
}
Program: 12411
Project: 12411
Buggy source:
@Override public void add(Payload payload){
  payloadService.add(payload);
}

Fixed version (ground truth):
@Override public void add(Payload payload){
  payload.setStatusId(PayloadStatus.Pending);
  payload.setTotalUsers(0);
  payloadService.add(payload);
}
Program: 12419
Project: 12419
Buggy source:
/** 
 * 添加连接
 * @param productId:   Product Id
 * @param token
 * @param conn
 */
public static boolean add(String productId,String token,Connection conn){
  Integer cid=ClientKeeper.get(productId,token);
  if (cid != null) {
    Connection c=pools.remove(cid);
    if (c != null) {
      ServerMetrics.decrConnection();
    }
  }
  cid=conn.getContext().hashCode();
  ClientKeeper.add(productId,token,cid);
  pools.put(cid,conn);
  ServerMetrics.incrConnection();
  return true;
}

Fixed version (ground truth):
/** 
 * 添加连接
 * @param productId:   Product Id
 * @param token
 * @param conn
 */
public static boolean add(String productId,String token,Connection conn){
  Integer cid=ClientKeeper.get(productId,token);
  if (cid != null) {
    Connection c=pools.remove(cid);
    if (c != null) {
      ServerMetrics.decrConnection();
    }
  }
  cid=conn.getContext().channel().hashCode();
  ClientKeeper.add(productId,token,cid);
  pools.put(cid,conn);
  ServerMetrics.incrConnection();
  return true;
}
Program: 12420
Project: 12420
Buggy source:
/** 
 * Rigourous Test :-)
 */
public void testApp(){
  assertTrue(true);
}

Fixed version (ground truth):
/** 
 * Rigourous Test :-)
 */
public void testApp(){
  print(intToBytes(50));
  System.out.println(toInt(intToBytes(50)));
  print(intToBytes(127));
  System.out.println(toInt(intToBytes(127)));
  print(intToBytes(128));
  System.out.println(toInt(intToBytes(128)));
  print(intToBytes(200));
  System.out.println(toInt(intToBytes(200)));
}
Program: 12423
Project: 12423
Buggy source:
protected ThreadPoolTaskExecutor createPool(){
  int min=Integer.parseInt(this.conf.getProperty(DISPATCHER_THREAD_MIN,"String_Node_Str"));
  int max=Integer.parseInt(this.conf.getProperty(DISPATCHER_THREAD_MAX,"String_Node_Str"));
  ThreadPoolTaskExecutor exe=new ThreadPoolTaskExecutor();
  exe.setCorePoolSize(min);
  exe.setMaxPoolSize(max);
  exe.setWaitForTasksToCompleteOnShutdown(true);
  exe.afterPropertiesSet();
  return exe;
}

Fixed version (ground truth):
protected ThreadPoolTaskExecutor createPool(){
  int min=Integer.parseInt(this.conf.getProperty(DISPATCHER_THREAD_MIN,"String_Node_Str"));
  int max=Integer.parseInt(this.conf.getProperty(DISPATCHER_THREAD_MAX,"String_Node_Str"));
  ThreadPoolTaskExecutor exe=new ThreadPoolTaskExecutor();
  exe.setCorePoolSize(min);
  exe.setMaxPoolSize(max);
  exe.setWaitForTasksToCompleteOnShutdown(true);
  exe.setThreadGroupName("String_Node_Str" + product.getId() + "String_Node_Str");
  exe.afterPropertiesSet();
  return exe;
}
Program: 12424
Project: 12424
Buggy source:
@Override public Integer call() throws Exception {
  List<Long> ids=PayloadServiceImpl.instance.findLatestToOfflineClients(product.getId(),userId,0);
  logger.info("String_Node_Str",userId,product,ids.size());
  if (ids == null || ids.size() == 0) {
    return 0;
  }
  List<Payload> list=PayloadServiceImpl.instance.getSimpleList(ids);
  for (  Payload message : list) {
    this.doSendMessage(message);
  }
  return 0;
}

Fixed version (ground truth):
@Override public Integer call() throws Exception {
  List<Long> ids=PayloadServiceImpl.instance.findLatestToOfflineClients(product.getId(),userId,0);
  logger.info("String_Node_Str",userId,product,ids.size());
  if (ids == null || ids.size() == 0) {
    return 0;
  }
  List<Payload> list=PayloadServiceImpl.instance.getSimpleList(ids);
  for (  Payload message : list) {
    this.doSendMessage(message);
  }
  return list.size();
}
Program: 12425
Project: 12425
Buggy source:
private Integer doSendMessage(Payload message){
  if (message != null) {
    SentProgress progress=new SentProgress(1);
    Connection c=ConnectionKeeper.get(product.getAppKey(),this.userId);
    if (c != null) {
      c.send(message);
    }
 else {
      progress.incrFailed();
    }
    try {
      progress.getCountDownLatch().await();
    }
 catch (    InterruptedException e) {
      logger.error(e.getMessage(),e);
    }
    int total=progress.getSuccess().get();
    if (total > 0) {
      try {
        message.setClients(new ArrayList<String>());
        message.getClients().add(this.userId);
        PayloadServiceImpl.instance.updateSendStatus(message);
      }
 catch (      Exception e) {
        logger.error(e.getMessage(),e);
      }
    }
    return total;
  }
  return 0;
}

Fixed version (ground truth):
private Integer doSendMessage(Payload message){
  if (message != null) {
    Connection c=ConnectionKeeper.get(product.getAppKey(),this.userId);
    if (c != null) {
      c.send(message);
      return 1;
    }
  }
  return 0;
}
Program: 12426
Project: 12426
Buggy source:
/** 
 * 添加连接
 * @param productId:   Product Id
 * @param token
 * @param conn
 */
public static boolean add(String productId,String token,Connection conn){
  Integer cid=ClientKeeper.get(productId,token);
  if (cid != null) {
    Connection c=pools.remove(cid);
    if (c != null) {
      c.close();
      ServerMetrics.decrConnection();
    }
  }
  cid=conn.getChannel().hashCode();
  ClientKeeper.add(productId,token,cid);
  pools.put(cid,conn);
  ServerMetrics.incrConnection();
  return true;
}

Fixed version (ground truth):
/** 
 * 添加连接
 * @param productId:   Product Id
 * @param token
 * @param conn
 */
public static boolean add(String productId,String token,Connection conn){
  Integer cid=ClientKeeper.get(productId,token);
  if (cid != null) {
    Connection c=pools.remove(cid);
    if (c != null) {
      ServerMetrics.decrConnection();
    }
  }
  cid=conn.getChannel().hashCode();
  ClientKeeper.add(productId,token,cid);
  pools.put(cid,conn);
  ServerMetrics.incrConnection();
  return true;
}
Program: 12427
Project: 12427
Buggy source:
private void ack(final ChannelHandlerContext ctx,PBAPNSEvent cc,final String result){
  PBAPNSMessage.Builder builder=PBAPNSMessage.newBuilder();
  builder.setAps(PBAPNSBody.newBuilder().setAlert("String_Node_Str").setBadge(0));
  PBAPNSUserInfo.Builder infoBuilder=PBAPNSUserInfo.newBuilder().setKey("String_Node_Str").setValue(result);
  builder.addUserInfo(infoBuilder);
  infoBuilder=PBAPNSUserInfo.newBuilder().setKey("String_Node_Str").setValue(SYNC);
  builder.addUserInfo(infoBuilder);
  byte[] bytes=builder.build().toByteArray();
  final ByteBuf data=ctx.alloc().buffer(bytes.length);
  data.writeBytes(bytes);
  final ChannelFuture cf=ctx.channel().writeAndFlush(data);
  cf.addListener(new GenericFutureListener<Future<? super Void>>(){
    @Override public void operationComplete(    Future<? super Void> future) throws Exception {
      if (cf.cause() != null) {
        logger.error("String_Node_Str",cf.cause());
        ctx.close();
      }
 else {
        if (result.equalsIgnoreCase(MULTI_CLIENTS)) {
          ctx.close();
        }
      }
    }
  }
);
}

Fixed version (ground truth):
private void ack(final ChannelHandlerContext ctx,final Connection cc,PBAPNSEvent event,final String result){
  PBAPNSMessage.Builder builder=PBAPNSMessage.newBuilder();
  builder.setAps(PBAPNSBody.newBuilder().setAlert("String_Node_Str").setBadge(0));
  PBAPNSUserInfo.Builder infoBuilder=PBAPNSUserInfo.newBuilder().setKey("String_Node_Str").setValue(result);
  builder.addUserInfo(infoBuilder);
  infoBuilder=PBAPNSUserInfo.newBuilder().setKey("String_Node_Str").setValue(SYNC);
  builder.addUserInfo(infoBuilder);
  byte[] bytes=builder.build().toByteArray();
  final ByteBuf data=ctx.alloc().buffer(bytes.length);
  data.writeBytes(bytes);
  final ChannelFuture cf=cc.getChannel().writeAndFlush(data);
  cf.addListener(new GenericFutureListener<Future<? super Void>>(){
    @Override public void operationComplete(    Future<? super Void> future) throws Exception {
      if (cf.cause() != null) {
        logger.error("String_Node_Str",cf.cause());
        cc.close();
      }
 else {
        if (result.equalsIgnoreCase(MULTI_CLIENTS)) {
          cc.close();
        }
      }
    }
  }
);
}
Program: 12428
Project: 12428
Buggy source:
@Override public void operationComplete(Future<? super Void> future) throws Exception {
  if (cf.cause() != null) {
    logger.error("String_Node_Str",cf.cause());
    ctx.close();
  }
 else {
    if (result.equalsIgnoreCase(MULTI_CLIENTS)) {
      ctx.close();
    }
  }
}

Fixed version (ground truth):
@Override public void operationComplete(Future<? super Void> future) throws Exception {
  if (cf.cause() != null) {
    logger.error("String_Node_Str",cf.cause());
    cc.close();
  }
 else {
    if (result.equalsIgnoreCase(MULTI_CLIENTS)) {
      cc.close();
    }
  }
}
Program: 12430
Project: 12430
Buggy source:
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  ctx.fireChannelInactive();
  System.out.println("String_Node_Str" + ctx.channel());
  ClientProxyDelegate.instance.remove(ctx.channel());
  reconnect();
}

Fixed version (ground truth):
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  ctx.fireChannelInactive();
  logger.error("String_Node_Str" + ctx.channel());
  ClientProxyDelegate.instance.remove(ctx.channel());
  reconnect();
}
Program: 12431
Project: 12431
Buggy source:
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception {
  System.out.println("String_Node_Str" + ctx.channel());
  ClientProxyDelegate.instance.save(ctx.channel());
}

Fixed version (ground truth):
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception {
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + ctx.channel());
  }
  ClientProxyDelegate.instance.save(ctx.channel());
}
Program: 12432
Project: 12432
Buggy source:
@Override public void channelRead(ChannelHandlerContext ctx,Object msg){
  String jsonString=new String((byte[])msg);
  System.out.println("String_Node_Str" + ctx.channel() + "String_Node_Str"+ jsonString);
  ctx.fireChannelRead(msg);
}

Fixed version (ground truth):
@Override public void channelRead(ChannelHandlerContext ctx,Object msg){
  String jsonString=new String((byte[])msg);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + ctx.channel() + "String_Node_Str"+ jsonString);
  }
  ctx.fireChannelRead(msg);
}
Program: 12433
Project: 12433
Buggy source:
public void get(final ChannelAvaliable task){
  Channel c=channelList.pollFirst();
  if (c == null) {
    final ChannelFuture f=newChannel();
    if (f == null) {
      return;
    }
    f.addListener(new GenericFutureListener<Future<? super java.lang.Void>>(){
      @Override public void operationComplete(      Future<? super Void> future) throws Exception {
        if (future.cause() == null) {
          final Channel c0=f.channel();
          task.execute(c0);
        }
 else {
          future.cause().printStackTrace();
        }
      }
    }
);
  }
 else {
    task.execute(c);
    channelList.add(c);
  }
}

Fixed version (ground truth):
public void get(final ChannelAvaliable task){
  Channel c=channelList.pollFirst();
  if (c == null) {
    final ChannelFuture f=newChannel();
    if (f == null) {
      return;
    }
    f.addListener(new GenericFutureListener<Future<? super java.lang.Void>>(){
      @Override public void operationComplete(      Future<? super Void> future) throws Exception {
        if (future.cause() == null) {
          final Channel c0=f.channel();
          task.execute(c0);
        }
 else {
          logger.error("String_Node_Str",f.cause());
        }
      }
    }
);
  }
 else {
    task.execute(c);
    channelList.add(c);
  }
}
Program: 12434
Project: 12434
Buggy source:
public ChannelFuture newChannel(){
  ChannelFuture f=b.connect(host,port);
  if (f.cause() != null) {
    f.cause().printStackTrace();
    return null;
  }
  return f;
}

Fixed version (ground truth):
public ChannelFuture newChannel(){
  ChannelFuture f=b.connect(host,port);
  if (f.cause() != null) {
    logger.error("String_Node_Str",f.cause());
    return null;
  }
  return f;
}
Program: 12435
Project: 12435
Buggy source:
@Override public void operationComplete(Future<? super Void> future) throws Exception {
  if (future.cause() == null) {
    final Channel c0=f.channel();
    task.execute(c0);
  }
 else {
    future.cause().printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void operationComplete(Future<? super Void> future) throws Exception {
  if (future.cause() == null) {
    final Channel c0=f.channel();
    task.execute(c0);
  }
 else {
    logger.error("String_Node_Str",f.cause());
  }
}
Program: 12437
Project: 12437
Buggy source:
public void send(final SentProgress progress,final Payload message,final byte[] msg){
  try {
    final ByteBuf data=channel.config().getAllocator().buffer(msg.length);
    data.writeBytes(msg);
    final ChannelFuture cf=channel.writeAndFlush(data);
    cf.addListener(new GenericFutureListener<Future<? super Void>>(){
      @Override public void operationComplete(      Future<? super Void> future) throws Exception {
        if (cf.cause() != null) {
          logger.error("String_Node_Str",channel,cf.cause());
          progress.incrFailed();
          message.addFailedClient(userId,new PushError(PushError.UnKnown,cf.cause().getMessage()));
        }
 else {
          progress.incrSuccess();
          if (logger.isDebugEnabled()) {
            logger.debug("String_Node_Str",channel,channel.hashCode());
          }
        }
      }
    }
);
  }
 catch (  Exception e) {
    progress.incrFailed();
    message.addFailedClient(userId,new PushError(PushError.UnKnown,e.getMessage()));
    logger.error(e.getMessage(),e);
  }
}

Fixed version (ground truth):
public void send(final SentProgress progress,final Payload message,final byte[] msg){
  try {
    final ByteBuf data=channel.config().getAllocator().buffer(msg.length);
    data.writeBytes(msg);
    final ChannelFuture cf=channel.writeAndFlush(data);
    cf.addListener(new GenericFutureListener<Future<? super Void>>(){
      @Override public void operationComplete(      Future<? super Void> future) throws Exception {
        if (cf.cause() != null) {
          logger.error("String_Node_Str",channel,cf.cause());
          progress.incrFailed();
          message.addFailedClient(userId,new PushError(PushError.WriterError,cf.cause().getMessage()));
        }
 else {
          progress.incrSuccess();
          if (logger.isDebugEnabled()) {
            logger.debug("String_Node_Str",channel,channel.hashCode());
          }
        }
      }
    }
);
  }
 catch (  Exception e) {
    progress.incrFailed();
    message.addFailedClient(userId,new PushError(PushError.UnKnown,e.getMessage()));
    logger.error(e.getMessage(),e);
  }
}
Program: 12438
Project: 12438
Buggy source:
@Override public void operationComplete(Future<? super Void> future) throws Exception {
  if (cf.cause() != null) {
    logger.error("String_Node_Str",channel,cf.cause());
    progress.incrFailed();
    message.addFailedClient(userId,new PushError(PushError.UnKnown,cf.cause().getMessage()));
  }
 else {
    progress.incrSuccess();
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str",channel,channel.hashCode());
    }
  }
}

Fixed version (ground truth):
@Override public void operationComplete(Future<? super Void> future) throws Exception {
  if (cf.cause() != null) {
    logger.error("String_Node_Str",channel,cf.cause());
    progress.incrFailed();
    message.addFailedClient(userId,new PushError(PushError.WriterError,cf.cause().getMessage()));
  }
 else {
    progress.incrSuccess();
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str",channel,channel.hashCode());
    }
  }
}
Program: 12440
Project: 12440
Buggy source:
@Override @TxMain public void add(final Client client){
  if (client == null) {
    return;
  }
  final String sql="String_Node_Str";
  KeyHolder holder=new GeneratedKeyHolder();
  this.mainJdbc.update(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    Connection connection) throws SQLException {
      PreparedStatement ps=connection.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
      ps.setObject(1,client.getProductId());
      ps.setObject(2,client.getUserId());
      ps.setObject(3,client.getDeviceToken());
      ps.setObject(4,new Date());
      ps.setObject(5,ClientStatus.NewlyAdd);
      ps.setObject(6,client.getTypeId());
      return ps;
    }
  }
,holder);
  client.setId(holder.getKey().longValue());
}

Fixed version (ground truth):
@Override @TxMain public void add(final Client client){
  if (client == null) {
    return;
  }
  final String sql="String_Node_Str";
  KeyHolder holder=new GeneratedKeyHolder();
  this.mainJdbc.update(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    Connection connection) throws SQLException {
      PreparedStatement ps=connection.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
      ps.setObject(1,client.getProductId());
      ps.setObject(2,client.getUserId());
      ps.setObject(3,client.getDeviceToken());
      ps.setObject(4,new Date());
      ps.setObject(5,ClientStatus.Online);
      ps.setObject(6,client.getTypeId());
      return ps;
    }
  }
,holder);
  client.setId(holder.getKey().longValue());
}
Program: 12441
Project: 12441
Buggy source:
@Override public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
  PreparedStatement ps=connection.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
  ps.setObject(1,client.getProductId());
  ps.setObject(2,client.getUserId());
  ps.setObject(3,client.getDeviceToken());
  ps.setObject(4,new Date());
  ps.setObject(5,ClientStatus.NewlyAdd);
  ps.setObject(6,client.getTypeId());
  return ps;
}

Fixed version (ground truth):
@Override public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
  PreparedStatement ps=connection.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
  ps.setObject(1,client.getProductId());
  ps.setObject(2,client.getUserId());
  ps.setObject(3,client.getDeviceToken());
  ps.setObject(4,new Date());
  ps.setObject(5,ClientStatus.Online);
  ps.setObject(6,client.getTypeId());
  return ps;
}
Program: 12442
Project: 12442
Buggy source:
@Override @TxMain public void updateOnlineTs(long id){
  String sql="String_Node_Str";
  this.mainJdbc.update(sql,new Date().getTime() / 1000,id);
}

Fixed version (ground truth):
@Override @TxMain public void updateOnlineTs(long id){
  String sql="String_Node_Str";
  this.mainJdbc.update(sql,new Date().getTime() / 1000,ClientStatus.Online,id);
}
Program: 12443
Project: 12443
Buggy source:
@Override @TxMain public void updateSendStatus(final Payload message,final int counting){
  jdbcExecutor.submit(new Runnable(){
    @Override public void run(){
      String sql="String_Node_Str";
      mainJdbc.update(sql,counting > 0 ? PayloadStatus.Sent : PayloadStatus.Pending,counting,new Date().getTime() / 1000,message.getId());
      sql="String_Node_Str";
      mainJdbc.update(sql,counting > 0 ? PayloadStatus.Sent : PayloadStatus.Pending,message.getId());
      MetricBuilder.jdbcUpdateMeter.mark(2);
      updatePendingCount(false);
    }
  }
);
  updatePendingCount(true);
}

Fixed version (ground truth):
@Override @TxMain public void updateSendStatus(final Payload message,final int counting){
  jdbcExecutor.submit(new Runnable(){
    @Override public void run(){
      String sql="String_Node_Str";
      mainJdbc.update(sql,counting > 0 ? PayloadStatus.Sent : PayloadStatus.Pending,counting,new Date().getTime() / 1000,message.getId());
      sql="String_Node_Str";
      List<Object[]> args=Lists.newArrayList();
      Set<String> cc=message.getFailedClients();
      for (      String userId : message.getClients()) {
        int statusId=cc.contains(userId) ? 0 : 1;
        args.add(new Object[]{statusId,new Date().getTime() / 1000,message.getId(),userId});
      }
      mainJdbc.batchUpdate(sql,args);
      MetricBuilder.jdbcUpdateMeter.mark(2);
      updatePendingCount(false);
    }
  }
);
  updatePendingCount(true);
}