nus-yam/ex-repair huggingface dataset:
Program: 34955
Project: 34955
Buggy source:
private ContentValues collectToOneAssociatedValuesAndSaveAssociatedObjects(final Object data,EntityData entityData,final int currentDepth){
  ContentValues contentValuesForeignKeys=new ContentValues(0);
  if (currentDepth >= maxDepth) {
    return contentValuesForeignKeys;
  }
  for (  Field toOneAssociatedField : entityData.toOneAssociations) {
    toOneAssociatedField.setAccessible(true);
    Object associatedObject=getFieldValue(data,toOneAssociatedField);
    if (associatedObject != null) {
      if (newUnsavedObjects.contains(associatedObject)) {
        Collection<ToOneUpdate> collection=toOneUpdaters.get(data);
        if (collection == null) {
          collection=new ArrayList<DatabaseSaver.ToOneUpdate>();
          toOneUpdaters.put(data,collection);
        }
        collection.add(new ToOneUpdate(SchemaConstants.FOREIGN_KEY + toOneAssociatedField.getName(),associatedObject));
      }
 else {
        int associationId=save(associatedObject,currentDepth + 1);
        contentValuesForeignKeys.put(SchemaConstants.FOREIGN_KEY + toOneAssociatedField.getName(),associationId);
      }
    }
 else {
      contentValuesForeignKeys.putNull(SchemaConstants.FOREIGN_KEY + toOneAssociatedField.getName());
    }
  }
  return contentValuesForeignKeys;
}

Fixed version (ground truth):
private ContentValues collectToOneAssociatedValuesAndSaveAssociatedObjects(final Object data,EntityData entityData,final int currentDepth){
  ContentValues contentValuesForeignKeys=new ContentValues(0);
  if (currentDepth >= maxDepth) {
    if (entityData.autoIncrement) {
      return contentValuesForeignKeys;
    }
 else {
      return resolveExistingForeignKeyValues(data,entityData);
    }
  }
  for (  Field toOneAssociatedField : entityData.toOneAssociations) {
    toOneAssociatedField.setAccessible(true);
    Object associatedObject=getFieldValue(data,toOneAssociatedField);
    if (associatedObject != null) {
      if (newUnsavedObjects.contains(associatedObject)) {
        Collection<ToOneUpdate> collection=toOneUpdaters.get(data);
        if (collection == null) {
          collection=new ArrayList<DatabaseSaver.ToOneUpdate>();
          toOneUpdaters.put(data,collection);
        }
        collection.add(new ToOneUpdate(SchemaConstants.FOREIGN_KEY + toOneAssociatedField.getName(),associatedObject));
      }
 else {
        int associationId=save(associatedObject,currentDepth + 1);
        contentValuesForeignKeys.put(SchemaConstants.FOREIGN_KEY + toOneAssociatedField.getName(),associationId);
      }
    }
 else {
      contentValuesForeignKeys.putNull(SchemaConstants.FOREIGN_KEY + toOneAssociatedField.getName());
    }
  }
  return contentValuesForeignKeys;
}
Program: 34956
Project: 34956
Buggy source:
@Test public void testSaveAndLoadToOneWithDepth1(){
  Comment c1=new Comment("String_Node_Str");
  EntityService<Comment> entityService=entityService(Comment.class);
  entityService.save(newArrayList(c1));
  assertInsertsAndUpdatesAmountToDB(1,0);
  Comment comment=entityService.get(c1.getId());
  assertThat(comment.getAuthor()).isNull();
  Author a=new Author();
  a.setName("String_Node_Str");
  Comment c2=new Comment("String_Node_Str");
  a.setComments(newArrayList(c1,c2));
  c1.setAuthor(a);
  c2.setAuthor(a);
  entityService.save(c1,1);
  assertInsertsAndUpdatesAmountToDB(1,1);
  assertThat(entityService.get()).hasSize(1);
  Comment savedComment=entityService.get(c1.getId());
  assertThat(savedComment.getAuthor()).isNull();
  entityService.resolveAssociations(savedComment,1);
  Author savedAuthor=savedComment.getAuthor();
  assertThat(savedAuthor).isNotNull();
  assertThat(savedAuthor.getComments()).isNull();
  assertThat(savedAuthor.getTexts()).isNull();
}

