nus-yam/ex-repair huggingface dataset:
Program: 93603
Project: 93603
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (context.getDBName() != null) {
    DBObject dbProps;
    if (!cacheEnabled) {
      dbProps=DBDAO.getDbProps(context.getDBName());
      if (dbProps != null)       dbProps.put("String_Node_Str",false);
    }
 else {
      LoadingCache<String,Optional<DBObject>> dbPropsCache=LocalCachesSingleton.getInstance().getDbCache();
      Optional<DBObject> _dbMetadata=dbPropsCache.getIfPresent(context.getDBName());
      if (_dbMetadata != null) {
        if (_dbMetadata.isPresent()) {
          dbProps=_dbMetadata.get();
          dbProps.put("String_Node_Str",true);
        }
 else         dbProps=null;
      }
 else {
        try {
          _dbMetadata=dbPropsCache.getUnchecked(context.getDBName());
        }
 catch (        UncheckedExecutionException uex) {
          if (uex.getCause() instanceof MongoException) {
            throw (MongoException)uex.getCause();
          }
 else {
            throw uex;
          }
        }
        if (_dbMetadata != null && _dbMetadata.isPresent()) {
          dbProps=_dbMetadata.get();
          dbProps.put("String_Node_Str",false);
        }
 else         dbProps=null;
      }
    }
    context.setDbProps(dbProps);
  }
  next.handleRequest(exchange,context);
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (context.getDBName() != null) {
    DBObject dbProps;
    if (!cacheEnabled) {
      dbProps=DBDAO.getDbProps(context.getDBName());
      if (dbProps != null)       dbProps.put("String_Node_Str",false);
 else {
        ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_FOUND,"String_Node_Str" + context.getDBName() + "String_Node_Str");
        return;
      }
    }
 else {
      LoadingCache<String,Optional<DBObject>> dbPropsCache=LocalCachesSingleton.getInstance().getDbCache();
      Optional<DBObject> _dbMetadata=dbPropsCache.getIfPresent(context.getDBName());
      if (_dbMetadata != null) {
        if (_dbMetadata.isPresent()) {
          dbProps=_dbMetadata.get();
          dbProps.put("String_Node_Str",true);
        }
 else         dbProps=null;
      }
 else {
        try {
          _dbMetadata=dbPropsCache.getUnchecked(context.getDBName());
        }
 catch (        UncheckedExecutionException uex) {
          if (uex.getCause() instanceof MongoException) {
            throw (MongoException)uex.getCause();
          }
 else {
            throw uex;
          }
        }
        if (_dbMetadata != null && _dbMetadata.isPresent()) {
          dbProps=_dbMetadata.get();
          dbProps.put("String_Node_Str",false);
        }
 else         dbProps=null;
      }
    }
    if (dbProps == null) {
      ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_FOUND,"String_Node_Str" + context.getDBName() + "String_Node_Str");
      return;
    }
    context.setDbProps(dbProps);
  }
  next.handleRequest(exchange,context);
}
Program: 93604
Project: 93604
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  List<String> _dbs=client.getDatabaseNames();
  List<String> dbs=_dbs.stream().filter(db -> !RequestContext.isReservedResourceDb(db)).collect(Collectors.toList());
  if (dbs == null) {
    dbs=new ArrayList<>();
  }
  int size=dbs.size();
  Collections.sort(dbs);
  dbs=dbs.subList((context.getPage() - 1) * context.getPagesize(),(context.getPage() - 1) * context.getPagesize() + context.getPagesize() > dbs.size() ? dbs.size() : (context.getPage() - 1) * context.getPagesize() + context.getPagesize());
  List<DBObject> data=new ArrayList<>();
  dbs.stream().map((db) -> {
    DBObject props=DBDAO.getDbProps(db);
    BasicDBObject _db=new BasicDBObject("String_Node_Str",db);
    if (props != null)     _db.putAll((DBObject)props);
    return _db;
  }
).forEach((item) -> {
    data.add(item);
  }
);
  exchange.setResponseCode(HttpStatus.SC_OK);
  RootRepresentationFactory.sendHal(exchange,context,data,size);
  exchange.endExchange();
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  List<String> _dbs=client.getDatabaseNames();
  List<String> dbs=_dbs.stream().filter(db -> !RequestContext.isReservedResourceDb(db)).collect(Collectors.toList());
  if (dbs == null) {
    dbs=new ArrayList<>();
  }
  int size=dbs.size();
  Collections.sort(dbs);
  dbs=dbs.subList((context.getPage() - 1) * context.getPagesize(),(context.getPage() - 1) * context.getPagesize() + context.getPagesize() > dbs.size() ? dbs.size() : (context.getPage() - 1) * context.getPagesize() + context.getPagesize());
  List<DBObject> data=new ArrayList<>();
  dbs.stream().map((db) -> {
    return DBDAO.getDbProps(db);
  }
).forEach((item) -> {
    data.add(item);
  }
);
  exchange.setResponseCode(HttpStatus.SC_OK);
  RootRepresentationFactory.sendHal(exchange,context,data,size);
  exchange.endExchange();
}
Program: 93606
Project: 93606
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  List<String> _dbs=client.getDatabaseNames();
  List<String> dbs=_dbs.stream().filter(db -> !RequestContext.isReservedResourceDb(db)).collect(Collectors.toList());
  if (dbs == null) {
    dbs=new ArrayList<>();
  }
  int size=dbs.size();
  Collections.sort(dbs);
  dbs=dbs.subList((context.getPage() - 1) * context.getPagesize(),(context.getPage() - 1) * context.getPagesize() + context.getPagesize() > dbs.size() ? dbs.size() : (context.getPage() - 1) * context.getPagesize() + context.getPagesize());
  List<DBObject> data=new ArrayList<>();
  dbs.stream().map((db) -> {
    return new BasicDBObject("String_Node_Str",db);
  }
).forEach((item) -> {
    data.add(item);
  }
);
  exchange.setResponseCode(HttpStatus.SC_OK);
  RootRepresentationFactory.sendHal(exchange,context,data,size);
  exchange.endExchange();
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  List<String> _dbs=client.getDatabaseNames();
  List<String> dbs=_dbs.stream().filter(db -> !RequestContext.isReservedResourceDb(db)).collect(Collectors.toList());
  if (dbs == null) {
    dbs=new ArrayList<>();
  }
  int size=dbs.size();
  Collections.sort(dbs);
  dbs=dbs.subList((context.getPage() - 1) * context.getPagesize(),(context.getPage() - 1) * context.getPagesize() + context.getPagesize() > dbs.size() ? dbs.size() : (context.getPage() - 1) * context.getPagesize() + context.getPagesize());
  List<DBObject> data=new ArrayList<>();
  dbs.stream().map((db) -> {
    DBObject props=DBDAO.getDbProps(db);
    BasicDBObject _db=new BasicDBObject("String_Node_Str",db);
    if (props != null)     _db.putAll((DBObject)props);
    return _db;
  }
).forEach((item) -> {
    data.add(item);
  }
);
  exchange.setResponseCode(HttpStatus.SC_OK);
  RootRepresentationFactory.sendHal(exchange,context,data,size);
  exchange.endExchange();
}
Program: 93615
Project: 93615
Buggy source:
/** 
 * @param dbName
 * @param colls the collections list as got from getDbCollections()
 * @param page
 * @param pagesize
 * @return the db data
 * @throws com.softinstigate.restheart.handlers.IllegalQueryParamenterException
 */
