nus-yam/ex-repair huggingface dataset:
Program: 93507
Project: 93507
Buggy source:
/** 
 * @param context
 * @param dbName
 * @param collName
 * @param ids
 * @return
 * @throws org.restheart.hal.UnsupportedDocumentIdException
 */
static public String getUriWithFilterMany(RequestContext context,String dbName,String collName,Object[] ids) throws UnsupportedDocumentIdException {
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str").append(dbName).append("String_Node_Str").append(collName).append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append(getIdsString(ids)).append("String_Node_Str");
  return context.mapUri(sb.toString().replaceAll("String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * @param context
 * @param dbName
 * @param collName
 * @param ids
 * @return
 * @throws org.restheart.hal.UnsupportedDocumentIdException
 */
static public String getUriWithFilterMany(RequestContext context,String dbName,String collName,Object[] ids) throws UnsupportedDocumentIdException {
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str").append(dbName).append("String_Node_Str").append(collName).append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append(getIdsString(ids)).append("String_Node_Str");
  return context.mapUri(sb.toString());
}
Program: 93508
Project: 93508
Buggy source:
private static String getIdString(Object id) throws UnsupportedDocumentIdException {
  if (id == null) {
    return null;
  }
 else {
    return serializer.serialize(id).replace("String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
private static String getIdString(Object id) throws UnsupportedDocumentIdException {
  if (id == null) {
    return null;
  }
 else {
    return JsonUtils.minify(serializer.serialize(id).replace("String_Node_Str","String_Node_Str"));
  }
}
Program: 93510
Project: 93510
Buggy source:
private void addLinkTemplatesAndCuries(final HttpServerExchange exchange,final RequestContext context,final Representation rep,final String requestPath){
  if (context.isParentAccessible()) {
    rep.addLink(new Link("String_Node_Str",URLUtils.getParentPath(requestPath)));
  }
  if (TYPE.FILES_BUCKET.equals(context.getType())) {
    rep.addLink(new Link("String_Node_Str",URLUtils.getParentPath(requestPath) + "String_Node_Str",true));
    rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str",true));
  }
 else   if (TYPE.COLLECTION.equals(context.getType())) {
    rep.addLink(new Link("String_Node_Str",URLUtils.getParentPath(requestPath) + "String_Node_Str",true));
    rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str",true));
  }
  rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str" + context.getDBName()+ "String_Node_Str"+ context.getCollectionName()+ "String_Node_Str"));
  rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str",true));
  rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str",true));
  rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str",true));
  rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str"));
  rep.addLink(new Link("String_Node_Str","String_Node_Str",Configuration.RESTHEART_ONLINE_DOC_URL + "String_Node_Str",true),true);
}

Fixed version (ground truth):
private void addLinkTemplatesAndCuries(final HttpServerExchange exchange,final RequestContext context,final Representation rep,final String requestPath){
  if (context.isParentAccessible()) {
    rep.addLink(new Link("String_Node_Str",URLUtils.getParentPath(requestPath)));
  }
  if (TYPE.FILES_BUCKET.equals(context.getType())) {
    rep.addLink(new Link("String_Node_Str",URLUtils.getParentPath(requestPath) + "String_Node_Str" + RequestContext.FS_FILES_SUFFIX,true));
    rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str",true));
  }
 else   if (TYPE.COLLECTION.equals(context.getType())) {
    rep.addLink(new Link("String_Node_Str",URLUtils.getParentPath(requestPath) + "String_Node_Str",true));
    rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str",true));
  }
  rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str" + context.getDBName()+ "String_Node_Str"+ context.getCollectionName()+ "String_Node_Str"));
  rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str",true));
  rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str",true));
  rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str",true));
  rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str"));
  rep.addLink(new Link("String_Node_Str","String_Node_Str",Configuration.RESTHEART_ONLINE_DOC_URL + "String_Node_Str",true),true);
}
Program: 93511
Project: 93511
Buggy source:
private void addLinkTemplatesAndCuries(final HttpServerExchange exchange,final RequestContext context,final Representation rep,final String requestPath){
  if (context.isParentAccessible()) {
    rep.addLink(new Link("String_Node_Str",URLUtils.getParentPath(requestPath)));
  }
  rep.addLink(new Link("String_Node_Str",URLUtils.getParentPath(requestPath) + "String_Node_Str",true));
  rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str",true));
  rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str",true));
  rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str",true));
  rep.addLink(new Link("String_Node_Str","String_Node_Str",Configuration.RESTHEART_ONLINE_DOC_URL + "String_Node_Str",true),true);
}

Fixed version (ground truth):
private void addLinkTemplatesAndCuries(final HttpServerExchange exchange,final RequestContext context,final Representation rep,final String requestPath){
  if (context.isParentAccessible()) {
    rep.addLink(new Link("String_Node_Str",URLUtils.getParentPath(requestPath)));
  }
  rep.addLink(new Link("String_Node_Str",URLUtils.getParentPath(requestPath) + "String_Node_Str",true));
  rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str",true));
  rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str" + RequestContext.FS_FILES_SUFFIX,true));
  rep.addLink(new Link("String_Node_Str",requestPath + "String_Node_Str",true));
  rep.addLink(new Link("String_Node_Str","String_Node_Str",Configuration.RESTHEART_ONLINE_DOC_URL + "String_Node_Str",true),true);
}
Program: 93514
Project: 93514
Buggy source:
private boolean checkRegex(DBObject json,String path,String regex,boolean optional,boolean nullable,RequestContext context){
  BasicDBObject _json=(BasicDBObject)json;
  List<Optional<Object>> props;
  try {
    props=JsonUtils.getPropsFromPath(_json,path);
  }
 catch (  IllegalArgumentException ex) {
    return false;
  }
  if (props == null) {
    return optional;
  }
  boolean ret;
  Pattern p=Pattern.compile(regex,Pattern.CASE_INSENSITIVE);
  ret=props.stream().allMatch((  Optional<Object> prop) -> {
    if (prop == null) {
      return optional;
    }
    if (prop.isPresent()) {
      return p.matcher(JsonUtils.serialize(prop.get())).find();
    }
 else {
      return nullable;
    }
  }
);
  LOGGER.debug("String_Node_Str",path,regex,props,ret);
  if (ret == false) {
    context.addWarning("String_Node_Str" + path + "String_Node_Str"+ regex+ "String_Node_Str"+ props);
  }
  return ret;
}

Fixed version (ground truth):
private boolean checkRegex(DBObject json,String path,String regex,boolean optional,boolean nullable,RequestContext context){
  BasicDBObject _json=(BasicDBObject)json;
  List<Optional<Object>> props;
  try {
    props=JsonUtils.getPropsFromPath(_json,path);
  }
 catch (  IllegalArgumentException ex) {
    LOGGER.debug("String_Node_Str",path,regex,ex.getMessage());
    context.addWarning("String_Node_Str" + path + "String_Node_Str"+ regex+ "String_Node_Str"+ ex.getMessage());
    return false;
  }
  boolean ret;
  if (props == null) {
    ret=optional;
  }
 else {
    Pattern p=Pattern.compile(regex,Pattern.CASE_INSENSITIVE);
    ret=props.stream().allMatch((    Optional<Object> prop) -> {
      if (prop == null) {
        return optional;
      }
      if (prop.isPresent()) {
        return p.matcher(JsonUtils.serialize(prop.get())).find();
      }
 else {
        return nullable;
      }
    }
);
  }
  LOGGER.debug("String_Node_Str",path,regex,props,ret);
  if (ret == false) {
    context.addWarning("String_Node_Str" + path + "String_Node_Str"+ regex+ "String_Node_Str"+ props);
  }
  return ret;
}
Program: 93516
Project: 93516
Buggy source:
@Override public boolean check(HttpServerExchange exchange,RequestContext context,DBObject args){
  if (args instanceof BasicDBList) {
    boolean patching=context.getMethod() == RequestContext.METHOD.PATCH;
    BasicDBList conditions=filterMissingOptionalAndNullNullableConditions((BasicDBList)args,context.getContent());
    if (patching) {
      DBObject content=context.getContent();
      return !content.keySet().stream().anyMatch(key -> {
        return !applyConditions(conditions,remapJson(key,content.get(key)),context);
      }
);
    }
 else {
      return applyConditions(conditions,context.getContent(),context);
    }
  }
 else {
    context.addWarning("String_Node_Str");
    return true;
  }
}

Fixed version (ground truth):
@Override public boolean check(HttpServerExchange exchange,RequestContext context,DBObject args){
  if (args instanceof BasicDBList) {
    boolean patching=context.getMethod() == RequestContext.METHOD.PATCH;
    if (patching) {
      DBObject content=context.getContent();
      return !content.keySet().stream().anyMatch(key -> {
        DBObject remappedContent=remapJson(key,content.get(key));
        BasicDBList conditions=filterMissingOptionalAndNullNullableConditions((BasicDBList)args,remappedContent,true);
        return !applyConditions(conditions,remappedContent,context);
      }
);
    }
 else {
      BasicDBList conditions=filterMissingOptionalAndNullNullableConditions((BasicDBList)args,context.getContent(),false);
      return applyConditions(conditions,context.getContent(),context);
    }
  }
 else {
    context.addWarning("String_Node_Str");
    return true;
  }
}
Program: 93517
Project: 93517
Buggy source:
/** 
 * @param left the json path expression
 * @param right the json path expression
 * @return true if the left json path is an acestor of the right path, i.e.left path selects a values set that includes the one selected by the right path examples: ($, $.a) -> true, ($.a, $.b) -> false, ($.*, $.a) -> true, ($.a.[*].c, $.a.0.c) -> true, ($.a.[*], $.a.b) -> false
 */
public static boolean isAncestorPath(final String left,final String right){
  if (left == null || !left.startsWith("String_Node_Str")) {
    throw new IllegalArgumentException("String_Node_Str" + left);
  }
  if (right == null || !right.startsWith("String_Node_Str")) {
    throw new IllegalArgumentException("String_Node_Str" + right);
  }
  if (right.startsWith(left)) {
    return true;
  }
 else {
    String leftPathTokens[]=left.split(Pattern.quote("String_Node_Str"));
    String rightPathTokens[]=right.split(Pattern.quote("String_Node_Str"));
    if (leftPathTokens.length > rightPathTokens.length) {
      return false;
    }
    for (int cont=0; cont < leftPathTokens.length; cont++) {
      String lt=leftPathTokens[cont];
      String rt=rightPathTokens[cont];
switch (lt) {
case "String_Node_Str":
        break;
case "String_Node_Str":
      try {
        Integer.parseInt(rt);
        break;
      }
 catch (      NumberFormatException nfe) {
        return false;
      }
default :
    return rt.equals(lt);
}
}
}
return true;
}

Fixed version (ground truth):
/** 
 * @param left the json path expression
 * @param right the json path expression
 * @return true if the left json path is an acestor of the right path, i.e.left path selects a values set that includes the one selected by the right path examples: ($, $.a) -> true, ($.a, $.b) -> false, ($.*, $.a) -> true, ($.a.[*].c, $.a.0.c) -> true, ($.a.[*], $.a.b) -> false
 */
public static boolean isAncestorPath(final String left,final String right){
  if (left == null || !left.startsWith("String_Node_Str")) {
    throw new IllegalArgumentException("String_Node_Str" + left);
  }
  if (right == null || !right.startsWith("String_Node_Str")) {
    throw new IllegalArgumentException("String_Node_Str" + right);
  }
  boolean ret=true;
  if (!right.startsWith(left)) {
    String leftPathTokens[]=left.split(Pattern.quote("String_Node_Str"));
    String rightPathTokens[]=right.split(Pattern.quote("String_Node_Str"));
    if (leftPathTokens.length > rightPathTokens.length) {
      ret=false;
    }
 else {
      outerloop:       for (int cont=0; cont < leftPathTokens.length; cont++) {
        String lt=leftPathTokens[cont];
        String rt=rightPathTokens[cont];
switch (lt) {
case "String_Node_Str":
          break;
case "String_Node_Str":
        try {
          Integer.parseInt(rt);
          break;
        }
 catch (        NumberFormatException nfe) {
          ret=false;
          break outerloop;
        }
default :
      ret=rt.equals(lt);
    if (!ret) {
      break outerloop;
    }
 else {
      break;
    }
}
}
}
}
LOGGER.debug("String_Node_Str",left,right,ret);
return ret;
}
Program: 93518
Project: 93518
Buggy source:
ArrayList<DBObject> getCollectionData(DBCollection coll,int page,int pagesize,Deque<String> sortBy,Deque<String> filters,Deque<String> keys,DBCursorPool.EAGER_CURSOR_ALLOCATION_POLICY eager) throws JSONParseException {
  ArrayList<DBObject> ret=new ArrayList<>();
  int toskip=pagesize * (page - 1);
  DBCursor cursor;
  SkippedDBCursor _cursor=null;
  if (eager != DBCursorPool.EAGER_CURSOR_ALLOCATION_POLICY.NONE) {
    _cursor=DBCursorPool.getInstance().get(new DBCursorPoolEntryKey(coll,sortBy,filters,keys,toskip,0),eager);
  }
  int alreadySkipped;
  if (_cursor == null) {
    cursor=getCollectionDBCursor(coll,sortBy,filters,keys);
    alreadySkipped=0;
  }
 else {
    cursor=_cursor.getCursor();
    alreadySkipped=_cursor.getAlreadySkipped();
  }
  if (toskip - alreadySkipped > 0) {
    cursor.skip(toskip - alreadySkipped);
  }
  while (pagesize > 0 && cursor.hasNext()) {
    ret.add(cursor.next());
    pagesize--;
  }
  ret.forEach(row -> {
    Object etag=row.get("String_Node_Str");
    if (row.get("String_Node_Str") == null && etag != null && etag instanceof ObjectId) {
      row.put("String_Node_Str",Instant.ofEpochSecond(((ObjectId)etag).getTimestamp()).toString());
    }
    Object id=row.get("String_Node_Str");
    if (row.get("String_Node_Str") == null && id != null && id instanceof ObjectId) {
      row.put("String_Node_Str",Instant.ofEpochSecond(((ObjectId)id).getTimestamp()).toString());
    }
  }
);
  return ret;
}

Fixed version (ground truth):
ArrayList<DBObject> getCollectionData(DBCollection coll,int page,int pagesize,Deque<String> sortBy,Deque<String> filters,Deque<String> keys,DBCursorPool.EAGER_CURSOR_ALLOCATION_POLICY eager) throws JSONParseException {
  ArrayList<DBObject> ret=new ArrayList<>();
  int toskip=pagesize * (page - 1);
  DBCursor cursor;
  SkippedDBCursor _cursor=null;
  if (eager != DBCursorPool.EAGER_CURSOR_ALLOCATION_POLICY.NONE) {
    _cursor=DBCursorPool.getInstance().get(new DBCursorPoolEntryKey(coll,sortBy,filters,keys,toskip,0),eager);
  }
  int alreadySkipped;
  if (_cursor == null) {
    cursor=getCollectionDBCursor(coll,sortBy,filters,keys);
    alreadySkipped=0;
  }
 else {
    cursor=_cursor.getCursor();
    alreadySkipped=_cursor.getAlreadySkipped();
  }
  while (toskip > alreadySkipped) {
    cursor.next();
    alreadySkipped++;
  }
  while (pagesize > 0 && cursor.hasNext()) {
    ret.add(cursor.next());
    pagesize--;
  }
  ret.forEach(row -> {
    Object etag=row.get("String_Node_Str");
    if (row.get("String_Node_Str") == null && etag != null && etag instanceof ObjectId) {
      row.put("String_Node_Str",Instant.ofEpochSecond(((ObjectId)etag).getTimestamp()).toString());
    }
    Object id=row.get("String_Node_Str");
    if (row.get("String_Node_Str") == null && id != null && id instanceof ObjectId) {
      row.put("String_Node_Str",Instant.ofEpochSecond(((ObjectId)id).getTimestamp()).toString());
    }
  }
);
  return ret;
}
Program: 93519
Project: 93519
Buggy source:
public synchronized SkippedDBCursor get(DBCursorPoolEntryKey key,EAGER_CURSOR_ALLOCATION_POLICY allocationPolicy){
  if (key.getSkipped() < SKIP_SLICE_LINEAR_WIDTH) {
    LOGGER.trace("String_Node_Str",key.getSkipped(),SKIP_SLICE_LINEAR_WIDTH);
    return null;
  }
  Optional<DBCursorPoolEntryKey> _bestKey=cache.asMap().keySet().stream().filter(cursorsPoolFilterGt(key)).sorted(Comparator.comparingInt(DBCursorPoolEntryKey::getSkipped).reversed()).findFirst();
  SkippedDBCursor ret;
  if (_bestKey.isPresent()) {
    Optional<DBCursor> _dbcur=cache.get(_bestKey.get());
    if (_dbcur != null && _dbcur.isPresent()) {
      ret=new SkippedDBCursor(_dbcur.get(),_bestKey.get().getSkipped());
      cache.invalidate(_bestKey.get());
      LOGGER.debug("String_Node_Str",key.getSkipped(),_bestKey.get().getSkipped());
    }
 else {
      ret=null;
      LOGGER.debug("String_Node_Str",key.getSkipped());
    }
  }
 else {
    ret=null;
    LOGGER.debug("String_Node_Str",key.getSkipped());
  }
  populateCache(key,allocationPolicy);
  return ret;
}

Fixed version (ground truth):
public synchronized SkippedDBCursor get(DBCursorPoolEntryKey key,EAGER_CURSOR_ALLOCATION_POLICY allocationPolicy){
  if (key.getSkipped() < SKIP_SLICE_LINEAR_WIDTH) {
    LOGGER.trace("String_Node_Str",key.getSkipped(),SKIP_SLICE_LINEAR_WIDTH);
    return null;
  }
  Optional<DBCursorPoolEntryKey> _bestKey=cache.asMap().keySet().stream().filter(cursorsPoolFilterGte(key)).sorted(Comparator.comparingInt(DBCursorPoolEntryKey::getSkipped).reversed()).findFirst();
  SkippedDBCursor ret;
  if (_bestKey.isPresent()) {
    Optional<DBCursor> _dbcur=cache.get(_bestKey.get());
    if (_dbcur != null && _dbcur.isPresent()) {
      ret=new SkippedDBCursor(_dbcur.get(),_bestKey.get().getSkipped());
      cache.invalidate(_bestKey.get());
      LOGGER.debug("String_Node_Str",key.getSkipped(),_bestKey.get().getSkipped());
    }
 else {
      ret=null;
      LOGGER.debug("String_Node_Str",key.getSkipped());
    }
  }
 else {
    ret=null;
    LOGGER.debug("String_Node_Str",key.getSkipped());
  }
  populateCache(key,allocationPolicy);
  return ret;
}
Program: 93520
Project: 93520
Buggy source:
@Override public void tranform(final HttpServerExchange exchange,final RequestContext context,DBObject contentToTransform,final DBObject args){
  LOGGER.info("String_Node_Str" + ExchangeAttributes.remoteUser().readAttribute(exchange));
  contentToTransform.put("String_Node_Str",ExchangeAttributes.remoteUser().readAttribute(exchange));
}

Fixed version (ground truth):
@Override public void tranform(final HttpServerExchange exchange,final RequestContext context,DBObject contentToTransform,final DBObject args){
  LOGGER.info("String_Node_Str" + args);
  contentToTransform.putAll(args);
}
Program: 93523
Project: 93523
Buggy source:
@Override void enforceCollRepresentationTransformLogic(HttpServerExchange exchange,RequestContext context) throws InvalidMetadataException, ScriptException {
  List<RepresentationTransformer> dbRts=RepresentationTransformer.getFromJson(context.getCollectionProps());
  RequestContext.TYPE requestType=context.getType();
  for (  RepresentationTransformer rt : dbRts) {
    if (rt.getPhase() == RepresentationTransformer.PHASE.REQUEST) {
      Transformer t=(Transformer)NamedSingletonsFactory.getInstance().get("String_Node_Str",rt.getName());
      if (t == null) {
        throw new IllegalArgumentException("String_Node_Str" + rt.getName() + "String_Node_Str");
      }
      if (rt.getScope() == RepresentationTransformer.SCOPE.THIS && requestType == RequestContext.TYPE.COLLECTION) {
        t.tranform(exchange,context,context.getContent(),rt.getArgs());
      }
 else       if (rt.getScope() == RepresentationTransformer.SCOPE.CHILDREN && requestType == RequestContext.TYPE.DOCUMENT) {
        t.tranform(exchange,context,context.getContent(),rt.getArgs());
      }
    }
  }
}

Fixed version (ground truth):
@Override void enforceCollRepresentationTransformLogic(HttpServerExchange exchange,RequestContext context) throws InvalidMetadataException {
  List<RepresentationTransformer> dbRts=RepresentationTransformer.getFromJson(context.getCollectionProps());
  RequestContext.TYPE requestType=context.getType();
  for (  RepresentationTransformer rt : dbRts) {
    if (rt.getPhase() == RepresentationTransformer.PHASE.REQUEST) {
      Transformer t=(Transformer)NamedSingletonsFactory.getInstance().get("String_Node_Str",rt.getName());
      if (t == null) {
        throw new IllegalArgumentException("String_Node_Str" + rt.getName() + "String_Node_Str");
      }
      if (rt.getScope() == RepresentationTransformer.SCOPE.THIS && requestType == RequestContext.TYPE.COLLECTION) {
        t.tranform(exchange,context,context.getContent(),rt.getArgs());
      }
 else       if (rt.getScope() == RepresentationTransformer.SCOPE.CHILDREN && requestType == RequestContext.TYPE.DOCUMENT) {
        t.tranform(exchange,context,context.getContent(),rt.getArgs());
      }
    }
  }
}
Program: 93524
Project: 93524
Buggy source:
@Override void enforceDbRepresentationTransformLogic(HttpServerExchange exchange,RequestContext context) throws InvalidMetadataException, ScriptException {
  List<RepresentationTransformer> dbRts=RepresentationTransformer.getFromJson(context.getDbProps());
  RequestContext.TYPE requestType=context.getType();
  for (  RepresentationTransformer rt : dbRts) {
    Transformer t=(Transformer)NamedSingletonsFactory.getInstance().get("String_Node_Str",rt.getName());
    if (t == null) {
      throw new IllegalArgumentException("String_Node_Str" + rt.getName() + "String_Node_Str");
    }
    if (rt.getPhase() == RepresentationTransformer.PHASE.REQUEST) {
      if (rt.getScope() == RepresentationTransformer.SCOPE.THIS && requestType == RequestContext.TYPE.DB) {
        t.tranform(exchange,context,context.getContent(),rt.getArgs());
      }
 else       if (rt.getScope() == RepresentationTransformer.SCOPE.CHILDREN && requestType == RequestContext.TYPE.COLLECTION) {
        t.tranform(exchange,context,context.getContent(),rt.getArgs());
      }
    }
  }
}

Fixed version (ground truth):
@Override void enforceDbRepresentationTransformLogic(HttpServerExchange exchange,RequestContext context) throws InvalidMetadataException {
  List<RepresentationTransformer> dbRts=RepresentationTransformer.getFromJson(context.getDbProps());
  RequestContext.TYPE requestType=context.getType();
  for (  RepresentationTransformer rt : dbRts) {
    Transformer t=(Transformer)NamedSingletonsFactory.getInstance().get("String_Node_Str",rt.getName());
    if (t == null) {
      throw new IllegalArgumentException("String_Node_Str" + rt.getName() + "String_Node_Str");
    }
    if (rt.getPhase() == RepresentationTransformer.PHASE.REQUEST) {
      if (rt.getScope() == RepresentationTransformer.SCOPE.THIS && requestType == RequestContext.TYPE.DB) {
        t.tranform(exchange,context,context.getContent(),rt.getArgs());
      }
 else {
        t.tranform(exchange,context,context.getContent(),rt.getArgs());
      }
    }
  }
}
Program: 93526
Project: 93526
Buggy source:
private void setup() throws UnknownHostException {
  if (isInitialized()) {
    List<ServerAddress> servers=new ArrayList<>();
    List<MongoCredential> credentials=new ArrayList<>();
    for (    Map<String,Object> mongoServer : mongoServers) {
      Object mongoHost=mongoServer.get(Configuration.MONGO_HOST_KEY);
      Object mongoPort=mongoServer.get(Configuration.MONGO_PORT_KEY);
      if (mongoHost != null && mongoHost instanceof String && mongoPort != null && mongoPort instanceof Integer) {
        servers.add(new ServerAddress((String)mongoHost,(int)mongoPort));
      }
    }
    if (mongoCredentials != null) {
      mongoCredentials.stream().forEach((mongoCredential) -> {
        Object mongoAuthDb=mongoCredential.get(Configuration.MONGO_AUTH_DB_KEY);
        Object mongoUser=mongoCredential.get(Configuration.MONGO_USER_KEY);
        Object mongoPwd=mongoCredential.get(Configuration.MONGO_PASSWORD_KEY);
        if (mongoAuthDb != null && mongoAuthDb instanceof String && mongoUser != null && mongoUser instanceof String && mongoPwd != null && mongoPwd instanceof String) {
          credentials.add(MongoCredential.createMongoCRCredential((String)mongoUser,(String)mongoAuthDb,((String)mongoPwd).toCharArray()));
        }
      }
);
    }
    MongoClientOptions opts=MongoClientOptions.builder().readPreference(ReadPreference.primaryPreferred()).writeConcern(WriteConcern.ACKNOWLEDGED).build();
    mongoClient=new MongoClient(servers,credentials,opts);
  }
}

Fixed version (ground truth):
private void setup() throws UnknownHostException {
  if (isInitialized()) {
    List<ServerAddress> servers=new ArrayList<>();
    List<MongoCredential> credentials=new ArrayList<>();
    for (    Map<String,Object> mongoServer : mongoServers) {
      Object mongoHost=mongoServer.get(Configuration.MONGO_HOST_KEY);
      Object mongoPort=mongoServer.get(Configuration.MONGO_PORT_KEY);
      if (mongoHost != null && mongoHost instanceof String && mongoPort != null && mongoPort instanceof Integer) {
        servers.add(new ServerAddress((String)mongoHost,(int)mongoPort));
      }
    }
    if (mongoCredentials != null) {
      mongoCredentials.stream().forEach((mongoCredential) -> {
        Object mongoAuthDb=mongoCredential.get(Configuration.MONGO_AUTH_DB_KEY);
        Object mongoUser=mongoCredential.get(Configuration.MONGO_USER_KEY);
        Object mongoPwd=mongoCredential.get(Configuration.MONGO_PASSWORD_KEY);
        if (mongoAuthDb != null && mongoAuthDb instanceof String && mongoUser != null && mongoUser instanceof String && mongoPwd != null && mongoPwd instanceof String) {
          credentials.add(MongoCredential.createCredential((String)mongoUser,(String)mongoAuthDb,((String)mongoPwd).toCharArray()));
        }
      }
);
    }
    MongoClientOptions opts=MongoClientOptions.builder().readPreference(ReadPreference.primaryPreferred()).writeConcern(WriteConcern.ACKNOWLEDGED).build();
    mongoClient=new MongoClient(servers,credentials,opts);
  }
}
Program: 93527
Project: 93527
Buggy source:
private static PipedHttpHandler getSecurityHandlerChain(final PipedHttpHandler next,final IdentityManager identityManager,final AccessManager accessManager,final boolean challenging){
  PipedHttpHandler handler=null;
  if (identityManager != null) {
    final List<AuthenticationMechanism> mechanisms=new ArrayList<>();
    mechanisms.add(new AuthTokenAuthenticationMechanism(RESTHEART_REALM));
    if (challenging) {
      mechanisms.add(new BasicAuthenticationMechanism(RESTHEART_REALM));
    }
 else {
      mechanisms.add(new SilentBasicAuthenticationMechanism(RESTHEART_REALM));
    }
    handler=buildSecurityHandlerChain(next,accessManager,identityManager,mechanisms);
  }
  return handler;
}

Fixed version (ground truth):
private static PipedHttpHandler getSecurityHandlerChain(final PipedHttpHandler next,final IdentityManager identityManager,final AccessManager accessManager,final boolean challenging){
  if (identityManager != null) {
    final List<AuthenticationMechanism> mechanisms=new ArrayList<>();
    mechanisms.add(new AuthTokenAuthenticationMechanism(RESTHEART_REALM));
    if (challenging) {
      mechanisms.add(new BasicAuthenticationMechanism(RESTHEART_REALM));
    }
 else {
      mechanisms.add(new SilentBasicAuthenticationMechanism(RESTHEART_REALM));
    }
    return buildSecurityHandlerChain(next,accessManager,identityManager,mechanisms);
  }
 else {
    return next;
  }
}
Program: 93528
Project: 93528
Buggy source:
private static HttpHandler getSecurityHandlerChain(final IdentityManager identityManager,final AccessManager accessManager){
  HttpHandler handler=null;
  if (identityManager != null) {
    final List<AuthenticationMechanism> mechanisms=new ArrayList<>();
    mechanisms.add(new AuthTokenAuthenticationMechanism(RESTHEART_REALM));
    mechanisms.add(new BasicAuthenticationMechanism(RESTHEART_REALM));
    handler=buildSecurityHandlerChain(accessManager,identityManager,mechanisms);
  }
  return handler;
}

Fixed version (ground truth):
private static PipedHttpHandler getSecurityHandlerChain(final PipedHttpHandler next,final IdentityManager identityManager,final AccessManager accessManager){
  PipedHttpHandler handler=null;
  if (identityManager != null) {
    final List<AuthenticationMechanism> mechanisms=new ArrayList<>();
    mechanisms.add(new AuthTokenAuthenticationMechanism(RESTHEART_REALM));
    mechanisms.add(new BasicAuthenticationMechanism(RESTHEART_REALM));
    handler=buildSecurityHandlerChain(next,accessManager,identityManager,mechanisms);
  }
  return handler;
}
Program: 93529
Project: 93529
Buggy source:
/** 
 * @param next
 * @param identityManager
 * @param accessManager
 */
public ChallengingSecurityHandler(final PipedHttpHandler next,final IdentityManager identityManager,final AccessManager accessManager){
  super(next,getSecurityHandlerChain(identityManager,accessManager));
}

Fixed version (ground truth):
/** 
 * @param next
 * @param identityManager
 * @param accessManager
 */
public ChallengingSecurityHandler(final PipedHttpHandler next,final IdentityManager identityManager,final AccessManager accessManager){
  super(getSecurityHandlerChain(next,identityManager,accessManager));
}
Program: 93533
Project: 93533
Buggy source:
/** 
 * Creates a new instance of OptionsHandler OPTIONS is used in CORS preflight phase and needs to be outside the security zone (i.e. not Authorization header required) It is important that OPTIONS responds to any resource URL, regardless its existance: This is because OPTIONS http://restheart/employees/tofire/andrea shall not give any information
 * @param next
 */
public OptionsHandler(PipedHttpHandler next){
  super(next);
}

Fixed version (ground truth):
/** 
 * Creates a new instance of OptionsHandler OPTIONS is used in CORS preflight phase and needs to be outside the security zone (i.e. not Authorization header required) It is important that OPTIONS responds to any resource URL, regardless its existance: This is because OPTIONS http://restheart.org/employees/tofire/andrea shall not give any information The Access-Control-Allow-Methods header indicates, as part of the response to a preflight request,  which methods can be used during the actual request. 
 * @param next
 */
public OptionsHandler(PipedHttpHandler next){
  super(next);
}
Program: 93535
Project: 93535
Buggy source:
private void injectAccessControlAllowHeaders(HeadersManager headers){
  if (headers.isRequestHeaderSet(ORIGIN)) {
    headers.addResponseHeader(ACCESS_CONTROL_ALLOW_ORIGIN,headers.getRequestHeader(ORIGIN).getFirst());
  }
 else {
    headers.addResponseHeader(ACCESS_CONTROL_ALLOW_ORIGIN,ALL_ORIGINS);
  }
  headers.addResponseHeader(ACCESS_CONTROL_ALLOW_CREDENTIAL,TRUE);
  headers.addResponseHeader(ACCESS_CONTROL_EXPOSE_HEADERS,LOCATION_STRING);
}

Fixed version (ground truth):
private void injectAccessControlAllowHeaders(HeadersManager headers){
  if (headers.isRequestHeaderSet(ORIGIN)) {
    headers.addResponseHeader(ACCESS_CONTROL_ALLOW_ORIGIN,headers.getRequestHeader(ORIGIN).getFirst());
  }
 else {
    headers.addResponseHeader(ACCESS_CONTROL_ALLOW_ORIGIN,ALL_ORIGINS);
  }
  headers.addResponseHeader(ACCESS_CONTROL_ALLOW_CREDENTIAL,TRUE);
  headers.addResponseHeader(ACCESS_CONTROL_EXPOSE_HEADERS,LOCATION_STRING);
  headers.addResponseHeader(ACCESS_CONTROL_EXPOSE_HEADERS,LOCATION_STRING + "String_Node_Str" + AUTH_TOKEN_HEADER.toString()+ "String_Node_Str"+ AUTH_TOKEN_VALID_HEADER.toString()+ "String_Node_Str"+ AUTH_TOKEN_LOCATION_HEADER.toString());
}
Program: 93537
Project: 93537
Buggy source:
protected static HttpHandler buildSecurityHandlerChain(final AccessManager accessManager,final IdentityManager identityManager,final List<AuthenticationMechanism> mechanisms){
  HttpHandler handler=null;
  if (accessManager != null) {
    handler=new AccessManagerHandler(accessManager,new AuthTokenInjecterHandler(null));
  }
  handler=new SecurityInitialHandler(AuthenticationMode.PRO_ACTIVE,identityManager,new AuthenticationMechanismsHandler(new PredicateAuthenticationConstraintHandler(new AuthenticationCallHandler(handler),accessManager),mechanisms));
  return handler;
}

Fixed version (ground truth):
protected static HttpHandler buildSecurityHandlerChain(final AccessManager accessManager,final IdentityManager identityManager,final List<AuthenticationMechanism> mechanisms){
  HttpHandler handler;
  if (accessManager == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  handler=new AuthTokenInjecterHandler(new AccessManagerHandler(accessManager,null));
  handler=new SecurityInitialHandler(AuthenticationMode.PRO_ACTIVE,identityManager,new AuthenticationMechanismsHandler(new PredicateAuthenticationConstraintHandler(new AuthenticationCallHandler(handler),accessManager),mechanisms));
  return handler;
}
Program: 93538
Project: 93538
Buggy source:
/** 
 * @param exchange
 * @param context
 * @throws Exception
 */
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (accessManager.isAllowed(exchange,context)) {
    if (getNext() != null) {
      getNext().handleRequest(exchange,context);
    }
  }
 else {
    ResponseHelper.endExchange(exchange,HttpStatus.SC_UNAUTHORIZED);
  }
}

Fixed version (ground truth):
/** 
 * @param exchange
 * @param context
 * @throws Exception
 */
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (accessManager.isAllowed(exchange,context)) {
    if (getNext() != null) {
      getNext().handleRequest(exchange,context);
    }
  }
 else {
    ResponseHelper.endExchange(exchange,HttpStatus.SC_FORBIDDEN);
  }
}
Program: 93541
Project: 93541
Buggy source:
/** 
 * @param exchange
 * @param context
 * @throws Exception
 */
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  DBObject content=context.getContent();
  if (content == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  if (content instanceof BasicDBList) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  Object id=context.getDocumentId();
  if (content.get("String_Node_Str") == null) {
    content.put("String_Node_Str",id);
  }
 else   if (!content.get("String_Node_Str").equals(id)) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  ObjectId etag=RequestHelper.getWriteEtag(exchange);
  int httpCode=documentDAO.upsertDocument(context.getDBName(),context.getCollectionName(),context.getDocumentId(),content,etag,true);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    sendWarnings(httpCode,exchange,context);
  }
 else {
    exchange.setResponseCode(httpCode);
  }
  exchange.endExchange();
}

Fixed version (ground truth):
/** 
 * @param exchange
 * @param context
 * @throws Exception
 */
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  DBObject content=context.getContent();
  if (content == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  if (content instanceof BasicDBList) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  Object id=context.getDocumentId();
  if (content.get("String_Node_Str") == null) {
    content.put("String_Node_Str",id);
  }
 else   if (!content.get("String_Node_Str").equals(id)) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  ObjectId etag=RequestHelper.getWriteEtag(exchange);
  int httpCode=documentDAO.upsertDocument(context.getDBName(),context.getCollectionName(),context.getDocumentId(),content,etag,true);
  ResponseHelper.injectEtagHeader(exchange,content);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    sendWarnings(httpCode,exchange,context);
  }
 else {
    exchange.setResponseCode(httpCode);
  }
  exchange.endExchange();
}
Program: 93542
Project: 93542
Buggy source:
protected static TYPE selectRequestType(String[] pathTokens){
  TYPE type;
  if (pathTokens.length < 2) {
    type=TYPE.ROOT;
  }
 else   if (pathTokens.length < 3) {
    type=TYPE.DB;
  }
 else   if (pathTokens.length >= 3 && pathTokens[2].endsWith(FS_FILES_SUFFIX)) {
    if (pathTokens.length == 3) {
      type=TYPE.FILES_BUCKET;
    }
 else     if (pathTokens.length == 4 && pathTokens[3].equalsIgnoreCase(_INDEXES)) {
      type=TYPE.COLLECTION_INDEXES;
    }
 else     if (pathTokens.length == 4 && !pathTokens[3].equalsIgnoreCase(_INDEXES)) {
      type=TYPE.FILE;
    }
 else     if (pathTokens.length == 5 && pathTokens[4].equalsIgnoreCase(BINARY_CONTENT)) {
      type=TYPE.FILE;
    }
 else {
      type=TYPE.DOCUMENT;
    }
  }
 else   if (pathTokens.length < 4) {
    type=TYPE.COLLECTION;
  }
 else   if (pathTokens.length == 4 && pathTokens[3].equalsIgnoreCase(_INDEXES)) {
    type=TYPE.COLLECTION_INDEXES;
  }
 else   if (pathTokens.length > 4 && pathTokens[3].equalsIgnoreCase(_INDEXES)) {
    type=TYPE.INDEX;
  }
 else {
    type=TYPE.DOCUMENT;
  }
  return type;
}

Fixed version (ground truth):
protected static TYPE selectRequestType(String[] pathTokens){
  TYPE type;
  if (pathTokens.length < 2) {
    type=TYPE.ROOT;
  }
 else   if (pathTokens.length < 3) {
    type=TYPE.DB;
  }
 else   if (pathTokens.length >= 3 && pathTokens[2].endsWith(FS_FILES_SUFFIX)) {
    if (pathTokens.length == 3) {
      type=TYPE.FILES_BUCKET;
    }
 else     if (pathTokens.length == 4 && pathTokens[3].equalsIgnoreCase(_INDEXES)) {
      type=TYPE.COLLECTION_INDEXES;
    }
 else     if (pathTokens.length == 4 && !pathTokens[3].equalsIgnoreCase(_INDEXES)) {
      type=TYPE.FILE;
    }
 else     if (pathTokens.length > 4 && pathTokens[3].equalsIgnoreCase(_INDEXES)) {
      type=TYPE.INDEX;
    }
 else     if (pathTokens.length > 4 && !pathTokens[3].equalsIgnoreCase(_INDEXES) && !pathTokens[4].equalsIgnoreCase(BINARY_CONTENT)) {
      type=TYPE.FILE;
    }
 else     if (pathTokens.length == 5 && pathTokens[4].equalsIgnoreCase(BINARY_CONTENT)) {
      type=TYPE.FILE;
    }
 else {
      type=TYPE.DOCUMENT;
    }
  }
 else   if (pathTokens.length < 4) {
    type=TYPE.COLLECTION;
  }
 else   if (pathTokens.length == 4 && pathTokens[3].equalsIgnoreCase(_INDEXES)) {
    type=TYPE.COLLECTION_INDEXES;
  }
 else   if (pathTokens.length > 4 && pathTokens[3].equalsIgnoreCase(_INDEXES)) {
    type=TYPE.INDEX;
  }
 else {
    type=TYPE.DOCUMENT;
  }
  return type;
}
Program: 93543
Project: 93543
Buggy source:
@Test public void test_FILE_selectRequestType(){
  System.out.println("String_Node_Str");
  String[] pathTokens="String_Node_Str".split("String_Node_Str");
  assertEquals(RequestContext.TYPE.DOCUMENT,RequestContext.selectRequestType(pathTokens));
  pathTokens="String_Node_Str".split("String_Node_Str");
  assertEquals(RequestContext.TYPE.FILE,RequestContext.selectRequestType(pathTokens));
  pathTokens="String_Node_Str".split("String_Node_Str");
  assertEquals(RequestContext.TYPE.DOCUMENT,RequestContext.selectRequestType(pathTokens));
}

Fixed version (ground truth):
@Test public void test_FILE_selectRequestType(){
  System.out.println("String_Node_Str");
  String[] pathTokens="String_Node_Str".split("String_Node_Str");
  assertEquals(RequestContext.TYPE.FILE,RequestContext.selectRequestType(pathTokens));
  pathTokens="String_Node_Str".split("String_Node_Str");
  assertEquals(RequestContext.TYPE.FILE,RequestContext.selectRequestType(pathTokens));
  pathTokens="String_Node_Str".split("String_Node_Str");
  assertEquals(RequestContext.TYPE.FILE,RequestContext.selectRequestType(pathTokens));
}
Program: 93544
Project: 93544
Buggy source:
@Test public void testCheckCollectionFilesPost(){
  System.out.println("String_Node_Str");
  RequestContext context=createContext("String_Node_Str","String_Node_Str");
  assertEquals(context.getType(),RequestContext.TYPE.FILES_BUCKET);
  assertEquals(context.getMethod(),RequestContext.METHOD.POST);
  assertEquals(false,CollectionPropsInjectorHandler.checkCollection(context));
}

Fixed version (ground truth):
@Test public void testCheckCollectionFilesPost(){
  System.out.println("String_Node_Str");
  RequestContext context=createContext("String_Node_Str","String_Node_Str");
  assertEquals(context.getType(),RequestContext.TYPE.FILES_BUCKET);
  assertEquals(context.getMethod(),RequestContext.METHOD.POST);
  assertEquals(true,CollectionPropsInjectorHandler.checkCollection(context));
}
Program: 93545
Project: 93545
Buggy source:
protected static TYPE selectRequestType(String[] pathTokens){
  TYPE type;
  if (pathTokens.length < 2) {
    type=TYPE.ROOT;
  }
 else   if (pathTokens.length < 3) {
    type=TYPE.DB;
  }
 else   if (pathTokens.length >= 3 && pathTokens[2].endsWith(FS_FILES_SUFFIX)) {
    if (pathTokens.length == 3) {
      type=TYPE.FILES_BUCKET;
    }
 else     if (pathTokens.length == 4 && pathTokens[2].endsWith(FS_FILES_SUFFIX) && pathTokens[3].equalsIgnoreCase(_INDEXES)) {
      type=TYPE.COLLECTION_INDEXES;
    }
 else     if (pathTokens.length == 5 && pathTokens[2].endsWith(FS_FILES_SUFFIX) && pathTokens[4].equalsIgnoreCase(BINARY_CONTENT)) {
      type=TYPE.FILE;
    }
 else {
      type=TYPE.DOCUMENT;
    }
  }
 else   if (pathTokens.length < 4) {
    type=TYPE.COLLECTION;
  }
 else   if (pathTokens.length == 4 && pathTokens[3].equalsIgnoreCase(_INDEXES)) {
    type=TYPE.COLLECTION_INDEXES;
  }
 else   if (pathTokens.length > 4 && pathTokens[3].equalsIgnoreCase(_INDEXES)) {
    type=TYPE.INDEX;
  }
 else {
    type=TYPE.DOCUMENT;
  }
  return type;
}

Fixed version (ground truth):
protected static TYPE selectRequestType(String[] pathTokens){
  TYPE type;
  if (pathTokens.length < 2) {
    type=TYPE.ROOT;
  }
 else   if (pathTokens.length < 3) {
    type=TYPE.DB;
  }
 else   if (pathTokens.length >= 3 && pathTokens[2].endsWith(FS_FILES_SUFFIX)) {
    if (pathTokens.length == 3) {
      type=TYPE.FILES_BUCKET;
    }
 else     if (pathTokens.length == 4 && pathTokens[3].equalsIgnoreCase(_INDEXES)) {
      type=TYPE.COLLECTION_INDEXES;
    }
 else     if (pathTokens.length == 4 && !pathTokens[3].equalsIgnoreCase(_INDEXES)) {
      type=TYPE.FILE;
    }
 else     if (pathTokens.length == 5 && pathTokens[4].equalsIgnoreCase(BINARY_CONTENT)) {
      type=TYPE.FILE;
    }
 else {
      type=TYPE.DOCUMENT;
    }
  }
 else   if (pathTokens.length < 4) {
    type=TYPE.COLLECTION;
  }
 else   if (pathTokens.length == 4 && pathTokens[3].equalsIgnoreCase(_INDEXES)) {
    type=TYPE.COLLECTION_INDEXES;
  }
 else   if (pathTokens.length > 4 && pathTokens[3].equalsIgnoreCase(_INDEXES)) {
    type=TYPE.INDEX;
  }
 else {
    type=TYPE.DOCUMENT;
  }
  return type;
}
Program: 93548
Project: 93548
Buggy source:
@Ignore public void testPostBinaryFileHandler() throws Exception {
  System.out.println("String_Node_Str");
  HttpServerExchange exchange=new HttpServerExchange();
  exchange.setRequestPath("String_Node_Str");
  exchange.setRequestMethod(new HttpString("String_Node_Str"));
  RequestContext context=new RequestContext(exchange,"String_Node_Str","String_Node_Str");
  dispacher.putPipedHttpHandler(RequestContext.TYPE.FILES_BUCKET,RequestContext.METHOD.POST,new PostBinaryFileHandler(null,null));
  dispacher.handleRequest(exchange,context);
  assertEquals(HttpStatus.SC_NOT_IMPLEMENTED,exchange.getResponseCode());
}

Fixed version (ground truth):
@Ignore public void testPostBinaryFileHandler() throws Exception {
  System.out.println("String_Node_Str");
  HttpServerExchange exchange=new HttpServerExchange();
  exchange.setRequestPath("String_Node_Str");
  exchange.setRequestMethod(new HttpString("String_Node_Str"));
  RequestContext context=new RequestContext(exchange,"String_Node_Str","String_Node_Str");
  dispacher.putPipedHttpHandler(RequestContext.TYPE.FILES_BUCKET,RequestContext.METHOD.POST,new PostFileHandler(null,null));
  dispacher.handleRequest(exchange,context);
  assertEquals(HttpStatus.SC_NOT_IMPLEMENTED,exchange.getResponseCode());
}
Program: 93549
Project: 93549
Buggy source:
@Test public void testExtractBucket(){
  System.out.println("String_Node_Str");
  assertEquals("String_Node_Str",GetBinaryFileHandler.extractBucketName("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testExtractBucket(){
  System.out.println("String_Node_Str");
  assertEquals("String_Node_Str",GetFileHandler.extractBucketName("String_Node_Str"));
}
Program: 93551
Project: 93551
Buggy source:
public static void main(final String[] args){
  if (askingForHelp(args)) {
    LOGGER.info("String_Node_Str");
    LOGGER.info("String_Node_Str");
    LOGGER.info("String_Node_Str");
    LOGGER.info("String_Node_Str");
    LOGGER.info("String_Node_Str");
    System.exit(0);
  }
  if (OSChecker.isWindows()) {
    LOGGER.error("String_Node_Str");
    System.exit(-5);
  }
  if (FileUtils.getConfigurationFilePath(args) == null) {
    LOGGER.info("String_Node_Str");
  }
 else {
    LOGGER.info("String_Node_Str",FileUtils.getConfigurationFilePath(args).toString());
  }
  int pid=FileUtils.getPidFromFile(FileUtils.getPidFilePath(FileUtils.getFileAbsoultePathHash(FileUtils.getConfigurationFilePath(args))));
  if (pid < 0) {
    LOGGER.warn("String_Node_Str");
    LOGGER.info("String_Node_Str");
    System.exit(-1);
  }
  CLibrary.LIBC.kill(pid,15);
  LOGGER.info("String_Node_Str",pid);
  Configuration conf;
  try {
    conf=FileUtils.getConfiguration(args,true);
    LOGGER.info("String_Node_Str",conf.getLogFilePath());
  }
 catch (  ConfigurationException ex) {
    LOGGER.warn(ex.getMessage());
  }
}

Fixed version (ground truth):
public static void main(final String[] args){
  LOGGER.info("String_Node_Str");
  if (askingForHelp(args)) {
    LOGGER.info("String_Node_Str");
    LOGGER.info("String_Node_Str");
    LOGGER.info("String_Node_Str");
    LOGGER.info("String_Node_Str");
    LOGGER.info("String_Node_Str");
    System.exit(0);
  }
  if (OSChecker.isWindows()) {
    LOGGER.error("String_Node_Str");
    System.exit(-5);
  }
  if (FileUtils.getConfigurationFilePath(args) == null) {
    LOGGER.info("String_Node_Str");
  }
 else {
    LOGGER.info("String_Node_Str",FileUtils.getConfigurationFilePath(args).toString());
  }
  int pid=FileUtils.getPidFromFile(FileUtils.getPidFilePath(FileUtils.getFileAbsoultePathHash(FileUtils.getConfigurationFilePath(args))));
  if (pid < 0) {
    LOGGER.warn("String_Node_Str");
    LOGGER.info("String_Node_Str");
    System.exit(-1);
  }
  CLibrary.LIBC.kill(pid,15);
  LOGGER.info("String_Node_Str",pid);
  Configuration conf;
  try {
    conf=FileUtils.getConfiguration(args,true);
    LOGGER.info("String_Node_Str",conf.getLogFilePath());
  }
 catch (  ConfigurationException ex) {
    LOGGER.warn(ex.getMessage());
  }
}
Program: 93552
Project: 93552
Buggy source:
public void deleteChunksCollection(Database db,String dbName,String bucketName){
  String chunksCollName=extractBucketName(bucketName).concat("String_Node_Str");
  client.getDB(dbName).getCollection(chunksCollName).drop();
}

Fixed version (ground truth):
@Override public void deleteChunksCollection(Database db,String dbName,String bucketName){
  String chunksCollName=extractBucketName(bucketName).concat("String_Node_Str");
  client.getDB(dbName).getCollection(chunksCollName).drop();
}
Program: 93553
Project: 93553
Buggy source:
private static DB getDatabase() throws UnknownHostException {
  Mongo mongo=new MongoClient();
  DB db=mongo.getDB(DB_NAME);
  return db;
}

Fixed version (ground truth):
private static DB getDatabase() throws UnknownHostException {
  return mongoClient.getDB(dbTmpName);
}