Fixed version (ground truth):
@Test public void testSaveAndLoadToOneWithDepth1(){
  Comment c1=new Comment("String_Node_Str");
  EntityService<Comment> entityService=entityService(Comment.class);
  entityService.save(newArrayList(c1));
  assertInsertsAndUpdatesAmountToDB(1,0);
  Comment comment=entityService.get(c1.getId());
  assertThat(comment.getAuthor()).isNull();
  Author a=new Author();
  a.setName("String_Node_Str");
  Comment c2=new Comment("String_Node_Str");
  a.setComments(newArrayList(c1,c2));
  c1.setAuthor(a);
  c2.setAuthor(a);
  entityService.save(c1,1);
  assertInsertsAndUpdatesAmountToDB(1,1);
  assertThat(entityService.get()).hasSize(1);
  Integer id=c1.getId();
  Comment savedComment=entityService.get(id);
  assertThat(savedComment.getAuthor()).isNull();
  entityService.save(savedComment,0);
  savedComment=entityService.get(id);
  assertThat(savedComment.getAuthor()).isNull();
  entityService.resolveAssociations(savedComment,1);
  Author savedAuthor=savedComment.getAuthor();
  assertThat(savedAuthor).isNotNull();
  assertThat(savedAuthor.getComments()).isNull();
  assertThat(savedAuthor.getTexts()).isNull();
}
Program: 34958
Project: 34958
Buggy source:
@SuppressWarnings("String_Node_Str") private List<Attribute<?,?>> sortInAscendingOrder(final Set<?> jpaAttributes){
  List<Attribute<?,?>> jpaAttributeList=new ArrayList<Attribute<?,?>>();
  Iterator itr=null;
  Attribute<?,?> smallestJpaAttribute;
  Attribute<?,?> currentJpaAttribute;
  while (!jpaAttributes.isEmpty()) {
    itr=jpaAttributes.iterator();
    smallestJpaAttribute=(Attribute<?,?>)itr.next();
    while (itr.hasNext()) {
      currentJpaAttribute=(Attribute<?,?>)itr.next();
      if (smallestJpaAttribute.getName().compareTo(currentJpaAttribute.getName()) > 0) {
        smallestJpaAttribute=currentJpaAttribute;
      }
    }
    jpaAttributeList.add(smallestJpaAttribute);
    jpaAttributes.remove(smallestJpaAttribute);
  }
  return jpaAttributeList;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private List<Attribute<?,?>> sortInAscendingOrder(final Set<?> jpaAttributes){
  List<Attribute<?,?>> jpaAttributeList=new ArrayList<Attribute<?,?>>();
  Attribute<?,?> smallestJpaAttribute;
  Attribute<?,?> currentJpaAttribute;
  while (!jpaAttributes.isEmpty()) {
    Iterator itr=jpaAttributes.iterator();
    smallestJpaAttribute=(Attribute<?,?>)itr.next();
    while (itr.hasNext()) {
      currentJpaAttribute=(Attribute<?,?>)itr.next();
      if (smallestJpaAttribute.getName().compareTo(currentJpaAttribute.getName()) > 0) {
        smallestJpaAttribute=currentJpaAttribute;
      }
    }
    jpaAttributeList.add(smallestJpaAttribute);
    jpaAttributes.remove(smallestJpaAttribute);
  }
  return jpaAttributeList;
}
Program: 34959
Project: 34959
Buggy source:
/** 
 * Gets the root URI of this service.
 * @return absolute base URI of the request
 */
URI getServiceRoot();

Fixed version (ground truth):
/** 
 * Gets the root URI of this service. This includes any segments which can be found in the preceding segments list.
 * @return absolute base URI of the request
 */
URI getServiceRoot();
Program: 34960
Project: 34960
Buggy source:
private String getBaseUri(final ODataRequest request){
  String baseUri=request.getPathInfo().getServiceRoot().toASCIIString();
  if (baseUri.endsWith("String_Node_Str")) {
    baseUri=baseUri.substring(0,baseUri.length() - 1);
  }
  for (  PathSegment segment : request.getPathInfo().getPrecedingSegments()) {
    baseUri+="String_Node_Str" + segment.getPath();
  }
  return baseUri;
}

Fixed version (ground truth):
private String getBaseUri(final ODataRequest request){
  String baseUri=request.getPathInfo().getServiceRoot().toASCIIString();
  if (baseUri.endsWith("String_Node_Str")) {
    baseUri=baseUri.substring(0,baseUri.length() - 1);
  }
  return baseUri;
}
Program: 34961
Project: 34961
Buggy source:
private String getBaseUri() throws BatchException {
  String baseUri="String_Node_Str";
  if (batchRequestPathInfo != null && batchRequestPathInfo.getServiceRoot() != null) {
    final String uri=batchRequestPathInfo.getServiceRoot().toASCIIString();
    baseUri=addPathSegements(removeLastSlash(uri));
  }
  return baseUri;
}

Fixed version (ground truth):
private String getBaseUri() throws BatchException {
  String baseUri="String_Node_Str";
  if (batchRequestPathInfo != null && batchRequestPathInfo.getServiceRoot() != null) {
    final String uri=batchRequestPathInfo.getServiceRoot().toASCIIString();
    baseUri=removeLastSlash(uri);
  }
  return baseUri;
}
Program: 34962
Project: 34962
Buggy source:
/** 
 * Create a   {@link CircleStreamBuffer} with given buffer size in bytes.
 * @param bufferSize
 */
public CircleStreamBuffer(final int bufferSize){
  currentAllocateCapacity=bufferSize;
  createNewWriteBuffer();
  inStream=new InternalInputStream(this);
  outStream=new InternalOutputStream(this);
}

Fixed version (ground truth):
/** 
 * Create a   {@link CircleStreamBuffer} with given initial buffer size.
 * @param initialCapacity initial capacity of internal buffer
 */
public CircleStreamBuffer(final int initialCapacity){
  currentAllocateCapacity=initialCapacity;
  createNewWriteBuffer();
  inStream=new InternalInputStream(this);
  outStream=new InternalOutputStream(this);
}
Program: 34963
Project: 34963
Buggy source:
/** 
 * @param requestedCapacity
 * @return the buffer
 */
private ByteBuffer allocateBuffer(final int requestedCapacity){
  int allocateCapacity=requestedCapacity;
  if (allocateCapacity < currentAllocateCapacity) {
    allocateCapacity=currentAllocateCapacity * NEW_BUFFER_RESIZE_FACTOR;
  }
  if (allocateCapacity > MAX_CAPACITY) {
    allocateCapacity=MAX_CAPACITY;
  }
  currentAllocateCapacity=allocateCapacity;
  return ByteBuffer.allocate(allocateCapacity);
}

Fixed version (ground truth):
/** 
 * Allocate a new buffer with requested capacity
 * @param requestedCapacity minimal capacity of new buffer
 * @return the buffer
 */
private ByteBuffer allocateBuffer(final int requestedCapacity){
  if (requestedCapacity > MAX_CAPACITY) {
    currentAllocateCapacity=MAX_CAPACITY;
    return ByteBuffer.allocate(requestedCapacity);
  }
  if (requestedCapacity <= currentAllocateCapacity) {
    currentAllocateCapacity*=NEW_BUFFER_RESIZE_FACTOR;
    if (currentAllocateCapacity > MAX_CAPACITY) {
      currentAllocateCapacity=MAX_CAPACITY;
    }
  }
 else {
    currentAllocateCapacity=requestedCapacity;
  }
  return ByteBuffer.allocate(currentAllocateCapacity);
}
Program: 34964
Project: 34964
Buggy source:
private String readFrom(final InputStream stream,final int bufferSize) throws IOException {
  StringBuilder b=new StringBuilder();
  int count;
  byte[] buffer=new byte[bufferSize];
  while ((count=stream.read(buffer)) >= 0) {
    b.append(new String(buffer,0,count));
  }
  return b.toString();
}

Fixed version (ground truth):
private String readFrom(final InputStream stream,final Charset charset,final int bufferSize) throws IOException {
  StringBuilder b=new StringBuilder();
  int count;
  byte[] buffer=new byte[bufferSize];
  while ((count=stream.read(buffer)) >= 0) {
    b.append(new String(buffer,0,count,charset));
  }
  return b.toString();
}
Program: 34966
Project: 34966
Buggy source:
public void append(final Writer writer,final EntityInfoAggregator entityInfo,final List<Map<String,Object>> deletedEntries) throws EntityProviderException {
  JsonStreamWriter jsonStreamWriter=new JsonStreamWriter(writer);
  try {
    if (deletedEntries.size() > 0) {
      jsonStreamWriter.separator();
      int counter=0;
      for (      Map<String,Object> deletedEntry : deletedEntries) {
        jsonStreamWriter.beginObject();
        String odataContextValue=JsonUtils.createODataContextValueForTombstone(entityInfo.getEntitySetName());
        String selfLink=AtomEntryEntityProducer.createSelfLink(entityInfo,deletedEntry,null);
        String idValue=properties.getServiceRoot().toASCIIString() + selfLink;
        jsonStreamWriter.namedStringValue(FormatJson.ODATA_CONTEXT,odataContextValue);
        jsonStreamWriter.separator();
        jsonStreamWriter.namedStringValue(FormatJson.ID,idValue);
        jsonStreamWriter.endObject();
        if (counter < deletedEntries.size() - 1) {
          jsonStreamWriter.separator();
        }
        counter++;
      }
    }
  }
 catch (  final IOException e) {
    throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()),e);
  }
}

