nus-yam/ex-repair huggingface dataset:
Program: 32827
Project: 32827
Buggy source:
public <V,E>ShortestPathEntity<V,E> graphGetShortestPath(String graphName,Object startVertexExample,Object endVertexExample,ShortestPathOptions shortestPathOptions,Class<V> vertexClass,Class<E> edgeClass) throws ArangoException {
  if (shortestPathOptions == null) {
    shortestPathOptions=new ShortestPathOptions();
  }
  return cursorDriver.getShortestPath(getDefaultDatabase(),graphName,startVertexExample,endVertexExample,shortestPathOptions,getDefaultAqlQueryOptions(),vertexClass,edgeClass);
}

Fixed version (ground truth):
public <V,E>ShortestPathEntity<V,E> graphGetShortestPath(String graphName,Object startVertexExample,Object endVertexExample,ShortestPathOptions shortestPathOptions,Class<V> vertexClass,Class<E> edgeClass) throws ArangoException {
  ShortestPathOptions tmpShortestPathOptions=shortestPathOptions;
  if (tmpShortestPathOptions == null) {
    tmpShortestPathOptions=new ShortestPathOptions();
  }
  return cursorDriver.getShortestPath(getDefaultDatabase(),graphName,startVertexExample,endVertexExample,tmpShortestPathOptions,getDefaultAqlQueryOptions(),vertexClass,edgeClass);
}
Program: 32828
Project: 32828
Buggy source:
/** 
 * Returns vertices as a VertexCursor by a given query
 * @param query the query
 * @param bindVars the variables
 * @param aqlQueryOptions AQL query options (null for default values)
 * @param clazz the result class
 * @return VertexCursor<T>
 * @throws ArangoException
 */
public <T>VertexCursor<T> executeVertexQuery(String query,Map<String,Object> bindVars,AqlQueryOptions aqlQueryOptions,Class<T> clazz) throws ArangoException {
  if (aqlQueryOptions == null) {
    aqlQueryOptions=getDefaultAqlQueryOptions();
  }
  @SuppressWarnings("String_Node_Str") DocumentCursorResult<T,VertexEntity<T>> baseCursor=cursorDriver.executeBaseCursorQuery(getDefaultDatabase(),query,bindVars,aqlQueryOptions,VertexEntity.class,clazz);
  return new VertexCursor<T>(baseCursor);
}

Fixed version (ground truth):
/** 
 * Returns vertices as a VertexCursor by a given query
 * @param query the query
 * @param bindVars the variables
 * @param aqlQueryOptions AQL query options (null for default values)
 * @param clazz the result class
 * @return VertexCursor<T>
 * @throws ArangoException
 */
public <T>VertexCursor<T> executeVertexQuery(String query,Map<String,Object> bindVars,AqlQueryOptions aqlQueryOptions,Class<T> clazz) throws ArangoException {
  @SuppressWarnings("String_Node_Str") DocumentCursorResult<T,VertexEntity<T>> baseCursor=cursorDriver.executeBaseCursorQuery(getDefaultDatabase(),query,bindVars,getAqlQueryOptions(aqlQueryOptions),VertexEntity.class,clazz);
  return new VertexCursor<T>(baseCursor);
}
Program: 32829
Project: 32829
Buggy source:
/** 
 * Returns edges as an EdgeCursor by a given query
 * @param query the query
 * @param bindVars the variables
 * @param aqlQueryOptions AQL query options (null for default values)
 * @param clazz the result class
 * @return EdgeCursor<T>
 * @throws ArangoException
 */
public <T>EdgeCursor<T> executeEdgeQuery(String query,Map<String,Object> bindVars,AqlQueryOptions aqlQueryOptions,Class<T> clazz) throws ArangoException {
  if (aqlQueryOptions == null) {
    aqlQueryOptions=getDefaultAqlQueryOptions();
  }
  @SuppressWarnings("String_Node_Str") DocumentCursorResult<T,EdgeEntity<T>> baseCursor=cursorDriver.executeBaseCursorQuery(getDefaultDatabase(),query,bindVars,aqlQueryOptions,EdgeEntity.class,clazz);
  return new EdgeCursor<T>(baseCursor);
}

Fixed version (ground truth):
/** 
 * Returns edges as an EdgeCursor by a given query
 * @param query the query
 * @param bindVars the variables
 * @param aqlQueryOptions AQL query options (null for default values)
 * @param clazz the result class
 * @return EdgeCursor<T>
 * @throws ArangoException
 */
public <T>EdgeCursor<T> executeEdgeQuery(String query,Map<String,Object> bindVars,AqlQueryOptions aqlQueryOptions,Class<T> clazz) throws ArangoException {
  @SuppressWarnings("String_Node_Str") DocumentCursorResult<T,EdgeEntity<T>> baseCursor=cursorDriver.executeBaseCursorQuery(getDefaultDatabase(),query,bindVars,getAqlQueryOptions(aqlQueryOptions),EdgeEntity.class,clazz);
  return new EdgeCursor<T>(baseCursor);
}
Program: 32830
Project: 32830
Buggy source:
/** 
 * This method executes an AQL query and returns a DocumentCursorResult
 * @param query an AQL query as string
 * @param bindVars a map containing all bind variables,
 * @param aqlQueryOptions AQL query options
 * @param clazz the expected class, the result from the server request is deserialized to an instance of this class.
 * @return DocumentCursorResult<T, S>
 * @throws ArangoException
 */
public <T,S extends DocumentEntity<T>>DocumentCursorResult<T,S> executeAqlQueryWithDocumentCursorResutl(String query,Map<String,Object> bindVars,AqlQueryOptions aqlQueryOptions,Class<S> classDocumentEntity,Class<T> clazz) throws ArangoException {
  if (aqlQueryOptions == null) {
    aqlQueryOptions=getDefaultAqlQueryOptions();
  }
  return cursorDriver.executeBaseCursorQuery(getDefaultDatabase(),query,bindVars,aqlQueryOptions,classDocumentEntity,clazz);
}

Fixed version (ground truth):
/** 
 * This method executes an AQL query and returns a DocumentCursorResult
 * @param query an AQL query as string
 * @param bindVars a map containing all bind variables,
 * @param aqlQueryOptions AQL query options
 * @param clazz the expected class, the result from the server request is deserialized to an instance of this class.
 * @return DocumentCursorResult<T, S>
 * @throws ArangoException
 */