public static List<DBObject> getData(String dbName,List<String> colls,int page,int pagesize) throws IllegalQueryParamenterException {
  List<String> _colls=colls.stream().filter(coll -> !RequestContext.isReservedResourceCollection(coll)).collect(Collectors.toList());
  int size=_colls.size();
  long total_pages;
  if (size > 0) {
    float _size=size + 0f;
    float _pagesize=pagesize + 0f;
    total_pages=Math.max(1,Math.round(Math.nextUp(_size / _pagesize)));
    if (page > total_pages) {
      throw new IllegalQueryParamenterException("String_Node_Str" + total_pages);
    }
  }
  _colls=_colls.subList((page - 1) * pagesize,(page - 1) * pagesize + pagesize > _colls.size() ? _colls.size() : (page - 1) * pagesize + pagesize);
  List<DBObject> data=new ArrayList<>();
  _colls.stream().map((coll) -> {
    BasicDBObject properties=new BasicDBObject();
    properties.put("String_Node_Str",coll);
    DBObject collProperties=CollectionDAO.getCollectionProps(dbName,coll);
    if (collProperties != null)     properties.putAll(collProperties);
    return properties;
  }
).forEach((item) -> {
    data.add(item);
  }
);
  return data;
}

Fixed version (ground truth):
/** 
 * @param dbName
 * @param colls the collections list as got from getDbCollections()
 * @param page
 * @param pagesize
 * @return the db data
 * @throws com.softinstigate.restheart.handlers.IllegalQueryParamenterException
 */