Fixed version (ground truth):
public void append(final Writer writer,final EntityInfoAggregator entityInfo,final List<Map<String,Object>> deletedEntries,boolean noPreviousEntries) throws EntityProviderException {
  JsonStreamWriter jsonStreamWriter=new JsonStreamWriter(writer);
  try {
    if (deletedEntries.size() > 0) {
      if (!noPreviousEntries) {
        jsonStreamWriter.separator();
      }
      int counter=0;
      for (      Map<String,Object> deletedEntry : deletedEntries) {
        jsonStreamWriter.beginObject();
        String odataContextValue=JsonUtils.createODataContextValueForTombstone(entityInfo.getEntitySetName());
        String selfLink=AtomEntryEntityProducer.createSelfLink(entityInfo,deletedEntry,null);
        String idValue=properties.getServiceRoot().toASCIIString() + selfLink;
        jsonStreamWriter.namedStringValue(FormatJson.ODATA_CONTEXT,odataContextValue);
        jsonStreamWriter.separator();
        jsonStreamWriter.namedStringValue(FormatJson.ID,idValue);
        jsonStreamWriter.endObject();
        if (counter < deletedEntries.size() - 1) {
          jsonStreamWriter.separator();
        }
        counter++;
      }
    }
  }
 catch (  final IOException e) {
    throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()),e);
  }
}
Program: 34968
Project: 34968
Buggy source:
@Test public void testGetEdmAssociation(){
  assertNotNull(objAssociation.getEdmAssociation());
  assertEquals(objAssociation.getEdmAssociation().getName(),ASSOCIATION_NAME);
}

Fixed version (ground truth):
@Test public void testGetEdmAssociation(){
  assertNotNull(objAssociation.getEdmAssociation());
  assertEquals(ASSOCIATION_NAME,objAssociation.getEdmAssociation().getName());
}
Program: 34969
Project: 34969
Buggy source:
private boolean checkDebugMode(final Map<String,String> queryParameters){
  final ODataDebugCallback callback=getServiceFactory().getCallback(ODataDebugCallback.class);
  return callback == null ? getQueryDebugValue(queryParameters) != null : callback.isDebugEnabled();
}

Fixed version (ground truth):
private boolean checkDebugMode(final Map<String,String> queryParameters){
  final ODataDebugCallback callback=getServiceFactory().getCallback(ODataDebugCallback.class);
  if (callback != null) {
    return callback.isDebugEnabled();
  }
  return false;
}
Program: 34970
Project: 34970
Buggy source:
public void startServer(final ODataService service){
  startServer(FitStaticServiceFactory.class);
  if ((server != null) && server.isStarted()) {
    FitStaticServiceFactory.bindService(this,service);
  }
}

Fixed version (ground truth):
public void startServer(final ODataService service,Class<? extends FitStaticServiceFactory> clazz){
  startServer(clazz);
  if ((server != null) && server.isStarted()) {
    FitStaticServiceFactory.bindService(this,service);
  }
}
Program: 34971
Project: 34971
Buggy source:
private Object readEntity(final Object uriParserResultView,final JPQLContextType contextType) throws ODataJPAModelException, ODataJPARuntimeException {
  Object selectedObject=null;
  if (uriParserResultView instanceof DeleteUriInfo || uriParserResultView instanceof GetEntityUriInfo || uriParserResultView instanceof PutMergePatchUriInfo) {
    JPQLContext selectJPQLContext=JPQLContext.createBuilder(contextType,uriParserResultView).build();
    JPQLStatement selectJPQLStatement=JPQLStatement.createBuilder(selectJPQLContext).build();
    Query query=null;
    try {
      query=em.createQuery(selectJPQLStatement.toString());
      if (!query.getResultList().isEmpty()) {
        selectedObject=query.getResultList().get(0);
      }
    }
 catch (    IllegalArgumentException e) {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.ERROR_JPQL_QUERY_CREATE,e);
    }
  }
  return selectedObject;
}

Fixed version (ground truth):
private Object readEntity(final Object uriParserResultView,final JPQLContextType contextType) throws ODataJPAModelException, ODataJPARuntimeException {
  Object selectedObject=null;
  if (uriParserResultView instanceof DeleteUriInfo || uriParserResultView instanceof GetEntityUriInfo || uriParserResultView instanceof PutMergePatchUriInfo) {
    JPQLContext selectJPQLContext=JPQLContext.createBuilder(contextType,uriParserResultView).build();
    JPQLStatement selectJPQLStatement=JPQLStatement.createBuilder(selectJPQLContext).build();
    Query query=null;
    try {
      query=em.createQuery(selectJPQLStatement.toString());
      @SuppressWarnings("String_Node_Str") final List resultList=query.getResultList();
      if (!resultList.isEmpty()) {
        selectedObject=resultList.get(0);
      }
    }
 catch (    IllegalArgumentException e) {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.ERROR_JPQL_QUERY_CREATE,e);
    }
  }
  return selectedObject;
}
Program: 34974
Project: 34974
Buggy source:
private void appendChangeSet(final BatchChangeSet batchChangeSet){
  String boundary=BatchHelper.generateBoundary(BOUNDARY_PREAMBLE);
  while (boundary.equals(batchBoundary) || !boundary.matches(REG_EX_BOUNDARY)) {
    boundary=BatchHelper.generateBoundary(BOUNDARY_PREAMBLE);
  }
  writer.append(HttpHeaders.CONTENT_TYPE).append(COLON).append(SP).append(HttpContentType.MULTIPART_MIXED + "String_Node_Str" + boundary).append(LF);
  for (  BatchChangeSetPart request : batchChangeSet.getChangeSetParts()) {
    writer.append(LF).append("String_Node_Str").append(boundary).append(LF);
    appendRequestBodyPart(request.getMethod(),request.getUri(),request.getBody(),request.getHeaders(),request.getContentId());
  }
  writer.append(LF).append("String_Node_Str").append(boundary).append("String_Node_Str").append(LF);
}