public <T,S extends DocumentEntity<T>>DocumentCursorResult<T,S> executeAqlQueryWithDocumentCursorResutl(String query,Map<String,Object> bindVars,AqlQueryOptions aqlQueryOptions,Class<S> classDocumentEntity,Class<T> clazz) throws ArangoException {
  return cursorDriver.executeBaseCursorQuery(getDefaultDatabase(),query,bindVars,getAqlQueryOptions(aqlQueryOptions),classDocumentEntity,clazz);
}
Program: 32831
Project: 32831
Buggy source:
/** 
 * Returns a VertexCursor by a given vertex example and some options
 * @param graphName The name of the graph.
 * @param clazz
 * @param vertexExample An example for the desired vertices
 * @param graphVerticesOptions An object containing the options
 * @param aqlQueryOptions AQL query options
 * @return VertexCursor<T>
 * @throws ArangoException
 */
public <T>VertexCursor<T> graphGetVertexCursor(String graphName,Class<T> clazz,Object vertexExample,GraphVerticesOptions graphVerticesOptions,AqlQueryOptions aqlQueryOptions) throws ArangoException {
  validateCollectionName(graphName);
  String query="String_Node_Str";
  Map<String,Object> bindVars=new MapBuilder().put("String_Node_Str",graphName).put("String_Node_Str",JsonUtils.convertNullToMap(vertexExample)).put("String_Node_Str",JsonUtils.convertNullToMap(graphVerticesOptions)).get();
  return executeVertexQuery(query,bindVars,aqlQueryOptions,clazz);
}

Fixed version (ground truth):
/** 
 * Returns a VertexCursor by a given vertex example and some options
 * @param graphName The name of the graph.
 * @param clazz
 * @param vertexExample An example for the desired vertices
 * @param graphVerticesOptions An object containing the options
 * @param aqlQueryOptions AQL query options
 * @return VertexCursor<T>
 * @throws ArangoException
 */
public <T>VertexCursor<T> graphGetVertexCursor(String graphName,Class<T> clazz,Object vertexExample,GraphVerticesOptions graphVerticesOptions,AqlQueryOptions aqlQueryOptions) throws ArangoException {
  validateCollectionName(graphName);
  String query="String_Node_Str";
  Map<String,Object> bindVars=new MapBuilder().put(GRAPH_NAME,graphName).put(VERTEX_EXAMPLE,JsonUtils.convertNullToMap(vertexExample)).put("String_Node_Str",JsonUtils.convertNullToMap(graphVerticesOptions)).get();
  return executeVertexQuery(query,bindVars,aqlQueryOptions,clazz);
}
Program: 32832
Project: 32832
Buggy source:
/** 
 * Returns all Edges of a given vertex.
 * @param graphName
 * @param clazz
 * @param vertexDocumentHandle
 * @return a CursorEntity object
 * @throws ArangoException
 * @deprecated As of release 2.5.4, replaced by{@link #graphGetEdgeCursor(String,Class,Object,GraphEdgesOptions,AqlQueryOptions)}
 */
@Deprecated public <T>CursorEntity<T> graphGetEdges(String graphName,Class<T> clazz,String vertexDocumentHandle) throws ArangoException {
  validateCollectionName(graphName);
  String query="String_Node_Str";
  Map<String,Object> bindVars=new MapBuilder().put("String_Node_Str",graphName).put("String_Node_Str",vertexDocumentHandle).get();
  return this.executeQuery(query,bindVars,clazz,true,20);
}

Fixed version (ground truth):
/** 
 * Returns all Edges of a given vertex.
 * @param graphName
 * @param clazz
 * @param vertexDocumentHandle
 * @return a CursorEntity object
 * @throws ArangoException
 * @deprecated As of release 2.5.4, replaced by{@link #graphGetEdgeCursor(String,Class,Object,GraphEdgesOptions,AqlQueryOptions)}
 */
@Deprecated public <T>CursorEntity<T> graphGetEdges(String graphName,Class<T> clazz,String vertexDocumentHandle) throws ArangoException {
  validateCollectionName(graphName);
  String query="String_Node_Str";
  Map<String,Object> bindVars=new MapBuilder().put(GRAPH_NAME,graphName).put("String_Node_Str",vertexDocumentHandle).get();
  return this.executeQuery(query,bindVars,clazz,true,20);
}
Program: 32833
Project: 32833
Buggy source:
/** 
 * Executes an AQL query and returns the raw JSON response
 * @param query an AQL query as string
 * @param bindVars a map containing all bind variables,
 * @param aqlQueryOptions AQL query options
 * @return A JSON string with the results from server
 * @throws ArangoException
 */
public String executeAqlQueryJSON(String query,Map<String,Object> bindVars,AqlQueryOptions aqlQueryOptions) throws ArangoException {
  if (aqlQueryOptions == null) {
    aqlQueryOptions=getDefaultAqlQueryOptions();
  }
  return cursorDriver.executeAqlQueryJSON(getDefaultDatabase(),query,bindVars,aqlQueryOptions);
}

Fixed version (ground truth):
/** 
 * Executes an AQL query and returns the raw JSON response
 * @param query an AQL query as string
 * @param bindVars a map containing all bind variables,
 * @param aqlQueryOptions AQL query options
 * @return A JSON string with the results from server
 * @throws ArangoException
 */
public String executeAqlQueryJSON(String query,Map<String,Object> bindVars,AqlQueryOptions aqlQueryOptions) throws ArangoException {
  return cursorDriver.executeAqlQueryJSON(getDefaultDatabase(),query,bindVars,getAqlQueryOptions(aqlQueryOptions));
}
Program: 32834
Project: 32834
Buggy source:
/** 
 * Returns all Edges of vertices matching the example object (non-primitive set to null will not be used for comparing).
 * @param graphName
 * @param clazz
 * @param vertexExample
 * @return a CursorEntity object
 * @throws ArangoException
 * @deprecated As of release 2.5.4, replaced by{@link #graphGetEdgeCursorByExample(String,Class,Object)}
 */
@Deprecated public <T>CursorEntity<T> graphGetEdgesByExampleObject(String graphName,Class<T> clazz,Object vertexExample) throws ArangoException {
  validateCollectionName(graphName);
  String query="String_Node_Str";
  Map<String,Object> bindVars=new MapBuilder().put("String_Node_Str",graphName).put("String_Node_Str",vertexExample).get();
  CursorEntity<T> result=this.executeQuery(query,bindVars,clazz,true,20);
  return result;
}

Fixed version (ground truth):
/** 
 * Returns all Edges of vertices matching the example object (non-primitive set to null will not be used for comparing).
 * @param graphName
 * @param clazz
 * @param vertexExample
 * @return a CursorEntity object
 * @throws ArangoException
 * @deprecated As of release 2.5.4, replaced by{@link #graphGetEdgeCursorByExample(String,Class,Object)}
 */