public static List<DBObject> getData(String dbName,List<String> colls,int page,int pagesize) throws IllegalQueryParamenterException {
  List<String> _colls=colls.stream().filter(coll -> !RequestContext.isReservedResourceCollection(coll)).collect(Collectors.toList());
  int size=_colls.size();
  long total_pages;
  if (size > 0) {
    float _size=size + 0f;
    float _pagesize=pagesize + 0f;
    total_pages=Math.max(1,Math.round(Math.ceil(_size / _pagesize)));
    if (page > total_pages) {
      throw new IllegalQueryParamenterException("String_Node_Str" + total_pages);
    }
  }
  _colls=_colls.subList((page - 1) * pagesize,(page - 1) * pagesize + pagesize > _colls.size() ? _colls.size() : (page - 1) * pagesize + pagesize);
  List<DBObject> data=new ArrayList<>();
  _colls.stream().map((coll) -> {
    BasicDBObject properties=new BasicDBObject();
    properties.put("String_Node_Str",coll);
    DBObject collProperties=CollectionDAO.getCollectionProps(dbName,coll);
    if (collProperties != null)     properties.putAll(collProperties);
    return properties;
  }
).forEach((item) -> {
    data.add(item);
  }
);
  return data;
}
Program: 93622
Project: 93622
Buggy source:
private static int optimisticCheckEtag(DBCollection coll,DBObject oldDocument,ObjectId requestEtag,int httpStatusIfOk){
  if (requestEtag == null) {
    logger.warn("String_Node_Str",Headers.ETAG);
    coll.save(oldDocument);
    return HttpStatus.SC_CONFLICT;
  }
  Object oldEtag=RequestHelper.getEtagAsObjectId(oldDocument.get("String_Node_Str"));
  if (oldEtag == null) {
    return HttpStatus.SC_NO_CONTENT;
  }
 else {
    if (oldEtag.equals(requestEtag)) {
      return httpStatusIfOk;
    }
 else {
      coll.save(oldDocument);
      return HttpStatus.SC_PRECONDITION_FAILED;
    }
  }
}