Fixed version (ground truth):
private void appendChangeSet(final BatchChangeSet batchChangeSet){
  String boundary=BatchHelper.generateBoundary(BOUNDARY_PREAMBLE);
  while (boundary.equals(batchBoundary) || !boundary.matches(REG_EX_BOUNDARY)) {
    boundary=BatchHelper.generateBoundary(BOUNDARY_PREAMBLE);
  }
  writer.append(HttpHeaders.CONTENT_TYPE).append(COLON).append(SP).append(HttpContentType.MULTIPART_MIXED + "String_Node_Str" + boundary).append(CRLF);
  for (  BatchChangeSetPart request : batchChangeSet.getChangeSetParts()) {
    writer.append(CRLF).append("String_Node_Str").append(boundary).append(CRLF);
    appendRequestBodyPart(request.getMethod(),request.getUri(),request.getBody(),request.getHeaders(),request.getContentId());
  }
  writer.append(CRLF).append("String_Node_Str").append(boundary).append("String_Node_Str").append(CRLF);
}
Program: 34975
Project: 34975
Buggy source:
private void appendRequestBodyPart(final String method,final String uri,final String body,final Map<String,String> headers,final String contentId){
  boolean isContentLengthPresent=false;
  writer.append(HttpHeaders.CONTENT_TYPE).append(COLON).append(SP).append(HttpContentType.APPLICATION_HTTP).append(LF);
  writer.append(BatchHelper.HTTP_CONTENT_TRANSFER_ENCODING).append(COLON).append(SP).append(BatchHelper.BINARY_ENCODING).append(LF);
  if (contentId != null) {
    writer.append(BatchHelper.HTTP_CONTENT_ID).append(COLON).append(SP).append(contentId).append(LF);
  }
  String contentLength=getHeaderValue(headers,HttpHeaders.CONTENT_LENGTH);
  if (contentLength != null && !contentLength.isEmpty()) {
    isContentLengthPresent=true;
  }
  writer.append(LF);
  writer.append(method).append(SP).append(uri).append(SP).append(HTTP_1_1);
  writer.append(LF);
  if (!isContentLengthPresent && body != null && !body.isEmpty()) {
    writer.append(HttpHeaders.CONTENT_LENGTH).append(COLON).append(SP).append(BatchHelper.getBytes(body).length).append(LF);
  }
  appendHeader(headers);
  if (body != null && !body.isEmpty()) {
    writer.append(LF);
    writer.append(body);
  }
}

Fixed version (ground truth):
private void appendRequestBodyPart(final String method,final String uri,final String body,final Map<String,String> headers,final String contentId){
  boolean isContentLengthPresent=false;
  writer.append(HttpHeaders.CONTENT_TYPE).append(COLON).append(SP).append(HttpContentType.APPLICATION_HTTP).append(CRLF);
  writer.append(BatchHelper.HTTP_CONTENT_TRANSFER_ENCODING).append(COLON).append(SP).append(BatchHelper.BINARY_ENCODING).append(CRLF);
  if (contentId != null) {
    writer.append(BatchHelper.HTTP_CONTENT_ID).append(COLON).append(SP).append(contentId).append(CRLF);
  }
  String contentLength=getHeaderValue(headers,HttpHeaders.CONTENT_LENGTH);
  if (contentLength != null && !contentLength.isEmpty()) {
    isContentLengthPresent=true;
  }
  writer.append(CRLF);
  writer.append(method).append(SP).append(uri).append(SP).append(HTTP_1_1);
  writer.append(CRLF);
  if (!isContentLengthPresent && body != null && !body.isEmpty()) {
    writer.append(HttpHeaders.CONTENT_LENGTH).append(COLON).append(SP).append(BatchHelper.getBytes(body).length).append(CRLF);
  }
  appendHeader(headers);
  writer.append(CRLF);
  if (body != null && !body.isEmpty()) {
    writer.append(body);
  }
}
Program: 34976
Project: 34976
Buggy source:
public InputStream writeBatchRequest(final List<BatchPart> batchParts,final String boundary){
  if (boundary.matches(REG_EX_BOUNDARY)) {
    batchBoundary=boundary;
  }
 else {
    throw new IllegalArgumentException();
  }
  for (  BatchPart batchPart : batchParts) {
    writer.append("String_Node_Str").append(boundary).append(LF);
    if (batchPart instanceof BatchChangeSet) {
      appendChangeSet((BatchChangeSet)batchPart);
    }
 else     if (batchPart instanceof BatchQueryPart) {
      BatchQueryPart request=(BatchQueryPart)batchPart;
      appendRequestBodyPart(request.getMethod(),request.getUri(),null,request.getHeaders(),request.getContentId());
    }
  }
  writer.append(LF).append("String_Node_Str").append(boundary).append("String_Node_Str");
  InputStream batchRequestBody;
  batchRequestBody=new ByteArrayInputStream(BatchHelper.getBytes(writer.toString()));
  return batchRequestBody;
}

Fixed version (ground truth):
public InputStream writeBatchRequest(final List<BatchPart> batchParts,final String boundary){
  if (boundary.matches(REG_EX_BOUNDARY)) {
    batchBoundary=boundary;
  }
 else {
    throw new IllegalArgumentException();
  }
  for (  BatchPart batchPart : batchParts) {
    writer.append("String_Node_Str").append(boundary).append(CRLF);
    if (batchPart instanceof BatchChangeSet) {
      appendChangeSet((BatchChangeSet)batchPart);
    }
 else     if (batchPart instanceof BatchQueryPart) {
      BatchQueryPart request=(BatchQueryPart)batchPart;
      appendRequestBodyPart(request.getMethod(),request.getUri(),null,request.getHeaders(),request.getContentId());
    }
    writer.append(CRLF);
  }
  writer.append("String_Node_Str").append(boundary).append("String_Node_Str");
  InputStream batchRequestBody;
  batchRequestBody=new ByteArrayInputStream(BatchHelper.getBytes(writer.toString()));
  return batchRequestBody;
}
Program: 34977
Project: 34977
Buggy source:
private void appendHeader(final Map<String,String> headers){
  for (  Map.Entry<String,String> headerMap : headers.entrySet()) {
    String name=headerMap.getKey();
    writer.append(name).append(COLON).append(SP).append(headerMap.getValue()).append(LF);
  }
}

