nus-yam/ex-repair huggingface dataset:
Program: 32652
Project: 32652
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_my);
  MonthAdapter adapter=new MonthAdapter(this,getResources().getStringArray(R.array.month_names));
  ListView month_listview=(ListView)findViewById(R.id.month_listview);
  month_listview.setAdapter(adapter);
  ListView date_listview=(ListView)findViewById(R.id.date_listview);
  date_listview.setAdapter(adapter);
  ListView year_listview=(ListView)findViewById(R.id.year_listview);
  year_listview.setAdapter(new MonthAdapter(this,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}));
  Display display=getWindowManager().getDefaultDisplay();
  Point size=new Point();
  display.getSize(size);
  int width=size.x / 2;
  int height=size.y / 2;
  month_listview.setSelectionFromTop(adapter.getCount() / 2 - 2,height);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_my);
  MonthAdapter adapter=new MonthAdapter(this,getResources().getStringArray(R.array.month_names));
  adapter.setCurrentMonthPos(adapter.getCount() / 2);
  ListView month_listview=(ListView)findViewById(R.id.month_listview);
  month_listview.setAdapter(adapter);
  ListView date_listview=(ListView)findViewById(R.id.date_listview);
  ListView year_listview=(ListView)findViewById(R.id.year_listview);
  month_listview.setSelection(adapter.getCount() / 2);
  Display display=getWindowManager().getDefaultDisplay();
  Point size=new Point();
  display.getSize(size);
  int width=size.x / 2;
  int height=size.y / 2;
}
Program: 32653
Project: 32653
Buggy source:
protected void connect(final C connection){
  if (!connection.isOpen()) {
    try {
      connection.open();
      if (user != null) {
        authenticate(connection);
      }
    }
 catch (    final IOException e) {
      LOGGER.error(e.getMessage(),e);
      throw new ArangoDBException(e);
    }
  }
}

Fixed version (ground truth):
protected synchronized void connect(final C connection){
  if (!connection.isOpen()) {
    try {
      connection.open();
      if (user != null) {
        authenticate(connection);
      }
    }
 catch (    final IOException e) {
      LOGGER.error(e.getMessage(),e);
      throw new ArangoDBException(e);
    }
  }
}
Program: 32654
Project: 32654
Buggy source:
public int getErrorNum(){
  return entity != null ? entity.getErrorNum() : null;
}

Fixed version (ground truth):
public Integer getErrorNum(){
  return entity != null ? entity.getErrorNum() : null;
}
Program: 32655
Project: 32655
Buggy source:
public int getResponseCode(){
  return entity != null ? entity.getCode() : null;
}

Fixed version (ground truth):
public Integer getResponseCode(){
  return entity != null ? entity.getCode() : null;
}
Program: 32656
Project: 32656
Buggy source:
/** 
 * Checks if the document exists by reading a single document head
 * @see <a href=
	 *      "https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document-header">API
	 *      Documentation</a>
 * @param key The key of the document
 * @param options Additional options, can be null
 * @return true if the document was found, otherwise false
 * @throws ArangoDBException only thrown when  {@link DocumentExistsOptions#isCatchException()} == false
 */
public Boolean documentExists(final String key,final DocumentExistsOptions options) throws ArangoDBException {
  try {
    executor.execute(documentExistsRequest(key,options),VPackSlice.class);
    return true;
  }
 catch (  final ArangoDBException e) {
    if (options == null || options.isCatchException()) {
      return false;
    }
    throw e;
  }
}

Fixed version (ground truth):
/** 
 * Checks if the document exists by reading a single document head
 * @see <a href=
	 *      "https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document-header">API
	 *      Documentation</a>
 * @param key The key of the document
 * @param options Additional options, can be null
 * @return true if the document was found, otherwise false
 */
public Boolean documentExists(final String key,final DocumentExistsOptions options){
  try {
    executor.execute(documentExistsRequest(key,options),VPackSlice.class);
    return true;
  }
 catch (  final ArangoDBException e) {
    return false;
  }
}
Program: 32657
Project: 32657
Buggy source:
/** 
 * Reads a single document
 * @see <a href="https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document">API
	 *      Documentation</a>
 * @param key The key of the document
 * @param type The type of the document (POJO class, VPackSlice or String for Json)
 * @param options Additional options, can be null
 * @return the document identified by the key
 * @throws ArangoDBException
 */
public <T>T getDocument(final String key,final Class<T> type,final DocumentReadOptions options) throws ArangoDBException {
  executor.validateDocumentKey(key);
  try {
    return executor.execute(getDocumentRequest(key,options),type);
  }
 catch (  final ArangoDBException e) {
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug(e.getMessage(),e);
    }
    if (options == null || options.isCatchException()) {
      return null;
    }
    throw e;
  }
}

Fixed version (ground truth):
/** 
 * Reads a single document
 * @see <a href="https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document">API
	 *      Documentation</a>
 * @param key The key of the document
 * @param type The type of the document (POJO class, VPackSlice or String for Json)
 * @param options Additional options, can be null
 * @return the document identified by the key
 * @throws ArangoDBException
 */
public <T>T getDocument(final String key,final Class<T> type,final DocumentReadOptions options) throws ArangoDBException {
  executor.validateDocumentKey(key);
  try {
    return executor.execute(getDocumentRequest(key,options),type);
  }
 catch (  final ArangoDBException e) {
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug(e.getMessage(),e);
    }
    return null;
  }
}
Program: 32658
Project: 32658
Buggy source:
public DocumentExistsOptions(){
  super();
  catchException=true;
}