@Deprecated public <T>CursorEntity<T> graphGetEdgesByExampleObject(String graphName,Class<T> clazz,Object vertexExample) throws ArangoException {
  validateCollectionName(graphName);
  String query="String_Node_Str";
  Map<String,Object> bindVars=new MapBuilder().put(GRAPH_NAME,graphName).put(VERTEX_EXAMPLE,vertexExample).get();
  return this.executeQuery(query,bindVars,clazz,true,20);
}
Program: 32835
Project: 32835
Buggy source:
/** 
 * This method sends all stacked requests as batch to ArangoDB.
 * @see ArangoDriver#startBatchMode()
 * @see com.arangodb.ArangoDriver#cancelBatchMode()
 * @throws com.arangodb.ArangoException
 */
public DefaultEntity executeBatch() throws ArangoException {
  if (!this.httpManager.isBatchModeActive()) {
    throw new ArangoException("String_Node_Str");
  }
  List<BatchPart> callStack=this.httpManager.getCallStack();
  this.cancelBatchMode();
  DefaultEntity result=this.batchDriver.executeBatch(callStack,this.getDefaultDatabase());
  return result;
}

Fixed version (ground truth):
/** 
 * This method sends all stacked requests as batch to ArangoDB.
 * @see ArangoDriver#startBatchMode()
 * @see com.arangodb.ArangoDriver#cancelBatchMode()
 * @throws com.arangodb.ArangoException
 */
public DefaultEntity executeBatch() throws ArangoException {
  if (!this.httpManager.isBatchModeActive()) {
    throw new ArangoException("String_Node_Str");
  }
  List<BatchPart> callStack=this.httpManager.getCallStack();
  this.cancelBatchMode();
  return this.batchDriver.executeBatch(callStack,this.getDefaultDatabase());
}
Program: 32836
Project: 32836
Buggy source:
/** 
 * This method executes an AQL query and returns a CursorRawResult. Use CursorRawResult.iterator() to get the raw JSON strings.
 * @param query an AQL query as string
 * @param bindVars a map containing all bind variables,
 * @param aqlQueryOptions AQL query options
 * @return CursorRawResult
 * @throws ArangoException
 */
public CursorRawResult executeAqlQueryRaw(String query,Map<String,Object> bindVars,AqlQueryOptions aqlQueryOptions) throws ArangoException {
  if (aqlQueryOptions == null) {
    aqlQueryOptions=getDefaultAqlQueryOptions();
  }
  return cursorDriver.executeAqlQueryRaw(getDefaultDatabase(),query,bindVars,aqlQueryOptions);
}

Fixed version (ground truth):
/** 
 * This method executes an AQL query and returns a CursorRawResult. Use CursorRawResult.iterator() to get the raw JSON strings.
 * @param query an AQL query as string
 * @param bindVars a map containing all bind variables,
 * @param aqlQueryOptions AQL query options
 * @return CursorRawResult
 * @throws ArangoException
 */
public CursorRawResult executeAqlQueryRaw(String query,Map<String,Object> bindVars,AqlQueryOptions aqlQueryOptions) throws ArangoException {
  return cursorDriver.executeAqlQueryRaw(getDefaultDatabase(),query,bindVars,getAqlQueryOptions(aqlQueryOptions));
}
Program: 32837
Project: 32837
Buggy source:
/** 
 * Returns all Edges of vertices matching the map.
 * @param graphName The name of the graph.
 * @param clazz Class of returned edge documents.
 * @param vertexExample Map with example of vertex, where edges start or end.
 * @return a CursorEntity object
 * @throws ArangoException
 * @deprecated As of release 2.5.4, replaced by{@link #graphGetEdgeCursorByExample(String,Class,Object)}
 */
@Deprecated public <T>CursorEntity<T> graphGetEdgesByExampleMap(String graphName,Class<T> clazz,Map<String,Object> vertexExample) throws ArangoException {
  validateCollectionName(graphName);
  String query="String_Node_Str";
  Map<String,Object> bindVars=new MapBuilder().put("String_Node_Str",graphName).put("String_Node_Str",vertexExample).get();
  CursorEntity<T> result=this.executeQuery(query,bindVars,clazz,true,20,null);
  return result;
}

Fixed version (ground truth):
/** 
 * Returns all Edges of vertices matching the map.
 * @param graphName The name of the graph.
 * @param clazz Class of returned edge documents.
 * @param vertexExample Map with example of vertex, where edges start or end.
 * @return a CursorEntity object
 * @throws ArangoException
 * @deprecated As of release 2.5.4, replaced by{@link #graphGetEdgeCursorByExample(String,Class,Object)}
 */
@Deprecated public <T>CursorEntity<T> graphGetEdgesByExampleMap(String graphName,Class<T> clazz,Map<String,Object> vertexExample) throws ArangoException {
  validateCollectionName(graphName);
  String query="String_Node_Str";
  Map<String,Object> bindVars=new MapBuilder().put(GRAPH_NAME,graphName).put(VERTEX_EXAMPLE,vertexExample).get();
  return this.executeQuery(query,bindVars,clazz,true,20,null);
}
Program: 32838
Project: 32838
Buggy source:
/** 
 * This method executes an AQL query and returns a CursorResult
 * @param query an AQL query as string
 * @param bindVars a map containing all bind variables,
 * @param aqlQueryOptions AQL query options
 * @param clazz the expected class, the result from the server request is deserialized to an instance of this class.
 * @return CursorResult<T>
 * @throws ArangoException
 */
public <T>CursorResult<T> executeAqlQuery(String query,Map<String,Object> bindVars,AqlQueryOptions aqlQueryOptions,Class<T> clazz) throws ArangoException {
  if (aqlQueryOptions == null) {
    aqlQueryOptions=getDefaultAqlQueryOptions();
  }
  return cursorDriver.executeAqlQuery(getDefaultDatabase(),query,bindVars,aqlQueryOptions,clazz);
}

Fixed version (ground truth):
/** 
 * This method executes an AQL query and returns a CursorResult
 * @param query an AQL query as string
 * @param bindVars a map containing all bind variables,
 * @param aqlQueryOptions AQL query options
 * @param clazz the expected class, the result from the server request is deserialized to an instance of this class.
 * @return CursorResult<T>
 * @throws ArangoException
 */
public <T>CursorResult<T> executeAqlQuery(String query,Map<String,Object> bindVars,AqlQueryOptions aqlQueryOptions,Class<T> clazz) throws ArangoException {
  return cursorDriver.executeAqlQuery(getDefaultDatabase(),query,bindVars,getAqlQueryOptions(aqlQueryOptions),clazz);
}
Program: 32839
Project: 32839
Buggy source:
public void setErrorNumber(int errorNumber){
  entity.setErrorNumber(errorNumber);
}