Fixed version (ground truth):
private void appendHeader(final Map<String,String> headers){
  for (  Map.Entry<String,String> headerMap : headers.entrySet()) {
    String name=headerMap.getKey();
    writer.append(name).append(COLON).append(SP).append(headerMap.getValue()).append(CRLF);
  }
}
Program: 34979
Project: 34979
Buggy source:
@Test public void testBatchWithGetAndPost() throws BatchException, IOException {
  List<BatchPart> batch=new ArrayList<BatchPart>();
  Map<String,String> headers=new HashMap<String,String>();
  headers.put("String_Node_Str","String_Node_Str");
  BatchPart request=BatchQueryPart.method(GET).uri("String_Node_Str").headers(headers).contentId("String_Node_Str").build();
  batch.add(request);
  Map<String,String> changeSetHeaders=new HashMap<String,String>();
  changeSetHeaders.put("String_Node_Str","String_Node_Str");
  String body="String_Node_Str";
  BatchChangeSetPart changeRequest=BatchChangeSetPart.method(POST).uri("String_Node_Str").body(body).headers(changeSetHeaders).contentId("String_Node_Str").build();
  BatchChangeSet changeSet=BatchChangeSet.newBuilder().build();
  changeSet.add(changeRequest);
  batch.add(changeSet);
  BatchRequestWriter writer=new BatchRequestWriter();
  InputStream batchRequest=writer.writeBatchRequest(batch,BOUNDARY);
  String requestBody=StringHelper.inputStreamToString(batchRequest);
  assertNotNull(batchRequest);
  checkMimeHeaders(requestBody);
  checkHeaders(headers,requestBody);
  checkHeaders(changeSetHeaders,requestBody);
  assertTrue(requestBody.contains("String_Node_Str"));
  assertTrue(requestBody.contains("String_Node_Str"));
  assertTrue(requestBody.contains(body));
}

Fixed version (ground truth):
@Test public void testBatchWithGetAndPost() throws BatchException, IOException {
  List<BatchPart> batch=new ArrayList<BatchPart>();
  Map<String,String> headers=new HashMap<String,String>();
  headers.put("String_Node_Str","String_Node_Str");
  BatchPart request=BatchQueryPart.method(GET).uri("String_Node_Str").headers(headers).contentId("String_Node_Str").build();
  batch.add(request);
  Map<String,String> changeSetHeaders=new HashMap<String,String>();
  changeSetHeaders.put("String_Node_Str","String_Node_Str");
  String body="String_Node_Str";
  BatchChangeSetPart changeRequest=BatchChangeSetPart.method(POST).uri("String_Node_Str").body(body).headers(changeSetHeaders).contentId("String_Node_Str").build();
  BatchChangeSet changeSet=BatchChangeSet.newBuilder().build();
  changeSet.add(changeRequest);
  batch.add(changeSet);
  BatchRequestWriter writer=new BatchRequestWriter();
  InputStream batchRequest=writer.writeBatchRequest(batch,BOUNDARY);
  String requestBody=StringHelper.inputStreamToString(batchRequest,true);
  assertNotNull(batchRequest);
  checkMimeHeaders(requestBody);
  checkHeaders(headers,requestBody);
  checkHeaders(changeSetHeaders,requestBody);
  assertTrue(requestBody.contains("String_Node_Str"));
  assertTrue(requestBody.contains("String_Node_Str"));
  assertTrue(requestBody.contains(body));
}
Program: 34980
Project: 34980
Buggy source:
@Test public void testBatchQueryPart() throws BatchException, IOException {
  List<BatchPart> batch=new ArrayList<BatchPart>();
  Map<String,String> headers=new HashMap<String,String>();
  headers.put("String_Node_Str","String_Node_Str");
  BatchPart request=BatchQueryPart.method(GET).uri("String_Node_Str").headers(headers).build();
  batch.add(request);
  BatchRequestWriter writer=new BatchRequestWriter();
  InputStream batchRequest=writer.writeBatchRequest(batch,BOUNDARY);
  String requestBody=StringHelper.toStream(batchRequest).asString();
  assertNotNull(batchRequest);
  checkMimeHeaders(requestBody);
  assertTrue(requestBody.contains("String_Node_Str"));
  assertTrue(requestBody.contains("String_Node_Str"));
  checkHeaders(headers,requestBody);
  assertEquals(8,StringHelper.countLines(requestBody));
}

Fixed version (ground truth):
@Test public void testBatchQueryPart() throws BatchException, IOException {
  List<BatchPart> batch=new ArrayList<BatchPart>();
  Map<String,String> headers=new HashMap<String,String>();
  headers.put("String_Node_Str","String_Node_Str");
  BatchPart request=BatchQueryPart.method(GET).uri("String_Node_Str").headers(headers).build();
  batch.add(request);
  BatchRequestWriter writer=new BatchRequestWriter();
  InputStream batchRequest=writer.writeBatchRequest(batch,BOUNDARY);
  String requestBody=StringHelper.toStream(batchRequest).asString();
  assertNotNull(batchRequest);
  checkMimeHeaders(requestBody);
  assertTrue(requestBody.contains("String_Node_Str"));
  assertTrue(requestBody.contains("String_Node_Str"));
  checkHeaders(headers,requestBody);
  assertEquals(9,StringHelper.countLines(requestBody));
}
Program: 34981
Project: 34981
Buggy source:
private static TreeSet<Accept> getAcceptTree(){
  TreeSet<Accept> treeSet=new TreeSet<Accept>(new Comparator<Accept>(){
    @Override public int compare(    final Accept o1,    final Accept o2){
      if (o1.getQuality() <= o2.getQuality()) {
        return 1;
      }
 else {
        return -1;
      }
    }
  }
);
  return treeSet;
}

Fixed version (ground truth):
private TreeSet<Accept> getAcceptTree(){
  TreeSet<Accept> treeSet=new TreeSet<Accept>(new Comparator<Accept>(){
    @Override public int compare(    final Accept o1,    final Accept o2){
      if (o1.getQuality() <= o2.getQuality()) {
        return 1;
      }
 else {
        return -1;
      }
    }
  }
);
  return treeSet;
}
Program: 34982
Project: 34982
Buggy source:
private static double getQualityFactor(final String acceptHeaderValue,double qualityFactor){
  int paramNumber=0;
  double typeFactor=0.0;
  double subtypeFactor=0.0;
  String[] mediaRange=acceptHeaderValue.split("String_Node_Str");
  String[] mediaTypes=mediaRange[0].split("String_Node_Str");
  if (mediaTypes.length == 2) {
    String type=mediaTypes[0];
    String subtype=mediaTypes[1];
    if (!ALL.equals(type)) {
      typeFactor=0.001;
    }
    if (!ALL.equals(subtype)) {
      subtypeFactor=0.001;
    }
  }
  if (mediaRange.length == 2) {
    String[] parameters=mediaRange[1].split("String_Node_Str");
    paramNumber=parameters.length;
  }
  qualityFactor=qualityFactor + paramNumber * QUALITY_PARAM_FACTOR + typeFactor + subtypeFactor;
  return qualityFactor;
}