Fixed version (ground truth):
private static int optimisticCheckEtag(DBCollection coll,DBObject oldDocument,ObjectId requestEtag,int httpStatusIfOk){
  if (requestEtag == null) {
    coll.save(oldDocument);
    return HttpStatus.SC_CONFLICT;
  }
  Object oldEtag=RequestHelper.getEtagAsObjectId(oldDocument.get("String_Node_Str"));
  if (oldEtag == null) {
    return HttpStatus.SC_NO_CONTENT;
  }
 else {
    if (oldEtag.equals(requestEtag)) {
      return httpStatusIfOk;
    }
 else {
      coll.save(oldDocument);
      return HttpStatus.SC_PRECONDITION_FAILED;
    }
  }
}
Program: 93623
Project: 93623
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_CONFLICT,"String_Node_Str" + Headers.ETAG + "String_Node_Str");
    logger.warn("String_Node_Str",Headers.ETAG);
    return;
  }
  int SC=CollectionDAO.deleteCollection(context.getDBName(),context.getCollectionName(),etag);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
  LocalCachesSingleton.getInstance().invalidateCollection(context.getDBName(),context.getCollectionName());
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  ObjectId etag=RequestHelper.getWriteEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_CONFLICT,"String_Node_Str" + Headers.ETAG + "String_Node_Str");
    logger.warn("String_Node_Str",Headers.ETAG);
    return;
  }
  int SC=CollectionDAO.deleteCollection(context.getDBName(),context.getCollectionName(),etag);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
  LocalCachesSingleton.getInstance().invalidateCollection(context.getDBName(),context.getCollectionName());
}
Program: 93625
Project: 93625
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  DBObject content=context.getContent();
  if (content == null)   content=new BasicDBObject();
  if (content instanceof BasicDBList) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  int SC=DocumentDAO.upsertDocumentPost(exchange,context.getDBName(),context.getCollectionName(),content,etag);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  DBObject content=context.getContent();
  if (content == null)   content=new BasicDBObject();
  if (content instanceof BasicDBList) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  ObjectId etag=RequestHelper.getWriteEtag(exchange);
  int SC=DocumentDAO.upsertDocumentPost(exchange,context.getDBName(),context.getCollectionName(),content,etag);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
}
Program: 93626
Project: 93626
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (context.getCollectionName().isEmpty() || context.getCollectionName().startsWith("String_Node_Str")) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  DBObject content=context.getContent();
  if (content == null)   content=new BasicDBObject();
  if (content instanceof BasicDBList) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  if (content.containsField(Relationship.RELATIONSHIPS_ELEMENT_NAME)) {
    try {
      Relationship.getFromJson(content);
    }
 catch (    InvalidMetadataException ex) {
      ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str" + ex.getMessage(),ex);
      return;
    }
  }
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  boolean updating=context.getCollectionProps() != null;
  int SC=CollectionDAO.upsertCollection(context.getDBName(),context.getCollectionName(),content,etag,updating,false);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
  LocalCachesSingleton.getInstance().invalidateCollection(context.getDBName(),context.getCollectionName());
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (context.getCollectionName().isEmpty() || context.getCollectionName().startsWith("String_Node_Str")) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  DBObject content=context.getContent();
  if (content == null)   content=new BasicDBObject();
  if (content instanceof BasicDBList) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  if (content.containsField(Relationship.RELATIONSHIPS_ELEMENT_NAME)) {
    try {
      Relationship.getFromJson(content);
    }
 catch (    InvalidMetadataException ex) {
      ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str" + ex.getMessage(),ex);
      return;
    }
  }
  ObjectId etag=RequestHelper.getWriteEtag(exchange);
  boolean updating=context.getCollectionProps() != null;
  int SC=CollectionDAO.upsertCollection(context.getDBName(),context.getCollectionName(),content,etag,updating,false);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
  LocalCachesSingleton.getInstance().invalidateCollection(context.getDBName(),context.getCollectionName());
}
Program: 93627
Project: 93627
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_CONFLICT,"String_Node_Str" + Headers.ETAG + "String_Node_Str");
    logger.warn("String_Node_Str",Headers.ETAG);
    return;
  }
  int SC=DBDAO.deleteDB(context.getDBName(),etag);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
  LocalCachesSingleton.getInstance().invalidateDb(context.getDBName());
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  ObjectId etag=RequestHelper.getWriteEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_CONFLICT,"String_Node_Str" + Headers.ETAG + "String_Node_Str");
    logger.warn("String_Node_Str",Headers.ETAG);
    return;
  }
  int SC=DBDAO.deleteDB(context.getDBName(),etag);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
  LocalCachesSingleton.getInstance().invalidateDb(context.getDBName());
}
Program: 93628
Project: 93628
Buggy source:
/** 
 * partial update db properties
 * @param exchange
 * @param context
 * @throws Exception
 */
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (context.getDBName().isEmpty() || context.getDBName().startsWith("String_Node_Str")) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  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;
  }
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_CONFLICT,"String_Node_Str" + Headers.ETAG + "String_Node_Str");
    logger.warn("String_Node_Str",Headers.ETAG);
    return;
  }
  int SC=DBDAO.upsertDB(context.getDBName(),content,etag,true);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
}