Fixed version (ground truth):
public void setErrorNumber(int errorNumber){
  if (entity != null) {
    entity.setErrorNumber(errorNumber);
  }
}
Program: 32840
Project: 32840
Buggy source:
public void setCode(int code){
  entity.setCode(code);
}

Fixed version (ground truth):
public void setCode(int code){
  if (entity != null) {
    entity.setCode(code);
  }
}
Program: 32841
Project: 32841
Buggy source:
public ArangoException(Throwable cause){
  super(cause);
}

Fixed version (ground truth):
public ArangoException(Throwable cause){
  super(cause);
  this.entity=null;
}
Program: 32842
Project: 32842
Buggy source:
public boolean isUnauthorized(){
  return (entity != null && entity.isUnauthorized());
}

Fixed version (ground truth):
public boolean isUnauthorized(){
  return entity != null && entity.isUnauthorized();
}
Program: 32843
Project: 32843
Buggy source:
@Override public CollectionStatus read(JsonReader in) throws IOException {
  if (in.peek() == JsonToken.NULL) {
    in.nextNull();
    return null;
  }
  CollectionStatus ret=CollectionStatus.valueOf(in.nextInt());
  return ret;
}

Fixed version (ground truth):
@Override public CollectionStatus read(JsonReader in) throws IOException {
  if (in.peek() == JsonToken.NULL) {
    in.nextNull();
    return null;
  }
  return CollectionStatus.valueOf(in.nextInt());
}
Program: 32844
Project: 32844
Buggy source:
/** 
 * @param database
 * @param allowNull
 * @throws ArangoException
 * @see <a href=
	 *      "https://docs.arangodb.com/NamingConventions/DatabaseNames.html">
	 *      DatabaseNames documentation</a>
 */
protected void validateDatabaseName(String database,boolean allowNull) throws ArangoException {
  boolean valid=false;
  if (database == null) {
    if (allowNull) {
      valid=true;
    }
  }
 else {
    valid=databaseNamePattern.matcher(database).matches();
    if (database.equals("String_Node_Str")) {
      valid=true;
    }
  }
  if (!valid) {
    throw new ArangoException("String_Node_Str" + database);
  }
}

Fixed version (ground truth):
/** 
 * @param database
 * @param allowNull
 * @throws ArangoException
 * @see <a href=
	 *      "https://docs.arangodb.com/NamingConventions/DatabaseNames.html">
	 *      DatabaseNames documentation</a>
 */