Fixed version (ground truth):
private double getQualityFactor(final String acceptHeaderValue,double qualityFactor){
  int paramNumber=0;
  double typeFactor=0.0;
  double subtypeFactor=0.0;
  String[] mediaRange=acceptHeaderValue.split("String_Node_Str");
  String[] mediaTypes=mediaRange[0].split("String_Node_Str");
  if (mediaTypes.length == 2) {
    String type=mediaTypes[0];
    String subtype=mediaTypes[1];
    if (!ALL.equals(type)) {
      typeFactor=0.001;
    }
    if (!ALL.equals(subtype)) {
      subtypeFactor=0.001;
    }
  }
  if (mediaRange.length == 2) {
    String[] parameters=mediaRange[1].split("String_Node_Str");
    paramNumber=parameters.length;
  }
  qualityFactor=qualityFactor + paramNumber * QUALITY_PARAM_FACTOR + typeFactor + subtypeFactor;
  return qualityFactor;
}
Program: 34983
Project: 34983
Buggy source:
public static List<String> parseAcceptHeaders(final String headerValue) throws BatchException {
  TreeSet<Accept> acceptTree=getAcceptTree();
  List<String> acceptHeaders=new ArrayList<String>();
  Scanner acceptHeaderScanner=new Scanner(headerValue);
  acceptHeaderScanner.useDelimiter("String_Node_Str");
  while (acceptHeaderScanner.hasNext()) {
    if (acceptHeaderScanner.hasNext(REG_EX_ACCEPT_WITH_Q_FACTOR)) {
      acceptHeaderScanner.next(REG_EX_ACCEPT_WITH_Q_FACTOR);
      MatchResult result=acceptHeaderScanner.match();
      if (result.groupCount() == 2) {
        String acceptHeaderValue=result.group(1);
        double qualityFactor=result.group(2) != null ? Double.parseDouble(result.group(2)) : 1d;
        qualityFactor=getQualityFactor(acceptHeaderValue,qualityFactor);
        Accept acceptHeader=new Accept().setQuality(qualityFactor).setValue(acceptHeaderValue);
        acceptTree.add(acceptHeader);
      }
 else {
        String header=acceptHeaderScanner.next();
        acceptHeaderScanner.close();
        throw new BatchException(BatchException.INVALID_ACCEPT_HEADER.addContent(header),BAD_REQUEST);
      }
    }
 else {
      String header=acceptHeaderScanner.next();
      acceptHeaderScanner.close();
      throw new BatchException(BatchException.INVALID_ACCEPT_HEADER.addContent(header),BAD_REQUEST);
    }
  }
  for (  Accept accept : acceptTree) {
    acceptHeaders.add(accept.getValue());
  }
  acceptHeaderScanner.close();
  return acceptHeaders;
}

Fixed version (ground truth):
public List<String> parseAcceptHeaders() throws BatchException {
  final String headerValue=concatenateHeaderLines(acceptHeaderValues);
  final TreeSet<Accept> acceptTree=getAcceptTree();
  final List<String> acceptHeaders=new ArrayList<String>();
  final Scanner acceptHeaderScanner=new Scanner(headerValue);
  acceptHeaderScanner.useDelimiter("String_Node_Str");
  while (acceptHeaderScanner.hasNext()) {
    if (acceptHeaderScanner.hasNext(REG_EX_ACCEPT_WITH_Q_FACTOR)) {
      acceptHeaderScanner.next(REG_EX_ACCEPT_WITH_Q_FACTOR);
      MatchResult result=acceptHeaderScanner.match();
      if (result.groupCount() == 2) {
        String acceptHeaderValue=result.group(1);
        double qualityFactor=result.group(2) != null ? Double.parseDouble(result.group(2)) : 1d;
        qualityFactor=getQualityFactor(acceptHeaderValue,qualityFactor);
        Accept acceptHeader=new Accept().setQuality(qualityFactor).setValue(acceptHeaderValue);
        acceptTree.add(acceptHeader);
      }
 else {
        String header=acceptHeaderScanner.next();
        acceptHeaderScanner.close();
        throw new BatchException(BatchException.INVALID_ACCEPT_HEADER.addContent(header),BAD_REQUEST);
      }
    }
 else {
      String header=acceptHeaderScanner.next();
      acceptHeaderScanner.close();
      throw new BatchException(BatchException.INVALID_ACCEPT_HEADER.addContent(header),BAD_REQUEST);
    }
  }
  for (  Accept accept : acceptTree) {
    if (!acceptHeaders.contains(accept.getValue())) {
      acceptHeaders.add(accept.getValue());
    }
  }
  acceptHeaderScanner.close();
  return acceptHeaders;
}
Program: 34984
Project: 34984
Buggy source:
public static List<String> parseAcceptableLanguages(final String headerValue) throws BatchException {
  List<String> acceptLanguages=new LinkedList<String>();
  TreeSet<Accept> acceptTree=getAcceptTree();
  Scanner acceptLanguageScanner=new Scanner(headerValue);
  acceptLanguageScanner.useDelimiter("String_Node_Str");
  while (acceptLanguageScanner.hasNext()) {
    if (acceptLanguageScanner.hasNext(REG_EX_ACCEPT_LANGUAGES_WITH_Q_FACTOR)) {
      acceptLanguageScanner.next(REG_EX_ACCEPT_LANGUAGES_WITH_Q_FACTOR);
      MatchResult result=acceptLanguageScanner.match();
      if (result.groupCount() == 2) {
        String languagerange=result.group(1);
        double qualityFactor=result.group(2) != null ? Double.parseDouble(result.group(2)) : 1d;
        acceptTree.add(new Accept().setQuality(qualityFactor).setValue(languagerange));
      }
 else {
        String acceptLanguage=acceptLanguageScanner.next();
        acceptLanguageScanner.close();
        throw new BatchException(BatchException.INVALID_ACCEPT_LANGUAGE_HEADER.addContent(acceptLanguage),BAD_REQUEST);
      }
    }
 else {
      String acceptLanguage=acceptLanguageScanner.next();
      acceptLanguageScanner.close();
      throw new BatchException(BatchException.INVALID_ACCEPT_LANGUAGE_HEADER.addContent(acceptLanguage),BAD_REQUEST);
    }
  }
  for (  Accept accept : acceptTree) {
    acceptLanguages.add(accept.getValue());
  }
  acceptLanguageScanner.close();
  return acceptLanguages;
}