Fixed version (ground truth):
public DocumentExistsOptions(){
  super();
}
Program: 32659
Project: 32659
Buggy source:
public DocumentReadOptions(){
  super();
  catchException=true;
}

Fixed version (ground truth):
public DocumentReadOptions(){
  super();
}
Program: 32660
Project: 32660
Buggy source:
/** 
 * Checks if the document exists by reading a single document head
 * @see <a href=
	 *      "https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document-header">API
	 *      Documentation</a>
 * @param key The key of the document
 * @param options Additional options, can be null
 * @return true if the document was found, otherwise false
 */
public Boolean documentExists(final String key,final DocumentExistsOptions options){
  try {
    executor.execute(documentExistsRequest(key,options),VPackSlice.class);
    return true;
  }
 catch (  final ArangoDBException e) {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Checks if the document exists by reading a single document head
 * @see <a href=
	 *      "https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document-header">API
	 *      Documentation</a>
 * @param key The key of the document
 * @param options Additional options, can be null
 * @return true if the document was found, otherwise false
 * @throws ArangoDBException only thrown when  {@link DocumentExistsOptions#isCatchException()} == false
 */
public Boolean documentExists(final String key,final DocumentExistsOptions options) throws ArangoDBException {
  try {
    executor.execute(documentExistsRequest(key,options),VPackSlice.class);
    return true;
  }
 catch (  final ArangoDBException e) {
    if (options == null || options.isCatchException()) {
      return false;
    }
    throw e;
  }
}
Program: 32661
Project: 32661
Buggy source:
/** 
 * Reads a single document
 * @see <a href="https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document">API
	 *      Documentation</a>
 * @param key The key of the document
 * @param type The type of the document (POJO class, VPackSlice or String for Json)
 * @param options Additional options, can be null
 * @return the document identified by the key
 * @throws ArangoDBException
 */
public <T>T getDocument(final String key,final Class<T> type,final DocumentReadOptions options) throws ArangoDBException {
  executor.validateDocumentKey(key);
  try {
    return executor.execute(getDocumentRequest(key,options),type);
  }
 catch (  final ArangoDBException e) {
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug(e.getMessage(),e);
    }
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Reads a single document
 * @see <a href="https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document">API
	 *      Documentation</a>
 * @param key The key of the document
 * @param type The type of the document (POJO class, VPackSlice or String for Json)
 * @param options Additional options, can be null
 * @return the document identified by the key
 * @throws ArangoDBException
 */
public <T>T getDocument(final String key,final Class<T> type,final DocumentReadOptions options) throws ArangoDBException {
  executor.validateDocumentKey(key);
  try {
    return executor.execute(getDocumentRequest(key,options),type);
  }
 catch (  final ArangoDBException e) {
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug(e.getMessage(),e);
    }
    if (options == null || options.isCatchException()) {
      return null;
    }
    throw e;
  }
}
Program: 32662
Project: 32662
Buggy source:
public DocumentExistsOptions(){
  super();
}

Fixed version (ground truth):
public DocumentExistsOptions(){
  super();
  catchException=true;
}
Program: 32663
Project: 32663
Buggy source:
public DocumentReadOptions(){
  super();
}

Fixed version (ground truth):
public DocumentReadOptions(){
  super();
  catchException=true;
}
Program: 32664
Project: 32664
Buggy source:
/** 
 * Checks if the document exists by reading a single document head
 * @see <a href=
	 *      "https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document-header">API
	 *      Documentation</a>
 * @param key The key of the document
 * @param options Additional options, can be null
 * @return true if the document was found, otherwise false
 * @throws ArangoDBException only thrown when  {@link DocumentExistsOptions#isCatchException()} == false
 */
public Boolean documentExists(final String key,final DocumentExistsOptions options) throws ArangoDBException {
  try {
    executor.execute(documentExistsRequest(key,options),VPackSlice.class);
    return true;
  }
 catch (  final ArangoDBException e) {
    if (options == null || options.isCatchException()) {
      return false;
    }
    throw e;
  }
}

Fixed version (ground truth):
/** 
 * Checks if the document exists by reading a single document head
 * @see <a href=
	 *      "https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document-header">API
	 *      Documentation</a>
 * @param key The key of the document
 * @param options Additional options, can be null
 * @return true if the document was found, otherwise false
 * @throws ArangoDBException only thrown when  {@link DocumentExistsOptions#isCatchException()} == false
 */
public Boolean documentExists(final String key,final DocumentExistsOptions options) throws ArangoDBException {
  try {
    executor.execute(documentExistsRequest(key,options),VPackSlice.class);
    return true;
  }
 catch (  final ArangoDBException e) {
    if ((e.getResponseCode() != null && (e.getResponseCode().intValue() == 404 || e.getResponseCode().intValue() == 304 || e.getResponseCode().intValue() == 412)) && (options == null || options.isCatchException())) {
      return false;
    }
    throw e;
  }
}
Program: 32665
Project: 32665
Buggy source:
/** 
 * Reads a single document
 * @see <a href="https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document">API
	 *      Documentation</a>
 * @param key The key of the document
 * @param type The type of the document (POJO class, VPackSlice or String for Json)
 * @param options Additional options, can be null
 * @return the document identified by the key
 * @throws ArangoDBException
 */
public <T>T getDocument(final String key,final Class<T> type,final DocumentReadOptions options) throws ArangoDBException {
  executor.validateDocumentKey(key);
  try {
    return executor.execute(getDocumentRequest(key,options),type);
  }
 catch (  final ArangoDBException e) {
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug(e.getMessage(),e);
    }
    if (options == null || options.isCatchException()) {
      return null;
    }
    throw e;
  }
}

Fixed version (ground truth):
/** 
 * Reads a single document
 * @see <a href="https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document">API
	 *      Documentation</a>
 * @param key The key of the document
 * @param type The type of the document (POJO class, VPackSlice or String for Json)
 * @param options Additional options, can be null
 * @return the document identified by the key
 * @throws ArangoDBException
 */
public <T>T getDocument(final String key,final Class<T> type,final DocumentReadOptions options) throws ArangoDBException {
  executor.validateDocumentKey(key);
  try {
    return executor.execute(getDocumentRequest(key,options),type);
  }
 catch (  final ArangoDBException e) {
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug(e.getMessage(),e);
    }
    if ((e.getResponseCode() != null && (e.getResponseCode().intValue() == 404 || e.getResponseCode().intValue() == 304 || e.getResponseCode().intValue() == 412)) && (options == null || options.isCatchException())) {
      return null;
    }
    throw e;
  }
}
Program: 32666
Project: 32666
Buggy source:
public Integer getResponseCode(){
  return entity != null ? entity.getCode() : null;
}

Fixed version (ground truth):
public Integer getResponseCode(){
  return responseCode != null ? responseCode : entity != null ? entity.getCode() : null;
}
Program: 32667
Project: 32667
Buggy source:
protected void checkError(final Response response) throws ArangoDBException {
  try {
    if (response.getResponseCode() >= ERROR_STATUS) {
      if (response.getBody() != null) {
        final ErrorEntity errorEntity=util.deserialize(response.getBody(),ErrorEntity.class);
        throw new ArangoDBException(errorEntity);
      }
 else {
        throw new ArangoDBException(String.format("String_Node_Str",response.getResponseCode()));
      }
    }
  }
 catch (  final VPackParserException e) {
    throw new ArangoDBException(e);
  }
}

Fixed version (ground truth):
protected void checkError(final Response response) throws ArangoDBException {
  try {
    if (response.getResponseCode() >= ERROR_STATUS) {
      if (response.getBody() != null) {
        final ErrorEntity errorEntity=util.deserialize(response.getBody(),ErrorEntity.class);
        throw new ArangoDBException(errorEntity);
      }
 else {
        throw new ArangoDBException(String.format("String_Node_Str",response.getResponseCode()),response.getResponseCode());
      }
    }
  }
 catch (  final VPackParserException e) {
    throw new ArangoDBException(e);
  }
}
Program: 32668
Project: 32668
Buggy source:
protected void checkError(final Response response) throws ArangoDBException {
  try {
    if (response.getResponseCode() >= ERROR_STATUS) {
      if (response.getBody() != null) {
        final ErrorEntity errorEntity=util.deserialize(response.getBody(),ErrorEntity.class);
        throw new ArangoDBException(errorEntity);
      }
 else {
        throw new ArangoDBException(String.format("String_Node_Str",response.getResponseCode()));
      }
    }
  }
 catch (  final VPackParserException e) {
    throw new ArangoDBException(e);
  }
}

Fixed version (ground truth):
protected void checkError(final Response response) throws ArangoDBException {
  try {
    if (response.getResponseCode() >= ERROR_STATUS) {
      if (response.getBody() != null) {
        final ErrorEntity errorEntity=util.deserialize(response.getBody(),ErrorEntity.class);
        throw new ArangoDBException(errorEntity);
      }
 else {
        throw new ArangoDBException(String.format("String_Node_Str",response.getResponseCode()),response.getResponseCode());
      }
    }
  }
 catch (  final VPackParserException e) {
    throw new ArangoDBException(e);
  }
}
Program: 32669
Project: 32669
Buggy source:
/** 
 * Checks if the document exists by reading a single document head
 * @see <a href=
	 *      "https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document-header">API
	 *      Documentation</a>
 * @param key The key of the document
 * @param options Additional options, can be null
 * @return true if the document was found, otherwise false
 */
public Boolean documentExists(final String key,final DocumentExistsOptions options){
  try {
    executor.execute(documentExistsRequest(key,options),VPackSlice.class);
    return true;
  }
 catch (  final ArangoDBException e) {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Checks if the document exists by reading a single document head
 * @see <a href=
	 *      "https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document-header">API
	 *      Documentation</a>
 * @param key The key of the document
 * @param options Additional options, can be null
 * @return true if the document was found, otherwise false
 * @throws ArangoDBException only thrown when  {@link DocumentExistsOptions#isCatchException()} == false
 */
public Boolean documentExists(final String key,final DocumentExistsOptions options) throws ArangoDBException {
  try {
    executor.execute(documentExistsRequest(key,options),VPackSlice.class);
    return true;
  }
 catch (  final ArangoDBException e) {
    if (options == null || options.isCatchException()) {
      return false;
    }
    throw e;
  }
}
Program: 32670
Project: 32670
Buggy source:
/** 
 * Reads a single document
 * @see <a href="https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document">API
	 *      Documentation</a>
 * @param key The key of the document
 * @param type The type of the document (POJO class, VPackSlice or String for Json)
 * @param options Additional options, can be null
 * @return the document identified by the key
 * @throws ArangoDBException
 */
public <T>T getDocument(final String key,final Class<T> type,final DocumentReadOptions options) throws ArangoDBException {
  executor.validateDocumentKey(key);
  try {
    return executor.execute(getDocumentRequest(key,options),type);
  }
 catch (  final ArangoDBException e) {
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug(e.getMessage(),e);
    }
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Reads a single document
 * @see <a href="https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document">API
	 *      Documentation</a>
 * @param key The key of the document
 * @param type The type of the document (POJO class, VPackSlice or String for Json)
 * @param options Additional options, can be null
 * @return the document identified by the key
 * @throws ArangoDBException
 */
public <T>T getDocument(final String key,final Class<T> type,final DocumentReadOptions options) throws ArangoDBException {
  executor.validateDocumentKey(key);
  try {
    return executor.execute(getDocumentRequest(key,options),type);
  }
 catch (  final ArangoDBException e) {
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug(e.getMessage(),e);
    }
    if (options == null || options.isCatchException()) {
      return null;
    }
    throw e;
  }
}
Program: 32671
Project: 32671
Buggy source:
public DocumentExistsOptions(){
  super();
}

Fixed version (ground truth):
public DocumentExistsOptions(){
  super();
  catchException=true;
}
Program: 32672
Project: 32672
Buggy source:
public DocumentReadOptions(){
  super();
}

Fixed version (ground truth):
public DocumentReadOptions(){
  super();
  catchException=true;
}
Program: 32673
Project: 32673
Buggy source:
protected String createPath(final String... params){
  final StringBuilder sb=new StringBuilder();
  for (int i=0; i < params.length; i++) {
    if (i > 0) {
      sb.append("String_Node_Str");
    }
    try {
      final String param;
      if (params[i].contains("String_Node_Str") || params[i].contains("String_Node_Str")) {
        param=params[i];
      }
 else {
        param=URLEncoder.encode(params[i],"String_Node_Str");
      }
      sb.append(param);
    }
 catch (    final UnsupportedEncodingException e) {
      throw new ArangoDBException(e);
    }
  }
  return sb.toString();
}

Fixed version (ground truth):
protected String createPath(final String... params){
  final StringBuilder sb=new StringBuilder();
  for (int i=0; i < params.length; i++) {
    if (i > 0) {
      sb.append(SLASH);
    }
    try {
      final String param;
      if (params[i].contains(SLASH)) {
        param=createPath(params[i].split(SLASH));
      }
 else {
        param=URLEncoder.encode(params[i],"String_Node_Str");
      }
      sb.append(param);
    }
 catch (    final UnsupportedEncodingException e) {
      throw new ArangoDBException(e);
    }
  }
  return sb.toString();
}
Program: 32674
Project: 32674
Buggy source:
protected Request documentExistsRequest(final String key,final DocumentExistsOptions options){
  final Request request;
  request=new Request(db,RequestType.HEAD,executor.createPath(ArangoDBConstants.PATH_API_DOCUMENT,createDocumentHandle(key)));
  final DocumentExistsOptions params=(options != null ? options : new DocumentExistsOptions());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  request.putHeaderParam(ArangoDBConstants.IF_NONE_MATCH,params.getIfNoneMatch());
  return request;
}

Fixed version (ground truth):
protected Request documentExistsRequest(final String key,final DocumentExistsOptions options){
  final Request request;
  request=new Request(db,RequestType.HEAD,executor.createPath(ArangoDBConstants.PATH_API_DOCUMENT,executor.createDocumentHandle(name,key)));
  final DocumentExistsOptions params=(options != null ? options : new DocumentExistsOptions());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  request.putHeaderParam(ArangoDBConstants.IF_NONE_MATCH,params.getIfNoneMatch());
  return request;
}
Program: 32675
Project: 32675
Buggy source:
protected Request getDocumentRequest(final String key,final DocumentReadOptions options){
  final Request request=new Request(db,RequestType.GET,executor.createPath(ArangoDBConstants.PATH_API_DOCUMENT,createDocumentHandle(key)));
  final DocumentReadOptions params=(options != null ? options : new DocumentReadOptions());
  request.putHeaderParam(ArangoDBConstants.IF_NONE_MATCH,params.getIfNoneMatch());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  return request;
}

Fixed version (ground truth):
protected Request getDocumentRequest(final String key,final DocumentReadOptions options){
  final Request request=new Request(db,RequestType.GET,executor.createPath(ArangoDBConstants.PATH_API_DOCUMENT,executor.createDocumentHandle(name,key)));
  final DocumentReadOptions params=(options != null ? options : new DocumentReadOptions());
  request.putHeaderParam(ArangoDBConstants.IF_NONE_MATCH,params.getIfNoneMatch());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  return request;
}
Program: 32676
Project: 32676
Buggy source:
protected <T>Request replaceDocumentRequest(final String key,final T value,final DocumentReplaceOptions options){
  final Request request=new Request(db,RequestType.PUT,executor.createPath(ArangoDBConstants.PATH_API_DOCUMENT,createDocumentHandle(key)));
  final DocumentReplaceOptions params=(options != null ? options : new DocumentReplaceOptions());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putQueryParam(ArangoDBConstants.IGNORE_REVS,params.getIgnoreRevs());
  request.putQueryParam(ArangoDBConstants.RETURN_NEW,params.getReturnNew());
  request.putQueryParam(ArangoDBConstants.RETURN_OLD,params.getReturnOld());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  request.setBody(executor.serialize(value));
  return request;
}

Fixed version (ground truth):
protected <T>Request replaceDocumentRequest(final String key,final T value,final DocumentReplaceOptions options){
  final Request request=new Request(db,RequestType.PUT,executor.createPath(ArangoDBConstants.PATH_API_DOCUMENT,executor.createDocumentHandle(name,key)));
  final DocumentReplaceOptions params=(options != null ? options : new DocumentReplaceOptions());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putQueryParam(ArangoDBConstants.IGNORE_REVS,params.getIgnoreRevs());
  request.putQueryParam(ArangoDBConstants.RETURN_NEW,params.getReturnNew());
  request.putQueryParam(ArangoDBConstants.RETURN_OLD,params.getReturnOld());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  request.setBody(executor.serialize(value));
  return request;
}
Program: 32677
Project: 32677
Buggy source:
protected <T>Request updateDocumentRequest(final String key,final T value,final DocumentUpdateOptions options){
  final Request request;
  request=new Request(db,RequestType.PATCH,executor.createPath(ArangoDBConstants.PATH_API_DOCUMENT,createDocumentHandle(key)));
  final DocumentUpdateOptions params=(options != null ? options : new DocumentUpdateOptions());
  request.putQueryParam(ArangoDBConstants.KEEP_NULL,params.getKeepNull());
  request.putQueryParam(ArangoDBConstants.MERGE_OBJECTS,params.getMergeObjects());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putQueryParam(ArangoDBConstants.IGNORE_REVS,params.getIgnoreRevs());
  request.putQueryParam(ArangoDBConstants.RETURN_NEW,params.getReturnNew());
  request.putQueryParam(ArangoDBConstants.RETURN_OLD,params.getReturnOld());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  request.setBody(executor.serialize(value,params.getSerializeNull() == null || params.getSerializeNull()));
  return request;
}

Fixed version (ground truth):
protected <T>Request updateDocumentRequest(final String key,final T value,final DocumentUpdateOptions options){
  final Request request;
  request=new Request(db,RequestType.PATCH,executor.createPath(ArangoDBConstants.PATH_API_DOCUMENT,executor.createDocumentHandle(name,key)));
  final DocumentUpdateOptions params=(options != null ? options : new DocumentUpdateOptions());
  request.putQueryParam(ArangoDBConstants.KEEP_NULL,params.getKeepNull());
  request.putQueryParam(ArangoDBConstants.MERGE_OBJECTS,params.getMergeObjects());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putQueryParam(ArangoDBConstants.IGNORE_REVS,params.getIgnoreRevs());
  request.putQueryParam(ArangoDBConstants.RETURN_NEW,params.getReturnNew());
  request.putQueryParam(ArangoDBConstants.RETURN_OLD,params.getReturnOld());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  request.setBody(executor.serialize(value,params.getSerializeNull() == null || params.getSerializeNull()));
  return request;
}
Program: 32678
Project: 32678
Buggy source:
protected Request deleteDocumentRequest(final String key,final DocumentDeleteOptions options){
  final Request request;
  request=new Request(db,RequestType.DELETE,executor.createPath(ArangoDBConstants.PATH_API_DOCUMENT,createDocumentHandle(key)));
  final DocumentDeleteOptions params=(options != null ? options : new DocumentDeleteOptions());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putQueryParam(ArangoDBConstants.RETURN_OLD,params.getReturnOld());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  return request;
}

Fixed version (ground truth):
protected Request deleteDocumentRequest(final String key,final DocumentDeleteOptions options){
  final Request request;
  request=new Request(db,RequestType.DELETE,executor.createPath(ArangoDBConstants.PATH_API_DOCUMENT,executor.createDocumentHandle(name,key)));
  final DocumentDeleteOptions params=(options != null ? options : new DocumentDeleteOptions());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putQueryParam(ArangoDBConstants.RETURN_OLD,params.getReturnOld());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  return request;
}
Program: 32679
Project: 32679
Buggy source:
protected <T>Request updateEdgeRequest(final String key,final T value,final EdgeUpdateOptions options){
  final Request request;
  request=new Request(db,RequestType.PATCH,executor.createPath(ArangoDBConstants.PATH_API_GHARIAL,graph,ArangoDBConstants.EDGE,createDocumentHandle(key)));
  final EdgeUpdateOptions params=(options != null ? options : new EdgeUpdateOptions());
  request.putQueryParam(ArangoDBConstants.KEEP_NULL,params.getKeepNull());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  request.setBody(executor.serialize(value,true));
  return request;
}

Fixed version (ground truth):
protected <T>Request updateEdgeRequest(final String key,final T value,final EdgeUpdateOptions options){
  final Request request;
  request=new Request(db,RequestType.PATCH,executor.createPath(ArangoDBConstants.PATH_API_GHARIAL,graph,ArangoDBConstants.EDGE,executor.createDocumentHandle(name,key)));
  final EdgeUpdateOptions params=(options != null ? options : new EdgeUpdateOptions());
  request.putQueryParam(ArangoDBConstants.KEEP_NULL,params.getKeepNull());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  request.setBody(executor.serialize(value,true));
  return request;
}
Program: 32680
Project: 32680
Buggy source:
protected Request deleteEdgeRequest(final String key,final EdgeDeleteOptions options){
  final Request request=new Request(db,RequestType.DELETE,executor.createPath(ArangoDBConstants.PATH_API_GHARIAL,graph,ArangoDBConstants.EDGE,createDocumentHandle(key)));
  final EdgeDeleteOptions params=(options != null ? options : new EdgeDeleteOptions());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  return request;
}

Fixed version (ground truth):
protected Request deleteEdgeRequest(final String key,final EdgeDeleteOptions options){
  final Request request=new Request(db,RequestType.DELETE,executor.createPath(ArangoDBConstants.PATH_API_GHARIAL,graph,ArangoDBConstants.EDGE,executor.createDocumentHandle(name,key)));
  final EdgeDeleteOptions params=(options != null ? options : new EdgeDeleteOptions());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  return request;
}
Program: 32681
Project: 32681
Buggy source:
protected Request getEdgeRequest(final String key,final DocumentReadOptions options){
  final Request request=new Request(db,RequestType.GET,executor.createPath(ArangoDBConstants.PATH_API_GHARIAL,graph,ArangoDBConstants.EDGE,createDocumentHandle(key)));
  final DocumentReadOptions params=(options != null ? options : new DocumentReadOptions());
  request.putHeaderParam(ArangoDBConstants.IF_NONE_MATCH,params.getIfNoneMatch());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  return request;
}

Fixed version (ground truth):
protected Request getEdgeRequest(final String key,final DocumentReadOptions options){
  final Request request=new Request(db,RequestType.GET,executor.createPath(ArangoDBConstants.PATH_API_GHARIAL,graph,ArangoDBConstants.EDGE,executor.createDocumentHandle(name,key)));
  final DocumentReadOptions params=(options != null ? options : new DocumentReadOptions());
  request.putHeaderParam(ArangoDBConstants.IF_NONE_MATCH,params.getIfNoneMatch());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  return request;
}
Program: 32682
Project: 32682
Buggy source:
protected <T>Request replaceEdgeRequest(final String key,final T value,final EdgeReplaceOptions options){
  final Request request=new Request(db,RequestType.PUT,executor.createPath(ArangoDBConstants.PATH_API_GHARIAL,graph,ArangoDBConstants.EDGE,createDocumentHandle(key)));
  final EdgeReplaceOptions params=(options != null ? options : new EdgeReplaceOptions());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  request.setBody(executor.serialize(value));
  return request;
}

Fixed version (ground truth):
protected <T>Request replaceEdgeRequest(final String key,final T value,final EdgeReplaceOptions options){
  final Request request=new Request(db,RequestType.PUT,executor.createPath(ArangoDBConstants.PATH_API_GHARIAL,graph,ArangoDBConstants.EDGE,executor.createDocumentHandle(name,key)));
  final EdgeReplaceOptions params=(options != null ? options : new EdgeReplaceOptions());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  request.setBody(executor.serialize(value));
  return request;
}
Program: 32683
Project: 32683
Buggy source:
protected <T>Request replaceVertexRequest(final String key,final T value,final VertexReplaceOptions options){
  final Request request=new Request(db,RequestType.PUT,executor.createPath(ArangoDBConstants.PATH_API_GHARIAL,graph,ArangoDBConstants.VERTEX,createDocumentHandle(key)));
  final VertexReplaceOptions params=(options != null ? options : new VertexReplaceOptions());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  request.setBody(executor.serialize(value));
  return request;
}

Fixed version (ground truth):
protected <T>Request replaceVertexRequest(final String key,final T value,final VertexReplaceOptions options){
  final Request request=new Request(db,RequestType.PUT,executor.createPath(ArangoDBConstants.PATH_API_GHARIAL,graph,ArangoDBConstants.VERTEX,executor.createDocumentHandle(name,key)));
  final VertexReplaceOptions params=(options != null ? options : new VertexReplaceOptions());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  request.setBody(executor.serialize(value));
  return request;
}
Program: 32684
Project: 32684
Buggy source:
protected <T>Request updateVertexRequest(final String key,final T value,final VertexUpdateOptions options){
  final Request request;
  request=new Request(db,RequestType.PATCH,executor.createPath(ArangoDBConstants.PATH_API_GHARIAL,graph,ArangoDBConstants.VERTEX,createDocumentHandle(key)));
  final VertexUpdateOptions params=(options != null ? options : new VertexUpdateOptions());
  request.putQueryParam(ArangoDBConstants.KEEP_NULL,params.getKeepNull());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  request.setBody(executor.serialize(value,true));
  return request;
}

Fixed version (ground truth):
protected <T>Request updateVertexRequest(final String key,final T value,final VertexUpdateOptions options){
  final Request request;
  request=new Request(db,RequestType.PATCH,executor.createPath(ArangoDBConstants.PATH_API_GHARIAL,graph,ArangoDBConstants.VERTEX,executor.createDocumentHandle(name,key)));
  final VertexUpdateOptions params=(options != null ? options : new VertexUpdateOptions());
  request.putQueryParam(ArangoDBConstants.KEEP_NULL,params.getKeepNull());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  request.setBody(executor.serialize(value,true));
  return request;
}
Program: 32685
Project: 32685
Buggy source:
protected Request deleteVertexRequest(final String key,final VertexDeleteOptions options){
  final Request request=new Request(db,RequestType.DELETE,executor.createPath(ArangoDBConstants.PATH_API_GHARIAL,graph,ArangoDBConstants.VERTEX,createDocumentHandle(key)));
  final VertexDeleteOptions params=(options != null ? options : new VertexDeleteOptions());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  return request;
}

Fixed version (ground truth):
protected Request deleteVertexRequest(final String key,final VertexDeleteOptions options){
  final Request request=new Request(db,RequestType.DELETE,executor.createPath(ArangoDBConstants.PATH_API_GHARIAL,graph,ArangoDBConstants.VERTEX,executor.createDocumentHandle(name,key)));
  final VertexDeleteOptions params=(options != null ? options : new VertexDeleteOptions());
  request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC,params.getWaitForSync());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  return request;
}
Program: 32686
Project: 32686
Buggy source:
protected Request getVertexRequest(final String key,final DocumentReadOptions options){
  final Request request=new Request(db,RequestType.GET,executor.createPath(ArangoDBConstants.PATH_API_GHARIAL,graph,ArangoDBConstants.VERTEX,createDocumentHandle(key)));
  final DocumentReadOptions params=(options != null ? options : new DocumentReadOptions());
  request.putHeaderParam(ArangoDBConstants.IF_NONE_MATCH,params.getIfNoneMatch());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  return request;
}

Fixed version (ground truth):
protected Request getVertexRequest(final String key,final DocumentReadOptions options){
  final Request request=new Request(db,RequestType.GET,executor.createPath(ArangoDBConstants.PATH_API_GHARIAL,graph,ArangoDBConstants.VERTEX,executor.createDocumentHandle(name,key)));
  final DocumentReadOptions params=(options != null ? options : new DocumentReadOptions());
  request.putHeaderParam(ArangoDBConstants.IF_NONE_MATCH,params.getIfNoneMatch());
  request.putHeaderParam(ArangoDBConstants.IF_MATCH,params.getIfMatch());
  return request;
}
Program: 32687
Project: 32687
Buggy source:
private void serializeArray(final String name,final Object value,final VPackBuilder builder,final Map<String,Object> additionalFields) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, VPackException {
  builder.add(name,ValueType.ARRAY);
  for (int i=0; i < Array.getLength(value); i++) {
    final Object element=Array.get(value,i);
    if (element != null) {
      addValue(null,element.getClass(),element,builder,null,additionalFields);
    }
  }
  builder.close();
}

Fixed version (ground truth):
private void serializeArray(final String name,final Object value,final VPackBuilder builder,final Map<String,Object> additionalFields) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, VPackException {
  builder.add(name,ValueType.ARRAY);
  for (int i=0; i < Array.getLength(value); i++) {
    final Object element=Array.get(value,i);
    if (element != null) {
      addValue(null,element.getClass(),element,builder,null,additionalFields);
    }
 else {
      builder.add(ValueType.NULL);
    }
  }
  builder.close();
}
Program: 32688
Project: 32688
Buggy source:
@Test public void fromArrayWithNull(){
  final TestEntityArray entity=new TestEntityArray();
  entity.a1=new String[]{"String_Node_Str",null};
  final VPackSlice vpack=new VPack.Builder().build().serialize(entity);
  assertThat(vpack,is(notNullValue()));
  assertThat(vpack.isObject(),is(true));
  final VPackSlice a1=vpack.get("String_Node_Str");
  assertThat(a1.isArray(),is(true));
  assertThat(a1.size(),is(1));
  assertThat(a1.get(0).isString(),is(true));
  assertThat(a1.get(0).getAsString(),is("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void fromArrayWithNull(){
  final TestEntityArray entity=new TestEntityArray();
  entity.a1=new String[]{"String_Node_Str",null};
  final VPackSlice vpack=new VPack.Builder().build().serialize(entity);
  assertThat(vpack,is(notNullValue()));
  assertThat(vpack.isObject(),is(true));
  final VPackSlice a1=vpack.get("String_Node_Str");
  assertThat(a1.isArray(),is(true));
  assertThat(a1.size(),is(2));
  assertThat(a1.get(0).isString(),is(true));
  assertThat(a1.get(0).getAsString(),is("String_Node_Str"));
  assertThat(a1.get(1).isNull(),is(true));
}
Program: 32690
Project: 32690
Buggy source:
@Test public void objectWithByteSize256(){
  final StringBuilder aa=new StringBuilder();
  final int stringLength=231;
  for (int i=0; i < stringLength; ++i) {
    aa.append("String_Node_Str");
  }
  final String foo="String_Node_Str";
  final String bar1="String_Node_Str";
  final String bar2="String_Node_Str";
  final VPackSlice vpack=new VPackBuilder().add(ValueType.OBJECT).add(foo,ValueType.OBJECT).add(bar2,"String_Node_Str").add(bar1,aa.toString()).close().close().slice();
  assertThat(vpack.isObject(),is(true));
  assertThat(vpack.get(foo).isObject(),is(true));
  assertThat(vpack.get(foo).get(bar1).isString(),is(true));
  assertThat(vpack.get(foo).get(bar1).getLength(),is(stringLength));
  assertThat(vpack.get(foo).get(bar2).isString(),is(true));
  assertThat(vpack.get(foo).get(bar2).getLength(),is(0));
}

Fixed version (ground truth):
@Test public void objectWithByteSize256(){
  final StringBuilder aa=new StringBuilder();
  final int stringLength=256 - 25;
  for (int i=0; i < stringLength; ++i) {
    aa.append("String_Node_Str");
  }
  final String foo="String_Node_Str";
  final String bar1="String_Node_Str";
  final String bar2="String_Node_Str";
  final VPackSlice vpack=new VPackBuilder().add(ValueType.OBJECT).add(foo,ValueType.OBJECT).add(bar2,"String_Node_Str").add(bar1,aa.toString()).close().close().slice();
  assertThat(vpack.isObject(),is(true));
  assertThat(vpack.get(foo).isObject(),is(true));
  assertThat(vpack.get(foo).get(bar1).isString(),is(true));
  assertThat(vpack.get(foo).get(bar1).getLength(),is(stringLength));
  assertThat(vpack.get(foo).get(bar2).isString(),is(true));
  assertThat(vpack.get(foo).get(bar2).getLength(),is(0));
}
Program: 32691
Project: 32691
Buggy source:
private void appendString(final String value) throws VPackBuilderException {
  final int length=value.length();
  if (length <= 126) {
    add((byte)(0x40 + length));
  }
 else {
    add((byte)0xbf);
    appendLength(length);
  }
  try {
    append(value);
  }
 catch (  final UnsupportedEncodingException e) {
    throw new VPackBuilderException(e);
  }
}

Fixed version (ground truth):
private void appendString(final String value) throws VPackBuilderException {
  final int length=value.getBytes().length;
  if (length <= 126) {
    add((byte)(0x40 + length));
  }
 else {
    add((byte)0xbf);
    appendLength(length);
  }
  try {
    append(value);
  }
 catch (  final UnsupportedEncodingException e) {
    throw new VPackBuilderException(e);
  }
}
Program: 32692
Project: 32692
Buggy source:
private static List<EdgeEntity<Object>> getEdges(final Class<?> edgeClazz,final JsonDeserializationContext context,final JsonArray edges){
  final List<EdgeEntity<Object>> list=new ArrayList<EdgeEntity<Object>>();
  if (edges != null) {
    for (int i=0, imax=edges.size(); i < imax; i++) {
      final JsonObject edge=edges.get(i).getAsJsonObject();
      final EdgeEntity<Object> ve=deserializeBaseParameter(edge,new EdgeEntity<Object>());
      deserializeDocumentParameter(edge,ve);
      if (edgeClazz != null) {
        ve.setEntity(context.deserialize(edge,edgeClazz));
      }
 else {
        ve.setEntity(context.deserialize(edge,Object.class));
      }
      list.add(ve);
    }
  }
  return list;
}

Fixed version (ground truth):
private static List<EdgeEntity<Object>> getEdges(final Class<?> edgeClazz,final JsonDeserializationContext context,final JsonArray edges){
  final List<EdgeEntity<Object>> list=new ArrayList<EdgeEntity<Object>>();
  if (edges != null) {
    for (int i=0, imax=edges.size(); i < imax; i++) {
      final JsonObject edge=edges.get(i).getAsJsonObject();
      final EdgeEntity<Object> ve=context.deserialize(edge,EdgeEntity.class);
      list.add(ve);
    }
  }
  return list;
}
Program: 32694
Project: 32694
Buggy source:
protected Options getOptions(){
  if (options != null) {
    options=new Options();
  }
  return options;
}

Fixed version (ground truth):
protected Options getOptions(){
  if (options == null) {
    options=new Options();
  }
  return options;
}
Program: 32695
Project: 32695
Buggy source:
/** 
 * Create a cursor and return the first results
 * @see <a href="https://docs.arangodb.com/current/HTTP/AqlQueryCursor/AccessingCursors.html#create-cursor">API
	 *      Documentation</a>
 * @param query contains the query string to be executed
 * @param bindVars key/value pairs representing the bind parameters
 * @param options Additional options, can be null
 * @param type The type of the result (POJO class, VPackSlice, String for Json, or Collection/List/Map)
 * @return cursor of the results
 */
public <T>CompletableFuture<ArangoCursor<T>> queryAsync(final String query,final Map<String,Object> bindVars,final AqlQueryOptions options,final Class<T> type) throws ArangoDBException {
  final Request request=new Request(name,RequestType.POST,ArangoDBConstants.PATH_API_CURSOR);
  AqlQueryOptions queryOptions=OptionsBuilder.build(options != null ? options : new AqlQueryOptions(),query,bindVars);
  request.setBody(serialize(queryOptions));
  final CompletableFuture<CursorResult> execution=execute(CursorResult.class,request);
  final CompletableFuture<ArangoCursor<T>> cursor=execution.thenApply(result -> {
    return new ArangoCursor<>(this,type,result);
  }
);
  return cursor;
}

Fixed version (ground truth):
/** 
 * Create a cursor and return the first results
 * @see <a href="https://docs.arangodb.com/current/HTTP/AqlQueryCursor/AccessingCursors.html#create-cursor">API
	 *      Documentation</a>
 * @param query contains the query string to be executed
 * @param bindVars key/value pairs representing the bind parameters
 * @param options Additional options, can be null
 * @param type The type of the result (POJO class, VPackSlice, String for Json, or Collection/List/Map)
 * @return cursor of the results
 */
public <T>CompletableFuture<ArangoCursor<T>> queryAsync(final String query,final Map<String,Object> bindVars,final AqlQueryOptions options,final Class<T> type) throws ArangoDBException {
  final Request request=new Request(name,RequestType.POST,ArangoDBConstants.PATH_API_CURSOR);
  request.setBody(serialize(OptionsBuilder.build(options != null ? options : new AqlQueryOptions(),query,bindVars)));
  final CompletableFuture<CursorResult> execution=execute(CursorResult.class,request);
  return execution.thenApply(result -> {
    return new ArangoCursor<>(this,type,result);
  }
);
}