protected void validateDatabaseName(String database,boolean allowNull) throws ArangoException {
  boolean valid=false;
  if (database == null) {
    if (allowNull) {
      valid=true;
    }
  }
 else {
    valid=databaseNamePattern.matcher(database).matches();
    if ("String_Node_Str".equals(database)) {
      valid=true;
    }
  }
  if (!valid) {
    throw new ArangoException("String_Node_Str" + database);
  }
}
Program: 32846
Project: 32846
Buggy source:
@SuppressWarnings("String_Node_Str") protected <T>T createEntityImpl(HttpResponseEntity res,Class<T> type) throws ArangoException {
  if (res.isJsonResponse()) {
    try {
      return EntityFactory.createEntity(res.getText(),type);
    }
 catch (    JsonSyntaxException e) {
      throw new ArangoException("String_Node_Str",e);
    }
catch (    JsonParseException e) {
      throw new ArangoException("String_Node_Str",e);
    }
  }
  if (res.isDumpResponse() && StreamEntity.class.isAssignableFrom(type)) {
    return (T)new StreamEntity(res.getStream());
  }
  if (res.getText() != null && res.getText().length() > 0) {
    throw new ArangoException("String_Node_Str" + res.getText());
  }
  return null;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected <T>T createEntityImpl(HttpResponseEntity res,Class<T> type) throws ArangoException {
  T result=null;
  if (res.isJsonResponse()) {
    try {
      result=EntityFactory.createEntity(res.getText(),type);
    }
 catch (    JsonSyntaxException e) {
      throw new ArangoException("String_Node_Str",e);
    }
catch (    JsonParseException e) {
      throw new ArangoException("String_Node_Str",e);
    }
  }
 else   if (res.isDumpResponse() && StreamEntity.class.isAssignableFrom(type)) {
    result=(T)new StreamEntity(res.getStream());
  }
 else   if (StringUtils.isNotEmpty(res.getText())) {
    throw new ArangoException("String_Node_Str" + res.getText());
  }
  return result;
}
Program: 32847
Project: 32847
Buggy source:
protected void validate(HttpResponseEntity res,BaseEntity entity) throws ArangoException {
  if (entity != null) {
    if (entity.isError()) {
      throw new ArangoException(entity);
    }
  }
  if (res.getStatusCode() >= 400) {
    if (res.isTextResponse()) {
      entity.setErrorNumber(res.getStatusCode());
      entity.setErrorMessage(res.getText());
    }
 else {
      entity.setErrorNumber(res.getStatusCode());
      entity.setErrorMessage(res.getStatusPhrase());
    }
switch (res.getStatusCode()) {
case 401:
      entity.setErrorMessage("String_Node_Str");
    break;
case 403:
  entity.setErrorMessage("String_Node_Str");
break;
default :
}
throw new ArangoException(entity);
}
}

Fixed version (ground truth):
protected void validate(HttpResponseEntity res,BaseEntity entity) throws ArangoException {
  if (entity != null && entity.isError()) {
    throw new ArangoException(entity);
  }
  if (res.getStatusCode() >= 400) {
    BaseEntity tmpEntity=entity;
    if (tmpEntity == null) {
      tmpEntity=new DefaultEntity();
    }
    if (res.isTextResponse()) {
      tmpEntity.setErrorNumber(res.getStatusCode());
      tmpEntity.setErrorMessage(res.getText());
    }
 else {
      tmpEntity.setErrorNumber(res.getStatusCode());
      tmpEntity.setErrorMessage(res.getStatusPhrase());
    }
switch (res.getStatusCode()) {
case 401:
      tmpEntity.setErrorMessage("String_Node_Str");
    break;
case 403:
  tmpEntity.setErrorMessage("String_Node_Str");
break;
default :
}
throw new ArangoException(tmpEntity);
}
}
Program: 32848
Project: 32848
Buggy source:
/** 
 * Checks if the content type is "text/plain"
 * @return true if the content type is "text/plain"
 * @since 1.4.0
 */
public boolean isTextResponse(){
  return (contentType != null && contentType.startsWith("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Checks if the content type is "text/plain"
 * @return true if the content type is "text/plain"
 * @since 1.4.0
 */
public boolean isTextResponse(){
  return contentType != null && contentType.startsWith("String_Node_Str");
}
Program: 32849
Project: 32849
Buggy source:
/** 
 * Checks if the content type is "application/json"
 * @return true if the content type is "application/json"
 * @since 1.4.0
 */
public boolean isJsonResponse(){
  return (contentType != null && contentType.startsWith("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Checks if the content type is "application/json"
 * @return true if the content type is "application/json"
 * @since 1.4.0
 */
public boolean isJsonResponse(){
  return contentType != null && contentType.startsWith("String_Node_Str");
}
Program: 32850
Project: 32850
Buggy source:
/** 
 * Checks if the content type is "application/x-arango-dump"
 * @return true if the content type is "application/x-arango-dump"
 * @since 1.4.0
 */
public boolean isDumpResponse(){
  return (contentType != null && contentType.startsWith("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Checks if the content type is "application/x-arango-dump"
 * @return true if the content type is "application/x-arango-dump"
 * @since 1.4.0
 */
public boolean isDumpResponse(){
  return contentType != null && contentType.startsWith("String_Node_Str");
}
Program: 32851
Project: 32851
Buggy source:
public boolean isBatchRepsonse(){
  return (requestId != null);
}

Fixed version (ground truth):
public boolean isBatchRepsonse(){
  return requestId != null;
}
Program: 32852
Project: 32852
Buggy source:
@Override public List<Endpoint> getEndpoints() throws ArangoException {
  Type type=new TypeToken<List<Endpoint>>(){
  }
.getType();
  HttpResponseEntity res=httpManager.doGet(createEndpointUrl(null,"String_Node_Str"));
  return EntityFactory.createEntity(res.getText(),type);
}

Fixed version (ground truth):
@Override public List<Endpoint> getEndpoints() throws ArangoException {
  Type type=new TypeToken<List<Endpoint>>(){
  }
.getType();
  HttpResponseEntity res=httpManager.doGet(createEndpointUrl(null,API_ENDPOINT));
  return EntityFactory.createEntity(res.getText(),type);
}
Program: 32853
Project: 32853
Buggy source:
@Override public BooleanResultEntity createEndpoint(String endpoint,String... databases) throws ArangoException {
  if (databases != null) {
    for (    String db : databases) {
      validateDatabaseName(db,false);
    }
  }
  HttpResponseEntity res=httpManager.doPost(createEndpointUrl(null,"String_Node_Str"),null,EntityFactory.toJsonString(new MapBuilder().put("String_Node_Str",endpoint).put("String_Node_Str",databases).get()));
  return createEntity(res,BooleanResultEntity.class);
}

Fixed version (ground truth):
@Override public BooleanResultEntity createEndpoint(String endpoint,String... databases) throws ArangoException {
  if (databases != null) {
    for (    String db : databases) {
      validateDatabaseName(db,false);
    }
  }
  HttpResponseEntity res=httpManager.doPost(createEndpointUrl(null,API_ENDPOINT),null,EntityFactory.toJsonString(new MapBuilder().put("String_Node_Str",endpoint).put("String_Node_Str",databases).get()));
  return createEntity(res,BooleanResultEntity.class);
}
Program: 32854
Project: 32854
Buggy source:
@Override public BooleanResultEntity deleteEndpoint(String endpoint) throws ArangoException {
  HttpResponseEntity res=httpManager.doDelete(createEndpointUrl(null,"String_Node_Str",StringUtils.encodeUrl(endpoint)),null);
  return createEntity(res,BooleanResultEntity.class);
}

Fixed version (ground truth):
@Override public BooleanResultEntity deleteEndpoint(String endpoint) throws ArangoException {
  HttpResponseEntity res=httpManager.doDelete(createEndpointUrl(null,API_ENDPOINT,StringUtils.encodeUrl(endpoint)),null);
  return createEntity(res,BooleanResultEntity.class);
}
Program: 32855
Project: 32855
Buggy source:
public static void log(String url,HttpRequestEntity requestEntity,String userAgent,Credentials credencials){
  boolean includeBody=(requestEntity.type == RequestType.POST || requestEntity.type == RequestType.PUT || requestEntity.type == RequestType.PATCH) && StringUtils.isNotEmpty(requestEntity.bodyText);
  StringBuilder buffer=new StringBuilder();
  if (includeBody) {
    buffer.append("String_Node_Str");
    buffer.append("String_Node_Str");
  }
  buffer.append("String_Node_Str").append(requestEntity.type);
  buffer.append("String_Node_Str");
  if (requestEntity.hasHeaders()) {
    for (    Entry<String,Object> header : requestEntity.headers.entrySet()) {
      buffer.append("String_Node_Str").append(header.getKey()).append("String_Node_Str").append(header.getValue()).append("String_Node_Str");
    }
  }
  if (credencials != null) {
    buffer.append("String_Node_Str").append(credencials.getUserPrincipal().getName()).append("String_Node_Str").append(credencials.getPassword());
  }
  if (includeBody) {
    buffer.append("String_Node_Str");
  }
  buffer.append("String_Node_Str").append(url).append("String_Node_Str");
  if (includeBody) {
    buffer.append("String_Node_Str");
    buffer.append(requestEntity.bodyText);
    buffer.append("String_Node_Str");
    buffer.append("String_Node_Str");
  }
  logger.debug("String_Node_Str",buffer);
}

Fixed version (ground truth):
public static void log(String url,HttpRequestEntity requestEntity,Credentials credencials){
  boolean includeBody=(requestEntity.type == RequestType.POST || requestEntity.type == RequestType.PUT || requestEntity.type == RequestType.PATCH) && StringUtils.isNotEmpty(requestEntity.bodyText);
  StringBuilder buffer=new StringBuilder();
  if (includeBody) {
    buffer.append("String_Node_Str");
    buffer.append("String_Node_Str");
  }
  buffer.append("String_Node_Str").append(requestEntity.type);
  buffer.append("String_Node_Str");
  if (requestEntity.hasHeaders()) {
    for (    Entry<String,Object> header : requestEntity.headers.entrySet()) {
      buffer.append("String_Node_Str").append(header.getKey()).append("String_Node_Str").append(header.getValue()).append("String_Node_Str");
    }
  }
  if (credencials != null) {
    buffer.append("String_Node_Str").append(credencials.getUserPrincipal().getName()).append("String_Node_Str").append(credencials.getPassword());
  }
  if (includeBody) {
    buffer.append("String_Node_Str");
  }
  buffer.append("String_Node_Str").append(url).append("String_Node_Str");
  if (includeBody) {
    buffer.append("String_Node_Str");
    buffer.append(requestEntity.bodyText);
    buffer.append("String_Node_Str");
    buffer.append("String_Node_Str");
  }
  logger.debug("String_Node_Str",buffer);
}
Program: 32857
Project: 32857
Buggy source:
@Override public long getKeepAliveDuration(HttpResponse response,HttpContext context){
  HeaderElementIterator it=new BasicHeaderElementIterator(response.headerIterator(HTTP.CONN_KEEP_ALIVE));
  while (it.hasNext()) {
    HeaderElement he=it.nextElement();
    String param=he.getName();
    String value=he.getValue();
    if (value != null && "String_Node_Str".equalsIgnoreCase(param)) {
      try {
        return Long.parseLong(value) * 1000L;
      }
 catch (      NumberFormatException ignore) {
      }
    }
  }
  return 30L * 1000L;
}

Fixed version (ground truth):
private long getKeepAliveDuration(HttpResponse response){
  HeaderElementIterator it=new BasicHeaderElementIterator(response.headerIterator(HTTP.CONN_KEEP_ALIVE));
  while (it.hasNext()) {
    HeaderElement he=it.nextElement();
    String param=he.getName();
    String value=he.getValue();
    if (value != null && "String_Node_Str".equalsIgnoreCase(param)) {
      try {
        return Long.parseLong(value) * 1000L;
      }
 catch (      NumberFormatException ignore) {
      }
    }
  }
  return 30L * 1000L;
}
Program: 32859
Project: 32859
Buggy source:
AqlFunctionsEntity(Map<String,String> aqlfunctions){
  this.aqlFunctions=aqlfunctions;
}

Fixed version (ground truth):
public AqlFunctionsEntity(Map<String,String> aqlfunctions){
  this.aqlFunctions=aqlfunctions;
}
Program: 32860
Project: 32860
Buggy source:
public ImportResultEntity importRawJsonDocuments(String collectionName,boolean createCollection,Iterator<String> itr,int bufferCount) throws ArangoException {
  if (bufferCount <= 0) {
    bufferCount=DEFAULT_IMPORT_BUFFER_SIZE;
  }
  ImportResultEntity total=new ImportResultEntity();
  ArrayList<String> buffers=new ArrayList<String>(bufferCount);
  while (itr.hasNext()) {
    buffers.add(itr.next());
    if (buffers.size() % bufferCount == 0) {
      importDocumentsImpl(collectionName,createCollection,buffers,total);
      buffers.clear();
    }
  }
  if (!buffers.isEmpty()) {
    importDocumentsImpl(collectionName,createCollection,buffers,total);
  }
  return total;
}

Fixed version (ground truth):
public ImportResultEntity importRawJsonDocuments(String collectionName,boolean createCollection,Iterator<String> itr,int bufferCount) throws ArangoException {
  int tmpBufferCount=bufferCount;
  if (tmpBufferCount <= 0) {
    tmpBufferCount=DEFAULT_IMPORT_BUFFER_SIZE;
  }
  ImportResultEntity total=new ImportResultEntity();
  ArrayList<String> buffers=new ArrayList<String>(tmpBufferCount);
  while (itr.hasNext()) {
    buffers.add(itr.next());
    if (buffers.size() % tmpBufferCount == 0) {
      importDocumentsImpl(collectionName,createCollection,buffers,total);
      buffers.clear();
    }
  }
  if (!buffers.isEmpty()) {
    importDocumentsImpl(collectionName,createCollection,buffers,total);
  }
  return total;
}
Program: 32862
Project: 32862
Buggy source:
/** 
 * Returns all Edges of a given vertex.
 * @param graphName
 * @param clazz
 * @param vertexDocumentHandle
 * @return a CursorEntity object
 * @throws ArangoException
 * @deprecated As of release 2.5.4, replaced by{@link #graphGetEdgeCursor(String,Class,Object,GraphEdgesOptions,AqlQueryOptions)}
 */
@Deprecated public <T>CursorEntity<T> graphGetEdges(String graphName,Class<T> clazz,String vertexDocumentHandle) throws ArangoException {
  validateCollectionName(graphName);
  String query="String_Node_Str";
  Map<String,Object> bindVars=new MapBuilder().put("String_Node_Str",graphName).put("String_Node_Str",vertexDocumentHandle).get();
  CursorEntity<T> result=this.executeQuery(query,bindVars,clazz,true,20);
  return result;
}

Fixed version (ground truth):
/** 
 * Returns all Edges of a given vertex.
 * @param graphName
 * @param clazz
 * @param vertexDocumentHandle
 * @return a CursorEntity object
 * @throws ArangoException
 * @deprecated As of release 2.5.4, replaced by{@link #graphGetEdgeCursor(String,Class,Object,GraphEdgesOptions,AqlQueryOptions)}
 */
@Deprecated public <T>CursorEntity<T> graphGetEdges(String graphName,Class<T> clazz,String vertexDocumentHandle) throws ArangoException {
  validateCollectionName(graphName);
  String query="String_Node_Str";
  Map<String,Object> bindVars=new MapBuilder().put("String_Node_Str",graphName).put("String_Node_Str",vertexDocumentHandle).get();
  return this.executeQuery(query,bindVars,clazz,true,20);
}
Program: 32863
Project: 32863
Buggy source:
/** 
 * Create an edge in an edge collection.
 * @param graphName the graph name
 * @param collectionName name of the edge collection
 * @param object the edge object
 * @param from id of document 'from'
 * @param to id of document 'to'
 * @param createCollection if true, the collection will be created if it does not exists
 * @param waitForSync wait for sync
 * @return the new created EdgeEntity object
 * @throws ArangoException
 */
public <T>EdgeEntity<T> createEdge(String graphName,String collectionName,T object,String from,String to,Boolean createCollection,Boolean waitForSync) throws ArangoException {
  return this.edgeDriver.createEdge(graphName,collectionName,object,from,to,createCollection,waitForSync);
}

Fixed version (ground truth):
/** 
 * Create an edge in an edge collection.
 * @param collectionName name of the edge collection
 * @param object the edge object
 * @param from id of document 'from'
 * @param to id of document 'to'
 * @param createCollection if true, the collection will be created if it does not exists
 * @param waitForSync wait for sync
 * @return the new created EdgeEntity object
 * @throws ArangoException
 */
public <T>EdgeEntity<T> createEdge(String collectionName,T object,String from,String to,Boolean createCollection,Boolean waitForSync) throws ArangoException {
  return this.edgeDriver.createEdge(getDefaultDatabase(),collectionName,object,from,to,createCollection,waitForSync);
}
Program: 32864
Project: 32864
Buggy source:
@Override public <T>EdgeEntity<T> createEdge(String graphName,String collectionName,T object,String from,String to,Boolean createCollection,Boolean waitForSync) throws ArangoException {
  Map<String,Object> params=new MapBuilder().put("String_Node_Str",collectionName).put("String_Node_Str",from).put("String_Node_Str",to).put("String_Node_Str",createCollection).put("String_Node_Str",waitForSync).get();
  String body=EntityFactory.toJsonString(object);
  HttpResponseEntity response=httpManager.doPost(createEndpointUrl(graphName,"String_Node_Str"),params,body);
  @SuppressWarnings("String_Node_Str") EdgeEntity<T> edgeEntity=createEntity(response,EdgeEntity.class);
  edgeEntity.setEntity(object);
  return edgeEntity;
}

Fixed version (ground truth):
@Override public <T>EdgeEntity<T> createEdge(String database,String collectionName,T object,String from,String to,Boolean createCollection,Boolean waitForSync) throws ArangoException {
  Map<String,Object> params=new MapBuilder().put("String_Node_Str",collectionName).put("String_Node_Str",from).put("String_Node_Str",to).put("String_Node_Str",createCollection).put("String_Node_Str",waitForSync).get();
  String body=EntityFactory.toJsonString(object);
  HttpResponseEntity response=httpManager.doPost(createEndpointUrl(database,"String_Node_Str"),params,body);
  @SuppressWarnings("String_Node_Str") EdgeEntity<T> edgeEntity=createEntity(response,EdgeEntity.class);
  edgeEntity.setEntity(object);
  return edgeEntity;
}
Program: 32865
Project: 32865
Buggy source:
@Test public void test_create_normal() throws ArangoException {
  TestComplexEntity01 value=new TestComplexEntity01("String_Node_Str","String_Node_Str",42);
  DocumentEntity<TestComplexEntity01> fromDoc=driver.createDocument(collectionName2,value,true,true);
  DocumentEntity<TestComplexEntity01> toDoc=driver.createDocument(collectionName2,value,true,true);
  EdgeEntity<TestComplexEntity01> doc=driver.createEdge(DATABASE_NAME,collectionName,value,fromDoc.getDocumentHandle(),toDoc.getDocumentHandle(),true,true);
  assertThat(doc.getDocumentKey(),is(notNullValue()));
  assertThat(doc.getDocumentHandle(),is(collectionName + "String_Node_Str" + doc.getDocumentKey()));
  assertThat(doc.getDocumentRevision(),is(not(0L)));
}

Fixed version (ground truth):
@Test public void test_create_normal() throws ArangoException {
  TestComplexEntity01 value=new TestComplexEntity01("String_Node_Str","String_Node_Str",42);
  DocumentEntity<TestComplexEntity01> fromDoc=driver.createDocument(collectionName2,value,true,true);
  DocumentEntity<TestComplexEntity01> toDoc=driver.createDocument(collectionName2,value,true,true);
  EdgeEntity<TestComplexEntity01> doc=driver.createEdge(collectionName,value,fromDoc.getDocumentHandle(),toDoc.getDocumentHandle(),true,true);
  assertThat(doc.getDocumentKey(),is(notNullValue()));
  assertThat(doc.getDocumentHandle(),is(collectionName + "String_Node_Str" + doc.getDocumentKey()));
  assertThat(doc.getDocumentRevision(),is(not(0L)));
}
Program: 32866
Project: 32866
Buggy source:
/** 
 * get a single edge definition identified by its edge collection name
 * @param collectionName the name of the edge collection
 * @return the adjacent edgeDefinition or null, if no match
 */
public EdgeDefinitionEntity getEdgeDefinition(String collectionName){
  for (  EdgeDefinitionEntity edgeDefintion : this.edgeDefinitions) {
    if (edgeDefintion.getCollection() == collectionName) {
      return edgeDefintion;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * get a single edge definition identified by its edge collection name
 * @param collectionName the name of the edge collection
 * @return the adjacent edgeDefinition or null, if no match
 */
public EdgeDefinitionEntity getEdgeDefinition(String collectionName){
  for (  EdgeDefinitionEntity edgeDefintion : this.edgeDefinitions) {
    if (edgeDefintion.getCollection().equals(collectionName)) {
      return edgeDefintion;
    }
  }
  return null;
}
Program: 32868
Project: 32868
Buggy source:
@Parameters() public static Collection<Object[]> getParameterizedDrivers(){
  String database="String_Node_Str";
  ArangoConfigure configure=new ArangoConfigure();
  configure.init();
  ArangoDriver driver=new ArangoDriver(configure);
  ArangoDriver driverMDB=new ArangoDriver(configure,database);
  try {
    driver.createDatabase(database);
  }
 catch (  ArangoException e) {
  }
  List<Object[]> result=new ArrayList<Object[]>();
  result.add(new Object[]{configure,driverMDB});
  return result;
}

Fixed version (ground truth):
@Parameters() public static Collection<Object[]> getParameterizedDrivers(){
  ArangoConfigure configure=new ArangoConfigure();
  configure.init();
  ArangoDriver driver=new ArangoDriver(configure);
  ArangoDriver driverMDB=new ArangoDriver(configure,databaseName);
  try {
    driver.createDatabase(databaseName);
  }
 catch (  ArangoException e) {
  }
  List<Object[]> result=new ArrayList<Object[]>();
  result.add(new Object[]{configure,driverMDB});
  return result;
}
Program: 32869
Project: 32869
Buggy source:
public void setEdgeDefinitions(List<EdgeDefinitionEntity> edgeDefinitions){
  this.edgeDefinitions=edgeDefinitions;
}

Fixed version (ground truth):
/** 
 * set the edge definitions (overwrites existing edge definitions)
 * @param edgeDefinitions the edge definitions to be set
 */
public void setEdgeDefinitions(List<EdgeDefinitionEntity> edgeDefinitions){
  this.edgeDefinitions=edgeDefinitions;
  this.evalEdgeCollections();
}
Program: 32870
Project: 32870
Buggy source:
public void addEdgeDefinition(EdgeDefinitionEntity edgeDefinition){
  this.edgeDefinitions.add(edgeDefinition);
}

Fixed version (ground truth):
/** 
 * add a single edge definition
 * @param edgeDefinition the edge definition to be added
 * @throws ArangoException
 */
public void addEdgeDefinition(EdgeDefinitionEntity edgeDefinition){
  if (!this.edgeCollections.contains(edgeDefinition.getCollection())) {
    this.edgeDefinitions.add(edgeDefinition);
    this.edgeCollections.add(edgeDefinition.getCollection());
  }
}
Program: 32871
Project: 32871
Buggy source:
public List<EdgeDefinitionEntity> getEdgeDefinitions(){
  return edgeDefinitions;
}

Fixed version (ground truth):
/** 
 * get all edge definitions
 * @return
 */
public List<EdgeDefinitionEntity> getEdgeDefinitions(){
  return edgeDefinitions;
}
Program: 32872
Project: 32872
Buggy source:
public void setEdgeDefinitions(List<EdgeDefinitionEntity> edgeDefinitions){
  this.edgeDefinitions=edgeDefinitions;
}

Fixed version (ground truth):
public void setEdgeDefinitions(List<EdgeDefinitionEntity> edgeDefinitions){
  this.edgeDefinitionsEntity.setEdgeDefinitions(edgeDefinitions);
}
Program: 32873
Project: 32873
Buggy source:
public List<EdgeDefinitionEntity> getEdgeDefinitions(){
  return edgeDefinitions;
}

Fixed version (ground truth):
public List<EdgeDefinitionEntity> getEdgeDefinitions(){
  return edgeDefinitionsEntity.getEdgeDefinitions();
}
Program: 32876
Project: 32876
Buggy source:
@Test public void test_getGraph() throws ArangoException {
  driver.createGraph(this.graphName,this.createEdgeDefinitions(2,0),this.createOrphanCollections(2),true);
  GraphEntity graph=driver.getGraph(this.graphName);
  assertThat(graph.getOrphanCollections().size(),is(2));
  assertThat(graph.getName(),is(this.graphName));
  assertThat(graph.getEdgeDefinitions().size(),is(2));
  assertThat(graph.getEdgeDefinitions().get(0).getCollection().startsWith("String_Node_Str"),is(true));
}

Fixed version (ground truth):
@Test public void test_getGraph() throws ArangoException {
  driver.createGraph(this.graphName,this.createEdgeDefinitions(2,0),this.createOrphanCollections(2),true);
  GraphEntity graph=driver.getGraph(this.graphName);
  assertThat(graph.getEdgeDefinitionsEntity().getEdgeDefinitions().get(0).getClass().getName(),is(EdgeDefinitionEntity.class.getName()));
  assertThat(graph.getEdgeDefinitionsEntity().getEdgeDefinitions().get(0).getFrom().size(),is(3));
  assertThat(graph.getOrphanCollections().size(),is(2));
  assertThat(graph.getName(),is(this.graphName));
  assertThat(graph.getEdgeDefinitionsEntity().getSize(),is(2));
  assertThat(graph.getEdgeDefinitionsEntity().getEdgeDefinitions().get(0).getCollection().startsWith("String_Node_Str"),is(true));
}
Program: 32877
Project: 32877
Buggy source:
/** 
 * This method enables batch execution. Until 'cancelBatchMode' or 'executeBatch' is called every other call is stacked and will be either executed or discarded when the batch mode is canceled. Each call will return a 'requestId' in the http response, that can be used to select the matching result from the batch execution.
 * @see com.arangodb.ArangoDriver#cancelBatchMode()
 * @see ArangoDriver#executeBatch()
 * @see ArangoDriver#getBatchResponseByRequestId(String)
 * @throws com.arangodb.ArangoException
 */
public void startBatchMode() throws ArangoException {
  if (this.httpManager.isBatchModeActive()) {
    throw new ArangoException("String_Node_Str");
  }
  this.httpManager.setBatchModeActive(true);
  this.createModuleDrivers(true);
}

Fixed version (ground truth):
/** 
 * This method enables batch execution. Until 'cancelBatchMode' or 'executeBatch' is called every other call is stacked and will be either executed or discarded when the batch mode is canceled. Each call will return a 'requestId' in the http response, that can be used to select the matching result from the batch execution.
 * @see com.arangodb.ArangoDriver#cancelBatchMode()
 * @see ArangoDriver#executeBatch()
 * @see ArangoDriver#getBatchResponseByRequestId(String)
 * @throws com.arangodb.ArangoException
 */
public void startBatchMode() throws ArangoException {
  if (this.httpManager.isBatchModeActive()) {
    throw new ArangoException("String_Node_Str");
  }
  this.httpManager.emptyCallStack();
  this.httpManager.setBatchModeActive(true);
  this.createModuleDrivers(true);
}
Program: 32878
Project: 32878
Buggy source:
/** 
 * This method returns the result of a call to ArangoDB executed within a batch request.
 * @param String the id of a request.
 * @return <T> - A generic return value, containing the result.
 * @see ArangoDriver#startBatchMode()
 * @see ArangoDriver#executeBatch()
 * @see com.arangodb.ArangoDriver#cancelBatchMode()
 * @throws com.arangodb.ArangoException
 */
public <T>T getBatchResponseByRequestId(String requestId) throws ArangoException {
  BatchResponseEntity batchResponseEntity=this.batchDriver.getBatchResponseListEntity().getResponseFromRequestId(requestId);
  try {
    this.httpManager.setPreDefinedResponse(batchResponseEntity.getHttpResponseEntity());
    return (T)batchResponseEntity.getInvocationObject().getMethod().invoke(batchResponseEntity.getInvocationObject().getArangoDriver(),batchResponseEntity.getInvocationObject().getArgs());
  }
 catch (  InvocationTargetException e) {
    return (T)createEntity(batchResponseEntity.getHttpResponseEntity(),(Class)DefaultEntity.class);
  }
catch (  Exception e) {
    throw new ArangoException(e);
  }
}

Fixed version (ground truth):
/** 
 * This method returns the result of a call to ArangoDB executed within a batch request.
 * @param String the id of a request.
 * @return <T> - A generic return value, containing the result.
 * @see ArangoDriver#startBatchMode()
 * @see ArangoDriver#executeBatch()
 * @see com.arangodb.ArangoDriver#cancelBatchMode()
 * @throws com.arangodb.ArangoException
 */
public <T>T getBatchResponseByRequestId(String requestId) throws ArangoException {
  BatchResponseEntity batchResponseEntity=this.batchDriver.getBatchResponseListEntity().getResponseFromRequestId(requestId);
  try {
    this.httpManager.setPreDefinedResponse(batchResponseEntity.getHttpResponseEntity());
    T result=(T)batchResponseEntity.getInvocationObject().getMethod().invoke(batchResponseEntity.getInvocationObject().getArangoDriver(),batchResponseEntity.getInvocationObject().getArgs());
    this.httpManager.setPreDefinedResponse(null);
    return result;
  }
 catch (  InvocationTargetException e) {
    T result=(T)createEntity(batchResponseEntity.getHttpResponseEntity(),(Class)DefaultEntity.class);
    this.httpManager.setPreDefinedResponse(null);
    return result;
  }
catch (  Exception e) {
    this.httpManager.setPreDefinedResponse(null);
    throw new ArangoException(e);
  }
}