Fixed version (ground truth):
public List<String> parseAcceptableLanguages() throws BatchException {
  final String headerValue=concatenateHeaderLines(acceptLanguageHeaderValues);
  final List<String> acceptLanguages=new LinkedList<String>();
  final TreeSet<Accept> acceptTree=getAcceptTree();
  Scanner acceptLanguageScanner=new Scanner(headerValue);
  acceptLanguageScanner.useDelimiter("String_Node_Str");
  while (acceptLanguageScanner.hasNext()) {
    if (acceptLanguageScanner.hasNext(REG_EX_ACCEPT_LANGUAGES_WITH_Q_FACTOR)) {
      acceptLanguageScanner.next(REG_EX_ACCEPT_LANGUAGES_WITH_Q_FACTOR);
      MatchResult result=acceptLanguageScanner.match();
      if (result.groupCount() == 2) {
        String languagerange=result.group(1);
        double qualityFactor=result.group(2) != null ? Double.parseDouble(result.group(2)) : 1d;
        acceptTree.add(new Accept().setQuality(qualityFactor).setValue(languagerange));
      }
 else {
        String acceptLanguage=acceptLanguageScanner.next();
        acceptLanguageScanner.close();
        throw new BatchException(BatchException.INVALID_ACCEPT_LANGUAGE_HEADER.addContent(acceptLanguage),BAD_REQUEST);
      }
    }
 else {
      String acceptLanguage=acceptLanguageScanner.next();
      acceptLanguageScanner.close();
      throw new BatchException(BatchException.INVALID_ACCEPT_LANGUAGE_HEADER.addContent(acceptLanguage),BAD_REQUEST);
    }
  }
  for (  Accept accept : acceptTree) {
    if (!acceptLanguages.contains(accept.getValue())) {
      acceptLanguages.add(accept.getValue());
    }
  }
  acceptLanguageScanner.close();
  return acceptLanguages;
}
Program: 34985
Project: 34985
Buggy source:
public BatchBodyPart parse(final int contentLength) throws BatchException {
  List<String> remainingMessage=BatchParserCommon.trimStringListToLength(body,contentLength);
  requests=consumeRequest(remainingMessage);
  isParsed=true;
  return this;
}

Fixed version (ground truth):
public BatchBodyPart parse() throws BatchException {
  headers=BatchParserCommon.consumeHeaders(remainingMessage);
  BatchParserCommon.consumeBlankLine(remainingMessage,isStrict);
  isChangeSet=isChangeSet(headers);
  requests=consumeRequest(remainingMessage);
  return this;
}
Program: 34986
Project: 34986
Buggy source:
public BatchBodyPart(final List<String> bodyPartMessage,final String boundary,final boolean isStrict) throws BatchException {
  this.boundary=boundary;
  this.isStrict=isStrict;
  List<String> remainingMessage=new LinkedList<String>();
  remainingMessage.addAll(bodyPartMessage);
  headers=BatchParserCommon.consumeHeaders(remainingMessage);
  BatchParserCommon.consumeBlankLine(remainingMessage,isStrict);
  isChangeSet=isChangeSet(headers);
  body=remainingMessage;
}

Fixed version (ground truth):
public BatchBodyPart(final List<String> bodyPartMessage,final String boundary,final boolean isStrict) throws BatchException {
  this.boundary=boundary;
  this.isStrict=isStrict;
  remainingMessage.addAll(bodyPartMessage);
}
Program: 34987
Project: 34987
Buggy source:
public List<BatchQueryOperation> getRequests(){
  if (!isParsed) {
    throw new ODataRuntimeException("String_Node_Str");
  }
  return requests;
}

Fixed version (ground truth):
public List<BatchQueryOperation> getRequests(){
  return requests;
}
Program: 34988
Project: 34988
Buggy source:
private boolean isContentTypeMultiPartMixed(final String contentType){
  return contentType.contains(HttpContentType.MULTIPART_MIXED);
}

Fixed version (ground truth):
private boolean isContentTypeMultiPartMixed(final String contentType){
  return BatchParserCommon.PATTERN_MULTIPART_BOUNDARY.matcher(contentType).matches();
}
Program: 34989
Project: 34989
Buggy source:
private List<BatchQueryOperation> consumeChangeSet(final List<String> remainingMessage) throws BatchException {
  final List<List<String>> changeRequests=splitChangeSet(remainingMessage);
  final List<BatchQueryOperation> requestList=new LinkedList<BatchQueryOperation>();
  for (  List<String> changeRequest : changeRequests) {
    requestList.add(new BatchChangeSet(changeRequest,isStrict).parse());
  }
  return requestList;
}

Fixed version (ground truth):
private List<BatchQueryOperation> consumeChangeSet(final List<String> remainingMessage) throws BatchException {
  final List<List<String>> changeRequests=splitChangeSet(remainingMessage);
  final List<BatchQueryOperation> requestList=new LinkedList<BatchQueryOperation>();
  for (  List<String> changeRequest : changeRequests) {
    requestList.add(new BatchChangeSetPart(changeRequest,isStrict).parse());
  }
  return requestList;
}
Program: 34990
Project: 34990
Buggy source:
private List<BatchParserResult> parseBatch(final InputStream in,final BatchTransformator transformator) throws BatchException, IOException {
  final String baseUri=getBaseUri();
  final String boundary=BatchParserCommon.getBoundary(contentTypeMime);
  final List<BatchParserResult> resultList=new LinkedList<BatchParserResult>();
  final List<List<String>> bodyPartStrings=splitBodyParts(in,boundary);
  for (  List<String> bodyPartString : bodyPartStrings) {
    BatchBodyPart bodyPart=new BatchBodyPart(bodyPartString,boundary,isStrict);
    resultList.addAll(transformator.transform(bodyPart,batchRequestPathInfo,baseUri));
  }
  return resultList;
}

Fixed version (ground truth):
private List<BatchParserResult> parseBatch(final InputStream in,final BatchTransformator transformator) throws BatchException, IOException {
  final String baseUri=getBaseUri();
  final String boundary=BatchParserCommon.getBoundary(contentTypeMime);
  final List<BatchParserResult> resultList=new LinkedList<BatchParserResult>();
  final List<List<String>> bodyPartStrings=splitBodyParts(in,boundary);
  for (  List<String> bodyPartString : bodyPartStrings) {
    BatchBodyPart bodyPart=new BatchBodyPart(bodyPartString,boundary,isStrict).parse();
    resultList.addAll(transformator.transform(bodyPart,batchRequestPathInfo,baseUri));
  }
  return resultList;
}
Program: 34991
Project: 34991
Buggy source:
private static String extractPathInfo(final HttpServletRequest servletRequest){
  String pathInfoString;
  final String requestUri=servletRequest.getRequestURI();
  pathInfoString=requestUri;
  int index=requestUri.indexOf(servletRequest.getContextPath());
  if (index >= 0) {
    pathInfoString=pathInfoString.substring(servletRequest.getContextPath().length());
  }
  int indexServletPath=requestUri.indexOf(servletRequest.getServletPath());
  if (indexServletPath > 0) {
    pathInfoString=pathInfoString.substring(servletRequest.getServletPath().length());
  }
  return pathInfoString;
}