Fixed version (ground truth):
/** 
 * partial update db properties
 * @param exchange
 * @param context
 * @throws Exception
 */
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (context.getDBName().isEmpty() || context.getDBName().startsWith("String_Node_Str")) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  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;
  }
  ObjectId etag=RequestHelper.getWriteEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchange(exchange,HttpStatus.SC_CONFLICT);
    return;
  }
  int SC=DBDAO.upsertDB(context.getDBName(),content,etag,true);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
}
Program: 93629
Project: 93629
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (context.getDBName().isEmpty() || context.getDBName().startsWith("String_Node_Str")) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  DBObject content=context.getContent();
  if (content == null)   content=new BasicDBObject();
  if (content instanceof BasicDBList) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  int SC=DBDAO.upsertDB(context.getDBName(),content,etag,false);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
  LocalCachesSingleton.getInstance().invalidateDb(context.getDBName());
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (context.getDBName().isEmpty() || context.getDBName().startsWith("String_Node_Str")) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  DBObject content=context.getContent();
  if (content == null)   content=new BasicDBObject();
  if (content instanceof BasicDBList) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  ObjectId etag=RequestHelper.getWriteEtag(exchange);
  int SC=DBDAO.upsertDB(context.getDBName(),content,etag,false);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
  LocalCachesSingleton.getInstance().invalidateDb(context.getDBName());
}
Program: 93630
Project: 93630
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_CONFLICT,"String_Node_Str" + Headers.ETAG + "String_Node_Str");
    logger.warn("String_Node_Str",Headers.ETAG);
    return;
  }
  int SC=DocumentDAO.deleteDocument(context.getDBName(),context.getCollectionName(),context.getDocumentId(),etag);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  ObjectId etag=RequestHelper.getWriteEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchange(exchange,HttpStatus.SC_CONFLICT);
    return;
  }
  int SC=DocumentDAO.deleteDocument(context.getDBName(),context.getCollectionName(),context.getDocumentId(),etag);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
}
Program: 93631
Project: 93631
Buggy source:
@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;
  }
  String id=context.getDocumentId();
  if (content.get("String_Node_Str") == null) {
    content.put("String_Node_Str",getId(id));
  }
 else   if (!content.get("String_Node_Str").equals(id)) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    logger.warn("String_Node_Str");
    return;
  }
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_CONFLICT,"String_Node_Str" + Headers.ETAG + "String_Node_Str");
    logger.warn("String_Node_Str",Headers.ETAG);
    return;
  }
  int SC=DocumentDAO.upsertDocument(context.getDBName(),context.getCollectionName(),context.getDocumentId(),content,etag,true);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
}

Fixed version (ground truth):
@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;
  }
  String id=context.getDocumentId();
  if (content.get("String_Node_Str") == null) {
    content.put("String_Node_Str",getId(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);
  if (etag == null) {
    ResponseHelper.endExchange(exchange,HttpStatus.SC_CONFLICT);
    return;
  }
  int SC=DocumentDAO.upsertDocument(context.getDBName(),context.getCollectionName(),context.getDocumentId(),content,etag,true);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
}
Program: 93632
Project: 93632
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  DBObject content=context.getContent();
  if (content == null)   content=new BasicDBObject();
  if (content instanceof BasicDBList) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  String id=context.getDocumentId();
  if (content.get("String_Node_Str") == null) {
    content.put("String_Node_Str",getId(id));
  }
 else   if (!content.get("String_Node_Str").equals(id)) {
    ResponseHelper.endExchange(exchange,HttpStatus.SC_NOT_ACCEPTABLE);
    logger.warn("String_Node_Str");
    return;
  }
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  int SC=DocumentDAO.upsertDocument(context.getDBName(),context.getCollectionName(),context.getDocumentId(),content,etag,false);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  DBObject content=context.getContent();
  if (content == null)   content=new BasicDBObject();
  if (content instanceof BasicDBList) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  String id=context.getDocumentId();
  if (content.get("String_Node_Str") == null) {
    content.put("String_Node_Str",getId(id));
  }
 else   if (!content.get("String_Node_Str").equals(id)) {
    ResponseHelper.endExchange(exchange,HttpStatus.SC_NOT_ACCEPTABLE);
    logger.warn("String_Node_Str");
    return;
  }
  ObjectId etag=RequestHelper.getWriteEtag(exchange);
  int SC=DocumentDAO.upsertDocument(context.getDBName(),context.getCollectionName(),context.getDocumentId(),content,etag,false);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
}
Program: 93633
Project: 93633
Buggy source:
public static ObjectId getEtagAsObjectId(Object etag){
  if (etag == null)   return null;
  if (ObjectId.isValid("String_Node_Str" + etag))   return new ObjectId("String_Node_Str" + etag);
 else   return null;
}

Fixed version (ground truth):
public static ObjectId getEtagAsObjectId(Object etag){
  if (etag == null)   return null;
  if (ObjectId.isValid("String_Node_Str" + etag))   return new ObjectId("String_Node_Str" + etag);
 else   return new ObjectId();
}
Program: 93635
Project: 93635
Buggy source:
public static void deleteIndex(String db,String co,String indexId){
  client.getDB(db).getCollection(co).dropIndex(indexId);
}