Fixed version (ground truth):
private static String extractPathInfo(final HttpServletRequest servletRequest){
  String pathInfoString;
  final String requestUri=servletRequest.getRequestURI();
  pathInfoString=requestUri;
  int index=requestUri.indexOf(servletRequest.getContextPath());
  if (index >= 0) {
    pathInfoString=pathInfoString.substring(servletRequest.getContextPath().length());
  }
  int indexServletPath=requestUri.indexOf(servletRequest.getServletPath());
  if (indexServletPath >= 0) {
    pathInfoString=pathInfoString.substring(servletRequest.getServletPath().length());
  }
  return pathInfoString;
}
Program: 34992
Project: 34992
Buggy source:
@Override public EdmTyped getReturnType() throws EdmException {
  final ReturnType returnType=functionImport.getReturnType();
  return new EdmTypedImplProv(edm,functionImport.getName(),returnType.getTypeName(),returnType.getMultiplicity());
}

Fixed version (ground truth):
@Override public EdmTyped getReturnType() throws EdmException {
  if (edmReturnType == null) {
    final ReturnType returnType=functionImport.getReturnType();
    if (returnType != null) {
      edmReturnType=new EdmTypedImplProv(edm,functionImport.getName(),returnType.getTypeName(),returnType.getMultiplicity());
    }
  }
  return edmReturnType;
}
Program: 34993
Project: 34993
Buggy source:
private FunctionImportParameter readFunctionImportParameter(final XMLStreamReader reader) throws EntityProviderException, XMLStreamException {
  reader.require(XMLStreamConstants.START_ELEMENT,edmNamespace,XmlMetadataConstants.EDM_FUNCTION_PARAMETER);
  FunctionImportParameter functionParameter=new FunctionImportParameter();
  List<AnnotationElement> annotationElements=new ArrayList<AnnotationElement>();
  functionParameter.setName(reader.getAttributeValue(null,XmlMetadataConstants.EDM_NAME));
  String type=reader.getAttributeValue(null,XmlMetadataConstants.EDM_TYPE);
  if (type == null) {
    throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent(XmlMetadataConstants.EDM_TYPE).addContent(XmlMetadataConstants.EDM_FUNCTION_PARAMETER));
  }
  functionParameter.setType(EdmSimpleTypeKind.valueOf(extractFQName(type).getName()));
  functionParameter.setFacets(readFacets(reader));
  functionParameter.setAnnotationAttributes(readAnnotationAttribute(reader));
  while (reader.hasNext() && !(reader.isEndElement() && edmNamespace.equals(reader.getNamespaceURI()) && XmlMetadataConstants.EDM_FUNCTION_IMPORT.equals(reader.getLocalName()))) {
    reader.next();
    if (reader.isStartElement()) {
      extractNamespaces(reader);
      annotationElements.add(readAnnotationElement(reader));
    }
  }
  if (!annotationElements.isEmpty()) {
    functionParameter.setAnnotationElements(annotationElements);
  }
  return functionParameter;
}

Fixed version (ground truth):
private FunctionImportParameter readFunctionImportParameter(final XMLStreamReader reader) throws EntityProviderException, XMLStreamException {
  reader.require(XMLStreamConstants.START_ELEMENT,edmNamespace,XmlMetadataConstants.EDM_FUNCTION_PARAMETER);
  FunctionImportParameter functionParameter=new FunctionImportParameter();
  List<AnnotationElement> annotationElements=new ArrayList<AnnotationElement>();
  functionParameter.setName(reader.getAttributeValue(null,XmlMetadataConstants.EDM_NAME));
  String type=reader.getAttributeValue(null,XmlMetadataConstants.EDM_TYPE);
  if (type == null) {
    throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent(XmlMetadataConstants.EDM_TYPE).addContent(XmlMetadataConstants.EDM_FUNCTION_PARAMETER));
  }
  functionParameter.setType(EdmSimpleTypeKind.valueOf(extractFQName(type).getName()));
  functionParameter.setFacets(readFacets(reader));
  functionParameter.setAnnotationAttributes(readAnnotationAttribute(reader));
  while (reader.hasNext() && !(reader.isEndElement() && edmNamespace.equals(reader.getNamespaceURI()) && XmlMetadataConstants.EDM_FUNCTION_PARAMETER.equals(reader.getLocalName()))) {
    reader.next();
    if (reader.isStartElement()) {
      extractNamespaces(reader);
      annotationElements.add(readAnnotationElement(reader));
    }
  }
  if (!annotationElements.isEmpty()) {
    functionParameter.setAnnotationElements(annotationElements);
  }
  return functionParameter;
}
Program: 34995
Project: 34995
Buggy source:
@Override public ODataResponse handleError(final ODataErrorContext context) throws ODataApplicationException {
  final String SEPARATOR="String_Node_Str";
  Throwable t=context.getException();
  if (t instanceof ODataJPAException) {
    StringBuilder errorBuilder=new StringBuilder();
    errorBuilder.append(t.getCause().getClass().toString());
    errorBuilder.append(SEPARATOR);
    errorBuilder.append(t.getCause().getMessage());
    context.setInnerError(errorBuilder.toString());
  }
  return EntityProvider.writeErrorDocument(context);
}

Fixed version (ground truth):
@Override public ODataResponse handleError(final ODataErrorContext context) throws ODataApplicationException {
  final String SEPARATOR="String_Node_Str";
  Throwable t=context.getException();
  if (t instanceof ODataJPAException && t.getCause() != null) {
    StringBuilder errorBuilder=new StringBuilder();
    errorBuilder.append(t.getCause().getClass().toString());
    errorBuilder.append(SEPARATOR);
    errorBuilder.append(t.getCause().getMessage());
    context.setInnerError(errorBuilder.toString());
  }
  return EntityProvider.writeErrorDocument(context);
}
Program: 34996
Project: 34996
Buggy source:
private void assertDeletedEntries(final String json){
  assertTrue("String_Node_Str",json.contains("String_Node_Str"));
  assertTrue("String_Node_Str",json.contains("String_Node_Str"));
  assertTrue("String_Node_Str",json.contains("String_Node_Str"));
  assertTrue("String_Node_Str",json.contains("String_Node_Str"));
}

Fixed version (ground truth):
private void assertDeletedEntries(final String json){
  assertTrue("String_Node_Str",json.contains("String_Node_Str"));
  assertTrue("String_Node_Str",json.contains("String_Node_Str" + "String_Node_Str"));
  assertTrue("String_Node_Str",json.contains("String_Node_Str" + "String_Node_Str"));
  assertTrue("String_Node_Str",json.contains("String_Node_Str" + "String_Node_Str"));
}