Fixed version (ground truth):
public static int deleteIndex(String db,String co,String indexId){
  client.getDB(db).getCollection(co).dropIndex(indexId);
  return HttpStatus.SC_GONE;
}
Program: 93636
Project: 93636
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_CONFLICT,"String_Node_Str" + Headers.ETAG + "String_Node_Str");
    logger.warn("String_Node_Str",Headers.ETAG);
    return;
  }
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  ResponseHelper.endExchange(exchange,CollectionDAO.deleteCollection(context.getDBName(),context.getCollectionName(),etag));
  LocalCachesSingleton.getInstance().invalidateCollection(context.getDBName(),context.getCollectionName());
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_CONFLICT,"String_Node_Str" + Headers.ETAG + "String_Node_Str");
    logger.warn("String_Node_Str",Headers.ETAG);
    return;
  }
  int SC=CollectionDAO.deleteCollection(context.getDBName(),context.getCollectionName(),etag);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
  LocalCachesSingleton.getInstance().invalidateCollection(context.getDBName(),context.getCollectionName());
}
Program: 93638
Project: 93638
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  DBObject content=context.getContent();
  if (content == null)   content=new BasicDBObject();
  if (content instanceof BasicDBList) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  int SC=DocumentDAO.upsertDocumentPost(exchange,context.getDBName(),context.getCollectionName(),content,etag);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  ResponseHelper.endExchange(exchange,SC);
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  DBObject content=context.getContent();
  if (content == null)   content=new BasicDBObject();
  if (content instanceof BasicDBList) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  int SC=DocumentDAO.upsertDocumentPost(exchange,context.getDBName(),context.getCollectionName(),content,etag);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
}
Program: 93639
Project: 93639
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (context.getCollectionName().isEmpty() || context.getCollectionName().startsWith("String_Node_Str")) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  DBObject content=context.getContent();
  if (content == null)   content=new BasicDBObject();
  if (content instanceof BasicDBList) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  if (content.containsField(Relationship.RELATIONSHIPS_ELEMENT_NAME)) {
    try {
      Relationship.getFromJson(content);
    }
 catch (    InvalidMetadataException ex) {
      ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str" + ex.getMessage(),ex);
      return;
    }
  }
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  boolean updating=context.getCollectionProps() != null;
  int SC=CollectionDAO.upsertCollection(context.getDBName(),context.getCollectionName(),content,etag,updating,false);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  ResponseHelper.endExchange(exchange,SC);
  LocalCachesSingleton.getInstance().invalidateCollection(context.getDBName(),context.getCollectionName());
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (context.getCollectionName().isEmpty() || context.getCollectionName().startsWith("String_Node_Str")) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  DBObject content=context.getContent();
  if (content == null)   content=new BasicDBObject();
  if (content instanceof BasicDBList) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  if (content.containsField(Relationship.RELATIONSHIPS_ELEMENT_NAME)) {
    try {
      Relationship.getFromJson(content);
    }
 catch (    InvalidMetadataException ex) {
      ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str" + ex.getMessage(),ex);
      return;
    }
  }
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  boolean updating=context.getCollectionProps() != null;
  int SC=CollectionDAO.upsertCollection(context.getDBName(),context.getCollectionName(),content,etag,updating,false);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
  LocalCachesSingleton.getInstance().invalidateCollection(context.getDBName(),context.getCollectionName());
}
Program: 93640
Project: 93640
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_CONFLICT,"String_Node_Str" + Headers.ETAG + "String_Node_Str");
    logger.warn("String_Node_Str",Headers.ETAG);
    return;
  }
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  ResponseHelper.endExchange(exchange,DBDAO.deleteDB(context.getDBName(),etag));
  LocalCachesSingleton.getInstance().invalidateDb(context.getDBName());
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_CONFLICT,"String_Node_Str" + Headers.ETAG + "String_Node_Str");
    logger.warn("String_Node_Str",Headers.ETAG);
    return;
  }
  int SC=DBDAO.deleteDB(context.getDBName(),etag);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
  LocalCachesSingleton.getInstance().invalidateDb(context.getDBName());
}
Program: 93641
Project: 93641
Buggy source:
/** 
 * partial update db properties
 * @param exchange
 * @param context
 * @throws Exception
 */
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (context.getDBName().isEmpty() || context.getDBName().startsWith("String_Node_Str")) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  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;
  }
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_CONFLICT,"String_Node_Str" + Headers.ETAG + "String_Node_Str");
    logger.warn("String_Node_Str",Headers.ETAG);
    return;
  }
  int SC=DBDAO.upsertDB(context.getDBName(),content,etag,true);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  ResponseHelper.endExchange(exchange,SC);
}

Fixed version (ground truth):
/** 
 * partial update db properties
 * @param exchange
 * @param context
 * @throws Exception
 */
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (context.getDBName().isEmpty() || context.getDBName().startsWith("String_Node_Str")) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  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;
  }
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_CONFLICT,"String_Node_Str" + Headers.ETAG + "String_Node_Str");
    logger.warn("String_Node_Str",Headers.ETAG);
    return;
  }
  int SC=DBDAO.upsertDB(context.getDBName(),content,etag,true);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
}
Program: 93642
Project: 93642
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (context.getDBName().isEmpty() || context.getDBName().startsWith("String_Node_Str")) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  DBObject content=context.getContent();
  if (content == null)   content=new BasicDBObject();
  if (content instanceof BasicDBList) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  int SC=DBDAO.upsertDB(context.getDBName(),content,etag,false);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  ResponseHelper.endExchange(exchange,SC);
  LocalCachesSingleton.getInstance().invalidateDb(context.getDBName());
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (context.getDBName().isEmpty() || context.getDBName().startsWith("String_Node_Str")) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  DBObject content=context.getContent();
  if (content == null)   content=new BasicDBObject();
  if (content instanceof BasicDBList) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    return;
  }
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  int SC=DBDAO.upsertDB(context.getDBName(),content,etag,false);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
  LocalCachesSingleton.getInstance().invalidateDb(context.getDBName());
}
Program: 93643
Project: 93643
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_CONFLICT,"String_Node_Str" + Headers.ETAG + "String_Node_Str");
    logger.warn("String_Node_Str",Headers.ETAG);
    return;
  }
  int SC=DocumentDAO.deleteDocument(context.getDBName(),context.getCollectionName(),context.getDocumentId(),etag);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  ResponseHelper.endExchange(exchange,SC);
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_CONFLICT,"String_Node_Str" + Headers.ETAG + "String_Node_Str");
    logger.warn("String_Node_Str",Headers.ETAG);
    return;
  }
  int SC=DocumentDAO.deleteDocument(context.getDBName(),context.getCollectionName(),context.getDocumentId(),etag);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
}
Program: 93644
Project: 93644
Buggy source:
@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;
  }
  String id=context.getDocumentId();
  if (content.get("String_Node_Str") == null) {
    content.put("String_Node_Str",getId(id));
  }
 else   if (!content.get("String_Node_Str").equals(id)) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    logger.warn("String_Node_Str");
    return;
  }
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_CONFLICT,"String_Node_Str" + Headers.ETAG + "String_Node_Str");
    logger.warn("String_Node_Str",Headers.ETAG);
    return;
  }
  int SC=DocumentDAO.upsertDocument(context.getDBName(),context.getCollectionName(),context.getDocumentId(),content,etag,true);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  ResponseHelper.endExchange(exchange,SC);
}

Fixed version (ground truth):
@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;
  }
  String id=context.getDocumentId();
  if (content.get("String_Node_Str") == null) {
    content.put("String_Node_Str",getId(id));
  }
 else   if (!content.get("String_Node_Str").equals(id)) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_NOT_ACCEPTABLE,"String_Node_Str");
    logger.warn("String_Node_Str");
    return;
  }
  ObjectId etag=RequestHelper.getUpdateEtag(exchange);
  if (etag == null) {
    ResponseHelper.endExchangeWithMessage(exchange,HttpStatus.SC_CONFLICT,"String_Node_Str" + Headers.ETAG + "String_Node_Str");
    logger.warn("String_Node_Str",Headers.ETAG);
    return;
  }
  int SC=DocumentDAO.upsertDocument(context.getDBName(),context.getCollectionName(),context.getDocumentId(),content,etag,true);
  exchange.setResponseCode(SC);
  if (context.getWarnings() != null && !context.getWarnings().isEmpty()) {
    DocumentRepresentationFactory.sendDocument(exchange.getRequestPath(),exchange,context,new BasicDBObject());
  }
  exchange.endExchange();
}