nus-yam/ex-repair huggingface dataset:
Program: 81142
Project: 81142
Buggy source:
@PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @RolesAllowed(JeeshopRoles.ADMIN) public SKU modify(SKU sku){
  SKU originalSKU=entityManager.find(SKU.class,sku.getId());
  checkNotNull(originalSKU);
  if (sku.getDiscountsIds() != null) {
    List<Discount> newDiscounts=new ArrayList<>();
    sku.getDiscountsIds().forEach(discountId -> newDiscounts.add(entityManager.find(Discount.class,discountId)));
    sku.setDiscounts(newDiscounts);
  }
 else {
    sku.setDiscounts(originalSKU.getDiscounts());
  }
  return entityManager.merge(sku);
}

Fixed version (ground truth):
@PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @RolesAllowed(JeeshopRoles.ADMIN) public SKU modify(SKU sku){
  SKU originalSKU=entityManager.find(SKU.class,sku.getId());
  checkNotNull(originalSKU);
  if (sku.getDiscountsIds() != null) {
    List<Discount> newDiscounts=new ArrayList<>();
    sku.getDiscountsIds().forEach(discountId -> newDiscounts.add(entityManager.find(Discount.class,discountId)));
    sku.setDiscounts(newDiscounts);
  }
 else {
    sku.setDiscounts(originalSKU.getDiscounts());
  }
  sku.setPresentationByLocale(originalSKU.getPresentationByLocale());
  return entityManager.merge(sku);
}
Program: 81143
Project: 81143
Buggy source:
@PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("String_Node_Str") @PermitAll public void activate(@NotNull @PathParam("String_Node_Str") String userLogin,@NotNull UUID token){
  User user=userFinder.findByLogin(userLogin);
  if (user != null && user.getActionToken().equals(token)) {
    user.setActivated(true);
    user.setActionToken(null);
  }
 else {
    throw new WebApplicationException(Response.Status.NOT_FOUND);
  }
}

Fixed version (ground truth):
@PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("String_Node_Str") @PermitAll public void activate(@NotNull @PathParam("String_Node_Str") String userLogin,@NotNull String token){
  User user=userFinder.findByLogin(userLogin);
  if (user != null && user.getActionToken() != null && user.getActionToken().equals(UUID.fromString(token))) {
    user.setActivated(true);
    user.setActionToken(null);
  }
 else {
    throw new WebApplicationException(Response.Status.NOT_FOUND);
  }
}
Program: 81144
Project: 81144
Buggy source:
@Test public void activate_shouldThrowNotFoundExWhenUserIsNotFound() throws Exception {
  ;
  try {
    service.activate("String_Node_Str",UUID.randomUUID());
    fail("String_Node_Str");
  }
 catch (  WebApplicationException e) {
    assertThat(e.getResponse().getStatus()).isEqualTo(Response.Status.NOT_FOUND.getStatusCode());
  }
}

Fixed version (ground truth):
@Test public void activate_shouldThrowNotFoundExWhenUserIsNotFound() throws Exception {
  ;
  try {
    service.activate("String_Node_Str",UUID.randomUUID().toString());
    fail("String_Node_Str");
  }
 catch (  WebApplicationException e) {
    assertThat(e.getResponse().getStatus()).isEqualTo(Response.Status.NOT_FOUND.getStatusCode());
  }
}
Program: 81145
Project: 81145
Buggy source:
@Test public void activate_shouldActivateUserAndClearActionToken() throws Exception {
  User user=new User("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",null,new Date(),"String_Node_Str",null);
  user.setGender("String_Node_Str");
  final UUID actionToken=UUID.randomUUID();
  user.setActionToken(actionToken);
  user.setActivated(false);
  entityManager.getTransaction().begin();
  entityManager.persist(user);
  entityManager.getTransaction().commit();
  service.activate(user.getLogin(),actionToken);
  final User modifiedUser=entityManager.find(User.class,user.getId());
  assertThat(modifiedUser).isNotNull();
  assertThat(modifiedUser.getActivated()).isTrue();
  assertThat(modifiedUser.getActionToken()).isNull();
  entityManager.remove(user);
}

Fixed version (ground truth):
@Test public void activate_shouldActivateUserAndClearActionToken() throws Exception {
  User user=new User("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",null,new Date(),"String_Node_Str",null);
  user.setGender("String_Node_Str");
  final UUID actionToken=UUID.randomUUID();
  user.setActionToken(actionToken);
  user.setActivated(false);
  entityManager.getTransaction().begin();
  entityManager.persist(user);
  entityManager.getTransaction().commit();
  service.activate(user.getLogin(),actionToken.toString());
  final User modifiedUser=entityManager.find(User.class,user.getId());
  assertThat(modifiedUser).isNotNull();
  assertThat(modifiedUser.getActivated()).isTrue();
  assertThat(modifiedUser.getActionToken()).isNull();
  entityManager.remove(user);
}
Program: 81146
Project: 81146
Buggy source:
public void sendMail(String subject,String to,String content) throws MessagingException {
  Properties props=new Properties();
  props.put("String_Node_Str",host);
  props.put("String_Node_Str",port);
  props.put("String_Node_Str",port);
  props.put("String_Node_Str","String_Node_Str");
  props.put("String_Node_Str",connectTimeout);
  props.put("String_Node_Str",readTimeout);
  Authenticator authenticator=null;
  if (StringUtils.isNotEmpty(user)) {
    props.put("String_Node_Str","String_Node_Str");
    authenticator=new Authenticator(){
      private PasswordAuthentication pa=new PasswordAuthentication(user,password);
      @Override public PasswordAuthentication getPasswordAuthentication(){
        return pa;
      }
    }
;
  }
  Session session=Session.getInstance(props,authenticator);
  session.setDebug(Boolean.parseBoolean(debug));
  MimeMessage message=new MimeMessage(session);
  message.setFrom(new InternetAddress(sender));
  InternetAddress[] address={new InternetAddress(to)};
  message.setRecipients(Message.RecipientType.TO,address);
  message.setSubject(subject);
  message.setSentDate(new Date());
  Multipart multipart=new MimeMultipart("String_Node_Str");
  MimeBodyPart htmlPart=new MimeBodyPart();
  htmlPart.setContent(content,"String_Node_Str");
  multipart.addBodyPart(htmlPart);
  message.setContent(multipart);
  Transport.send(message);
}

Fixed version (ground truth):
public void sendMail(String subject,String to,String content) throws MessagingException {
  Properties props=new Properties();
  props.put("String_Node_Str",host);
  props.put("String_Node_Str",port);
  props.put("String_Node_Str",port);
  props.put("String_Node_Str","String_Node_Str");
  props.put("String_Node_Str",connectTimeout);
  props.put("String_Node_Str",readTimeout);
  Authenticator authenticator=null;
  if (StringUtils.isNotEmpty(user)) {
    props.put("String_Node_Str","String_Node_Str");
    authenticator=new Authenticator(){
      private PasswordAuthentication pa=new PasswordAuthentication(user,password);
      @Override public PasswordAuthentication getPasswordAuthentication(){
        return pa;
      }
    }
;
  }
  Session session=Session.getInstance(props,authenticator);
  session.setDebug(Boolean.parseBoolean(debug));
  MimeMessage message=new MimeMessage(session);
  message.setFrom(new InternetAddress(sender));
  InternetAddress[] address={new InternetAddress(to)};
  message.setRecipients(Message.RecipientType.TO,address);
  message.setSubject(subject,"String_Node_Str");
  message.setSentDate(new Date());
  Multipart multipart=new MimeMultipart("String_Node_Str");
  MimeBodyPart htmlPart=new MimeBodyPart();
  htmlPart.setContent(content,"String_Node_Str");
  multipart.addBodyPart(htmlPart);
  message.setContent(multipart);
  Transport.send(message);
}
Program: 81147
Project: 81147
Buggy source:
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public List<Category> findCategories(@PathParam("String_Node_Str") Long catalogId){
  Catalog catalog=entityManager.find(Catalog.class,catalogId);
  if (catalog == null) {
    throw new WebApplicationException(Response.Status.NOT_FOUND);
  }
  return new JPAQuery(entityManager).from(category).where(category.disabled.isFalse(),category.endDate.after(new Date()),category.in(catalog.getRootCategories())).list(category);
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public List<Category> findCategories(@PathParam("String_Node_Str") Long catalogId){
  Catalog catalog=entityManager.find(Catalog.class,catalogId);
  if (catalog == null) {
    throw new WebApplicationException(Response.Status.NOT_FOUND);
  }
  if (catalog.getRootCategories().isEmpty()) {
    return null;
  }
  return new JPAQuery(entityManager).from(category).where(category.disabled.isFalse(),category.endDate.after(new Date()),category.in(catalog.getRootCategories())).list(category);
}
Program: 81148
Project: 81148
Buggy source:
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public List<Category> findCategories(@PathParam("String_Node_Str") @NotNull Long categoryId){
  Category cat=entityManager.find(Category.class,categoryId);
  if (cat == null) {
    throw new WebApplicationException(Response.Status.NOT_FOUND);
  }
  return new JPAQuery(entityManager).from(category).where(category.disabled.isFalse(),category.endDate.after(new Date()),category.in(cat.getChildCategories())).list(category);
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public List<Category> findCategories(@PathParam("String_Node_Str") @NotNull Long categoryId){
  Category cat=entityManager.find(Category.class,categoryId);
  if (cat == null) {
    throw new WebApplicationException(Response.Status.NOT_FOUND);
  }
  if (cat.getChildCategories().isEmpty()) {
    return null;
  }
  return new JPAQuery(entityManager).from(category).where(category.disabled.isFalse(),category.endDate.after(new Date()),category.in(cat.getChildCategories())).list(category);
}
Program: 81149
Project: 81149
Buggy source:
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public List<Product> findProducts(@PathParam("String_Node_Str") @NotNull Long categoryId){
  Category cat=entityManager.find(Category.class,categoryId);
  if (cat == null) {
    throw new WebApplicationException(Response.Status.NOT_FOUND);
  }
  return new JPAQuery(entityManager).from(product).where(product.disabled.isFalse(),product.endDate.after(new Date()),product.in(cat.getChildProducts())).list(product);
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public List<Product> findProducts(@PathParam("String_Node_Str") @NotNull Long categoryId){
  Category cat=entityManager.find(Category.class,categoryId);
  if (cat == null) {
    throw new WebApplicationException(Response.Status.NOT_FOUND);
  }
  if (cat.getChildProducts().isEmpty()) {
    return null;
  }
  return new JPAQuery(entityManager).from(product).where(product.disabled.isFalse(),product.endDate.after(new Date()),product.in(cat.getChildProducts())).list(product);
}
Program: 81150
Project: 81150
Buggy source:
@Override public void remove(int n){
  for (int i=0; i < n; i++) {
    tasks.remove();
    if (listener != null) {
      listener.onRemove(this);
    }
  }
}

Fixed version (ground truth):
@Override public void remove(int n){
  for (int i=0; i < n; i++) {
    removeFromQueue();
    if (listener != null) {
      listener.onRemove(this);
    }
  }
}
Program: 81151
Project: 81151
Buggy source:
private void callPersistSuccess(T batch){
  if (!isWaitingToFinish) {
    isWaitingToFinish=true;
    if (listener != null) {
      listener.onPersistSuccess(batch);
    }
  }
}

Fixed version (ground truth):
private void callPersistSuccess(T batch){
  if (listener != null) {
    listener.onPersistSuccess(batch);
  }
}
Program: 81152
Project: 81152
Buggy source:
private void checkPendingAndContinue(){
  initializeIfRequired();
  if (queueFile.size() > 0) {
    try {
      peekedBatch=(queueFile.size() == cachedQueue.size()) ? cachedQueue.peek() : queueFile.peek();
      if (peekedBatch != null) {
        callPersistSuccess(peekedBatch);
      }
    }
 catch (    IOException e) {
      if (log.isErrorEnabled()) {
        log.error(e.getLocalizedMessage());
      }
    }
  }
 else {
    callQueueEnd();
  }
}

Fixed version (ground truth):
private void checkPendingAndContinue(){
  initializeIfRequired();
  if (queueFile.size() > 0) {
    try {
      if (!isWaitingToFinish) {
        peekedBatch=(queueFile.size() == cachedQueue.size()) ? cachedQueue.peek() : queueFile.peek();
        if (peekedBatch != null) {
          isWaitingToFinish=true;
          callPersistSuccess(peekedBatch);
        }
      }
    }
 catch (    IOException e) {
      if (log.isErrorEnabled()) {
        log.error(e.getLocalizedMessage());
      }
    }
  }
 else {
    callQueueEnd();
  }
}
Program: 81153
Project: 81153
Buggy source:
private void trimQueue(){
  int oldSize=getSize();
  if (oldSize >= maxQueueSize && remove(trimSize)) {
    remove(trimSize);
    callTrimListener(oldSize,getSize());
  }
}

Fixed version (ground truth):
private void trimQueue(){
  int oldSize=getSize();
  if (oldSize >= maxQueueSize && remove(trimSize)) {
    callTrimListener(oldSize,getSize());
  }
}
Program: 81154
Project: 81154
Buggy source:
private void checkPendingAndContinue(){
  initializeIfRequired();
  if (!queueFile.isEmpty()) {
    try {
      byte[] eldest=queueFile.peek();
      if (eldest != null) {
        T batch=serializationStrategy.deserializeBatch(eldest);
        callPersistSuccess(batch);
      }
    }
 catch (    IOException|DeserializeException e) {
      if (log.isErrorEnabled()) {
        log.error(e.getLocalizedMessage());
      }
    }
  }
 else {
    callQueueEnd();
  }
}

Fixed version (ground truth):
private void checkPendingAndContinue(){
  initializeIfRequired();
  if (!queueFile.isEmpty()) {
    try {
      byte[] eldest=queueFile.peek();
      if (eldest != null) {
        peekedBatch=serializationStrategy.deserializeBatch(eldest);
        callPersistSuccess(peekedBatch);
      }
    }
 catch (    IOException|DeserializeException e) {
      if (log.isErrorEnabled()) {
        log.error(e.getLocalizedMessage());
      }
    }
  }
 else {
    callQueueEnd();
  }
}
Program: 81155
Project: 81155
Buggy source:
@Override public void run(){
  try {
    byte[] peeked=queueFile.peek();
    if (peeked != null) {
      T peekedBatch=serializationStrategy.deserializeBatch(peeked);
      if (batch != null && batch.equals(peekedBatch)) {
        queueFile.remove();
      }
 else {
        throw new IllegalStateException("String_Node_Str" + peekedBatch + "String_Node_Str"+ batch);
      }
    }
  }
 catch (  DeserializeException e) {
    if (log.isErrorEnabled()) {
      log.error(e.getLocalizedMessage());
    }
    throw new IllegalStateException("String_Node_Str" + e.getRealException().getLocalizedMessage());
  }
catch (  IOException e) {
    if (log.isErrorEnabled()) {
      log.error(e.getLocalizedMessage());
    }
    throw new IllegalStateException("String_Node_Str" + e.getLocalizedMessage());
  }
  isWaitingToFinish=false;
  checkPendingAndContinue();
}

Fixed version (ground truth):
@Override public void run(){
  if (!queueFile.isEmpty()) {
    try {
      if (peekedBatch != null) {
        if (batch != null && batch.equals(peekedBatch)) {
          queueFile.remove();
        }
 else {
          if (log.isErrorEnabled()) {
            log.error("String_Node_Str" + peekedBatch + "String_Node_Str"+ batch);
          }
        }
      }
    }
 catch (    IOException e) {
      if (log.isErrorEnabled()) {
        log.error(e.getLocalizedMessage());
      }
      throw new IllegalStateException("String_Node_Str" + e.getLocalizedMessage());
    }
    peekedBatch=null;
    isWaitingToFinish=false;
    checkPendingAndContinue();
  }
 else {
    peekedBatch=null;
  }
}
Program: 81156
Project: 81156
Buggy source:
public void finish(final T batch){
  if (!queueFile.isEmpty()) {
    handler.post(new Runnable(){
      @Override public void run(){
        try {
          byte[] peeked=queueFile.peek();
          if (peeked != null) {
            T peekedBatch=serializationStrategy.deserializeBatch(peeked);
            if (batch != null && batch.equals(peekedBatch)) {
              queueFile.remove();
            }
 else {
              throw new IllegalStateException("String_Node_Str" + peekedBatch + "String_Node_Str"+ batch);
            }
          }
        }
 catch (        DeserializeException e) {
          if (log.isErrorEnabled()) {
            log.error(e.getLocalizedMessage());
          }
          throw new IllegalStateException("String_Node_Str" + e.getRealException().getLocalizedMessage());
        }
catch (        IOException e) {
          if (log.isErrorEnabled()) {
            log.error(e.getLocalizedMessage());
          }
          throw new IllegalStateException("String_Node_Str" + e.getLocalizedMessage());
        }
        isWaitingToFinish=false;
        checkPendingAndContinue();
      }
    }
);
  }
}

Fixed version (ground truth):
public void finish(final T batch){
  handler.post(new Runnable(){
    @Override public void run(){
      if (!queueFile.isEmpty()) {
        try {
          if (peekedBatch != null) {
            if (batch != null && batch.equals(peekedBatch)) {
              queueFile.remove();
            }
 else {
              if (log.isErrorEnabled()) {
                log.error("String_Node_Str" + peekedBatch + "String_Node_Str"+ batch);
              }
            }
          }
        }
 catch (        IOException e) {
          if (log.isErrorEnabled()) {
            log.error(e.getLocalizedMessage());
          }
          throw new IllegalStateException("String_Node_Str" + e.getLocalizedMessage());
        }
        peekedBatch=null;
        isWaitingToFinish=false;
        checkPendingAndContinue();
      }
 else {
        peekedBatch=null;
      }
    }
  }
);
}
Program: 81158
Project: 81158
Buggy source:
@Override public void onInitialized(){
  if (!isInitialized()) {
    try {
      File file=new File(filePath);
      this.queueFile=new QueueFile(file);
    }
 catch (    IOException e) {
      if (log.isErrorEnabled()) {
        log.error(e.getLocalizedMessage());
      }
    }
    syncData();
  }
  super.onInitialized();
}

Fixed version (ground truth):
@Override public void onInitialized(){
  if (!isInitialized()) {
    try {
      File file=new File(filePath);
      this.queueFile=new TapeQueueFile(file);
    }
 catch (    IOException e) {
      this.queueFile=new InMemoryQueueFile();
      if (log.isErrorEnabled()) {
        log.error(e.getLocalizedMessage());
      }
    }
    syncData();
  }
  super.onInitialized();
}
Program: 81159
Project: 81159
Buggy source:
public QueueFile getQueueFile(){
  return queueFile;
}

Fixed version (ground truth):
public IQueueFile getQueueFile(){
  return queueFile;
}
Program: 81160
Project: 81160
Buggy source:
public static JsonElement forJSONGenericObject(Object value,JsonSerializationContext context){
  JsonElement element;
  if (null != value) {
    if (value instanceof JSONObject) {
      element=context.serialize(value,JSONObject.class);
    }
 else     if (value instanceof JSONArray) {
      element=context.serialize(value,JSONArray.class);
    }
 else {
      element=context.serialize(value);
    }
  }
 else {
    element=context.serialize(value);
  }
  return element;
}

Fixed version (ground truth):
public static JsonElement forJSONGenericObject(Object value,JsonSerializationContext context){
  JsonElement element;
  if (null != value) {
    if (value instanceof JSONObject) {
      element=context.serialize(value,JSONObject.class);
    }
 else     if (value instanceof JSONArray) {
      element=context.serialize(value,JSONArray.class);
    }
 else     if (value instanceof String) {
      element=context.serialize(value,String.class);
    }
 else     if (value instanceof Number) {
      element=context.serialize(value,Number.class);
    }
 else     if (value instanceof Boolean) {
      element=context.serialize(value,Boolean.class);
    }
 else {
      element=context.serialize(value);
    }
  }
 else {
    element=context.serialize(value);
  }
  return element;
}
Program: 81161
Project: 81161
Buggy source:
private void makeNetworkRequest(final T batch,boolean isRetry){
  if (isConnectedToNetwork()) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",batch);
    }
    if (!isRetry) {
      resetRetryCounters();
    }
    waitingForCallback=true;
    networkBatchListener.performNetworkRequest(batch,new ValueCallback<NetworkRequestResponse>(){
      @Override public void onReceiveValue(      NetworkRequestResponse value){
        waitingForCallback=false;
        if (!value.complete || (value.httpErrorCode >= HTTP_SERVER_ERROR_CODE_RANGE_START && value.httpErrorCode <= HTTP_SERVER_ERROR_CODE_RANGE_END)) {
          retryCount++;
          if (retryCount < maxRetryCount) {
            int backOff=exponentialBackOff();
            if (log.isDebugEnabled()) {
              log.debug("String_Node_Str",value.complete,value.httpErrorCode,batch,backOff);
            }
            handler.postDelayed(new Runnable(){
              @Override public void run(){
                makeNetworkRequest(batch,true);
              }
            }
,backOff);
          }
 else {
            if (log.isDebugEnabled()) {
              log.debug("String_Node_Str",getQueueFile());
            }
            retryLimitReached=true;
          }
        }
 else {
          finish(batch);
        }
      }
    }
);
  }
 else {
    resetRetryCounters();
    waitingForCallback=false;
  }
}

Fixed version (ground truth):
private void makeNetworkRequest(final T batch,boolean isRetry){
  if (isConnectedToNetwork()) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",batch,this);
    }
    if (!isRetry) {
      resetRetryCounters();
    }
    waitingForCallback=true;
    networkBatchListener.performNetworkRequest(batch,new ValueCallback<NetworkRequestResponse>(){
      @Override public void onReceiveValue(      final NetworkRequestResponse value){
        handler.post(new Runnable(){
          @Override public void run(){
            waitingForCallback=false;
            if (log.isDebugEnabled()) {
              log.debug("String_Node_Str",this);
            }
            if (!value.complete || (value.httpErrorCode >= HTTP_SERVER_ERROR_CODE_RANGE_START && value.httpErrorCode <= HTTP_SERVER_ERROR_CODE_RANGE_END)) {
              retryCount++;
              if (retryCount < maxRetryCount) {
                int backOff=exponentialBackOff();
                if (log.isDebugEnabled()) {
                  log.debug("String_Node_Str",value.complete,value.httpErrorCode,batch,backOff);
                }
                handler.postDelayed(new Runnable(){
                  @Override public void run(){
                    makeNetworkRequest(batch,true);
                  }
                }
,backOff);
              }
 else {
                if (log.isDebugEnabled()) {
                  log.debug("String_Node_Str",getQueueFile());
                }
                needsResumeOnReady=true;
              }
            }
 else {
              finish(batch);
            }
          }
        }
);
      }
    }
);
  }
 else {
    resetRetryCounters();
    waitingForCallback=false;
    needsResumeOnReady=true;
  }
}
Program: 81162
Project: 81162
Buggy source:
@Override public void run(){
  makeNetworkRequest(lastBatch,false);
}

Fixed version (ground truth):
@Override public void run(){
  if (!waitingForCallback && isConnectedToNetwork() && lastBatch != null) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",waitingForCallback,isConnectedToNetwork(),lastBatch);
    }
    makeNetworkRequest(lastBatch,false);
  }
 else {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",waitingForCallback,isConnectedToNetwork(),lastBatch);
    }
  }
}
Program: 81163
Project: 81163
Buggy source:
private void resume(){
  if (!waitingForCallback && isConnectedToNetwork() && lastBatch != null) {
    handler.post(new Runnable(){
      @Override public void run(){
        makeNetworkRequest(lastBatch,false);
      }
    }
);
  }
 else {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",waitingForCallback,isConnectedToNetwork(),lastBatch);
    }
  }
}

Fixed version (ground truth):
private void resume(){
  handler.post(new Runnable(){
    @Override public void run(){
      if (!waitingForCallback && isConnectedToNetwork() && lastBatch != null) {
        if (log.isDebugEnabled()) {
          log.debug("String_Node_Str",waitingForCallback,isConnectedToNetwork(),lastBatch);
        }
        makeNetworkRequest(lastBatch,false);
      }
 else {
        if (log.isDebugEnabled()) {
          log.debug("String_Node_Str",waitingForCallback,isConnectedToNetwork(),lastBatch);
        }
      }
    }
  }
);
}
Program: 81164
Project: 81164
Buggy source:
private void registerReceiverIfRequired(){
  if (!receiverRegistered) {
    IntentFilter filter=new IntentFilter();
    filter.addAction(Context.CONNECTIVITY_SERVICE);
    context.registerReceiver(networkBroadcastReceiver,filter);
    receiverRegistered=true;
  }
}

Fixed version (ground truth):
private void registerReceiverIfRequired(){
  if (!receiverRegistered) {
    IntentFilter filter=new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
    context.registerReceiver(networkBroadcastReceiver,filter);
    receiverRegistered=true;
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",this);
    }
  }
}
Program: 81165
Project: 81165
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  resume();
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str",NetworkPersistedBatchReadyListener.this);
  }
  resume();
}
Program: 81166
Project: 81166
Buggy source:
@Override public void onReceiveValue(NetworkRequestResponse value){
  waitingForCallback=false;
  if (!value.complete || (value.httpErrorCode >= HTTP_SERVER_ERROR_CODE_RANGE_START && value.httpErrorCode <= HTTP_SERVER_ERROR_CODE_RANGE_END)) {
    retryCount++;
    if (retryCount < maxRetryCount) {
      int backOff=exponentialBackOff();
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str",value.complete,value.httpErrorCode,batch,backOff);
      }
      handler.postDelayed(new Runnable(){
        @Override public void run(){
          makeNetworkRequest(batch,true);
        }
      }
,backOff);
    }
 else {
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str",getQueueFile());
      }
      retryLimitReached=true;
    }
  }
 else {
    finish(batch);
  }
}

Fixed version (ground truth):
@Override public void onReceiveValue(final NetworkRequestResponse value){
  handler.post(new Runnable(){
    @Override public void run(){
      waitingForCallback=false;
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str",this);
      }
      if (!value.complete || (value.httpErrorCode >= HTTP_SERVER_ERROR_CODE_RANGE_START && value.httpErrorCode <= HTTP_SERVER_ERROR_CODE_RANGE_END)) {
        retryCount++;
        if (retryCount < maxRetryCount) {
          int backOff=exponentialBackOff();
          if (log.isDebugEnabled()) {
            log.debug("String_Node_Str",value.complete,value.httpErrorCode,batch,backOff);
          }
          handler.postDelayed(new Runnable(){
            @Override public void run(){
              makeNetworkRequest(batch,true);
            }
          }
,backOff);
        }
 else {
          if (log.isDebugEnabled()) {
            log.debug("String_Node_Str",getQueueFile());
          }
          needsResumeOnReady=true;
        }
      }
 else {
        finish(batch);
      }
    }
  }
);
}
Program: 81167
Project: 81167
Buggy source:
private void unregisterReceiver(){
  if (receiverRegistered) {
    context.unregisterReceiver(networkBroadcastReceiver);
    receiverRegistered=false;
  }
}

Fixed version (ground truth):
private void unregisterReceiver(){
  if (receiverRegistered) {
    context.unregisterReceiver(networkBroadcastReceiver);
    receiverRegistered=false;
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",this);
    }
  }
}
Program: 81168
Project: 81168
Buggy source:
@Override public void onPersistSuccess(final T batch){
  lastBatch=batch;
  registerReceiverIfRequired();
  handler.post(new Runnable(){
    @Override public void run(){
      makeNetworkRequest(batch,false);
    }
  }
);
}

Fixed version (ground truth):
@Override public void onPersistSuccess(final T batch){
  lastBatch=batch;
  registerReceiverIfRequired();
  resume();
}
Program: 81169
Project: 81169
Buggy source:
@Override public void onReady(BatchingStrategy<E,T> causingStrategy,T batch){
  super.onReady(causingStrategy,batch);
  if (retryLimitReached) {
    retryLimitReached=false;
    resume();
  }
}

Fixed version (ground truth):
@Override public void onReady(BatchingStrategy<E,T> causingStrategy,T batch){
  super.onReady(causingStrategy,batch);
  if (needsResumeOnReady) {
    needsResumeOnReady=false;
    resume();
  }
}
Program: 81170
Project: 81170
Buggy source:
@Override public void add(Collection<E> dataCollection){
  super.add(dataCollection);
  for (  E data : dataCollection) {
    try {
      queueFile.add(serializationStrategy.serializeData(data));
    }
 catch (    IOException|SerializeException e) {
      if (log.isErrorEnabled()) {
        log.error(e.getLocalizedMessage());
      }
    }
  }
}

Fixed version (ground truth):
@Override public boolean add(Collection<E> dataCollection){
  boolean isAdded=false;
  Collection<E> oldData=getData();
  for (  E data : dataCollection) {
    try {
      if (!oldData.contains(data)) {
        isAdded=true;
        queueFile.add(serializationStrategy.serializeData(data));
      }
    }
 catch (    IOException|SerializeException e) {
      if (log.isErrorEnabled()) {
        log.error(e.getLocalizedMessage());
      }
    }
  }
  super.add(dataCollection);
  return isAdded;
}
Program: 81171
Project: 81171
Buggy source:
/** 
 * Method to send fake BroadcastReceiver for network change
 * @param context
 */
private void sendFakeNetworkBroadcast(Context context){
  Intent intent=new Intent();
  intent.setAction(Context.CONNECTIVITY_SERVICE);
  context.sendBroadcast(intent);
}

Fixed version (ground truth):
/** 
 * Method to send fake BroadcastReceiver for network change
 * @param context
 */
private void sendFakeNetworkBroadcast(Context context){
  Intent intent=new Intent();
  intent.setAction(ConnectivityManager.CONNECTIVITY_ACTION);
  context.sendBroadcast(intent);
}
Program: 81172
Project: 81172
Buggy source:
private void initializeIfRequired(){
  if (!initialized) {
    initialized=true;
    try {
      this.queueFile=new QueueFile(file);
      onInitialized(queueFile);
    }
 catch (    IOException e) {
      if (log.isErrorEnabled()) {
        log.error(e.getLocalizedMessage());
      }
    }
  }
}

Fixed version (ground truth):
private void initializeIfRequired(){
  if (!isInitialized()) {
    try {
      this.queueFile=new QueueFile(file);
      onInitialized(queueFile);
    }
 catch (    IOException e) {
      if (log.isErrorEnabled()) {
        log.error(e.getLocalizedMessage());
      }
    }
  }
}
Program: 81173
Project: 81173
Buggy source:
public boolean isInitialized(){
  return initialized;
}

Fixed version (ground truth):
public boolean isInitialized(){
  return queueFile != null;
}
Program: 81174
Project: 81174
Buggy source:
@Override public void run(){
  try {
    byte[] peeked=queueFile.peek();
    if (peeked != null) {
      T peekedBatch=serializationStrategy.deserializeBatch(peeked);
      if (batch != null && batch.equals(peekedBatch)) {
        queueFile.remove();
      }
 else {
        throw new IllegalStateException("String_Node_Str" + peekedBatch + "String_Node_Str"+ batch);
      }
    }
  }
 catch (  IOException|DeserializeException e) {
    if (log.isErrorEnabled()) {
      log.error(e.getLocalizedMessage());
    }
  }
  isWaitingToFinish=false;
  checkPendingAndContinue();
}

Fixed version (ground truth):
@Override public void run(){
  try {
    byte[] peeked=queueFile.peek();
    if (peeked != null) {
      T peekedBatch=serializationStrategy.deserializeBatch(peeked);
      if (batch != null && batch.equals(peekedBatch)) {
        queueFile.remove();
      }
 else {
        throw new IllegalStateException("String_Node_Str" + peekedBatch + "String_Node_Str"+ batch);
      }
    }
  }
 catch (  DeserializeException e) {
    if (log.isErrorEnabled()) {
      log.error(e.getLocalizedMessage());
    }
    throw new IllegalStateException("String_Node_Str" + e.getRealException().getLocalizedMessage());
  }
catch (  IOException e) {
    if (log.isErrorEnabled()) {
      log.error(e.getLocalizedMessage());
    }
    throw new IllegalStateException("String_Node_Str" + e.getLocalizedMessage());
  }
  isWaitingToFinish=false;
  checkPendingAndContinue();
}
Program: 81175
Project: 81175
Buggy source:
public void finish(final T batch){
  if (!queueFile.isEmpty()) {
    handler.post(new Runnable(){
      @Override public void run(){
        try {
          byte[] peeked=queueFile.peek();
          if (peeked != null) {
            T peekedBatch=serializationStrategy.deserializeBatch(peeked);
            if (batch != null && batch.equals(peekedBatch)) {
              queueFile.remove();
            }
 else {
              throw new IllegalStateException("String_Node_Str" + peekedBatch + "String_Node_Str"+ batch);
            }
          }
        }
 catch (        IOException|DeserializeException e) {
          if (log.isErrorEnabled()) {
            log.error(e.getLocalizedMessage());
          }
        }
        isWaitingToFinish=false;
        checkPendingAndContinue();
      }
    }
);
  }
}

Fixed version (ground truth):
public void finish(final T batch){
  if (!queueFile.isEmpty()) {
    handler.post(new Runnable(){
      @Override public void run(){
        try {
          byte[] peeked=queueFile.peek();
          if (peeked != null) {
            T peekedBatch=serializationStrategy.deserializeBatch(peeked);
            if (batch != null && batch.equals(peekedBatch)) {
              queueFile.remove();
            }
 else {
              throw new IllegalStateException("String_Node_Str" + peekedBatch + "String_Node_Str"+ batch);
            }
          }
        }
 catch (        DeserializeException e) {
          if (log.isErrorEnabled()) {
            log.error(e.getLocalizedMessage());
          }
          throw new IllegalStateException("String_Node_Str" + e.getRealException().getLocalizedMessage());
        }
catch (        IOException e) {
          if (log.isErrorEnabled()) {
            log.error(e.getLocalizedMessage());
          }
          throw new IllegalStateException("String_Node_Str" + e.getLocalizedMessage());
        }
        isWaitingToFinish=false;
        checkPendingAndContinue();
      }
    }
);
  }
}
Program: 81176
Project: 81176
Buggy source:
@Override public void onReady(BatchingStrategy<E,T> causingStrategy,final T batch){
  handler.post(new Runnable(){
    @Override public void run(){
      initializeIfRequired();
      try {
        queueFile.add(serializationStrategy.serializeBatch(batch));
        callPersistSuccess(batch);
      }
 catch (      Exception e) {
        if (log.isErrorEnabled()) {
          log.error(e.getLocalizedMessage());
        }
        callPersistFailure(batch,e);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void onReady(BatchingStrategy<E,T> causingStrategy,final T batch){
  handler.post(new Runnable(){
    @Override public void run(){
      initializeIfRequired();
      try {
        queueFile.add(serializationStrategy.serializeBatch(batch));
        checkPendingAndContinue();
      }
 catch (      Exception e) {
        if (log.isErrorEnabled()) {
          log.error(e.getLocalizedMessage());
        }
        callPersistFailure(batch,e);
      }
    }
  }
);
}
Program: 81177
Project: 81177
Buggy source:
@Override public E deserializeData(byte[] data) throws DeserializeException {
  checkIfBuildCalled();
  return (E)gson.fromJson(new String(data),Data.class);
}

Fixed version (ground truth):
@Override public E deserializeData(byte[] data) throws DeserializeException {
  checkIfBuildCalled();
  try {
    return (E)gson.fromJson(new String(data),Data.class);
  }
 catch (  JsonParseException e) {
    throw new DeserializeException(e);
  }
}
Program: 81178
Project: 81178
Buggy source:
@Override public byte[] serializeBatch(T batch) throws SerializeException {
  checkIfBuildCalled();
  return gson.toJson(batch,Batch.class).getBytes();
}

Fixed version (ground truth):
@Override public byte[] serializeBatch(T batch) throws SerializeException {
  checkIfBuildCalled();
  try {
    return gson.toJson(batch,Batch.class).getBytes();
  }
 catch (  JsonParseException e) {
    throw new SerializeException(e);
  }
}
Program: 81179
Project: 81179
Buggy source:
@Override public byte[] serializeCollection(Collection<E> data) throws SerializeException {
  checkIfBuildCalled();
  Type type=new TypeToken<Collection<Data>>(){
  }
.getType();
  return gson.toJson(data,type).getBytes();
}

Fixed version (ground truth):
@Override public byte[] serializeCollection(Collection<E> data) throws SerializeException {
  checkIfBuildCalled();
  Type type=new TypeToken<Collection<Data>>(){
  }
.getType();
  try {
    return gson.toJson(data,type).getBytes();
  }
 catch (  JsonParseException e) {
    throw new SerializeException(e);
  }
}
Program: 81180
Project: 81180
Buggy source:
@Override public byte[] serializeData(E data) throws SerializeException {
  checkIfBuildCalled();
  return gson.toJson(data,Data.class).getBytes();
}

Fixed version (ground truth):
@Override public byte[] serializeData(E data) throws SerializeException {
  checkIfBuildCalled();
  try {
    return gson.toJson(data,Data.class).getBytes();
  }
 catch (  JsonParseException e) {
    throw new SerializeException(e);
  }
}
Program: 81181
Project: 81181
Buggy source:
@Override public Collection<E> deserializeCollection(byte[] data) throws DeserializeException {
  checkIfBuildCalled();
  Type type=new TypeToken<Collection<Data>>(){
  }
.getType();
  return gson.fromJson(new String(data),type);
}

Fixed version (ground truth):
@Override public Collection<E> deserializeCollection(byte[] data) throws DeserializeException {
  checkIfBuildCalled();
  Type type=new TypeToken<Collection<Data>>(){
  }
.getType();
  try {
    return gson.fromJson(new String(data),type);
  }
 catch (  JsonParseException e) {
    throw new DeserializeException(e);
  }
}
Program: 81182
Project: 81182
Buggy source:
@Override public T deserializeBatch(byte[] data) throws DeserializeException {
  checkIfBuildCalled();
  return (T)gson.fromJson(new String(data),Batch.class);
}

Fixed version (ground truth):
@Override public T deserializeBatch(byte[] data) throws DeserializeException {
  checkIfBuildCalled();
  try {
    return (T)gson.fromJson(new String(data),Batch.class);
  }
 catch (  JsonParseException e) {
    throw new DeserializeException(e);
  }
}
Program: 81183
Project: 81183
Buggy source:
public static ArrayList<Data> fakeCollection(int size){
  ArrayList<Data> dataList=new ArrayList<>();
  for (int i=0; i < size; i++) {
    eventData=new EventData("String_Node_Str" + i);
    dataList.add(eventData);
  }
  return dataList;
}

Fixed version (ground truth):
public static ArrayList<Data> fakeCollection(int size){
  ArrayList<Data> dataList=new ArrayList<>();
  for (int i=0; i < size; i++) {
    eventData=new EventData("String_Node_Str" + i);
    eventData.setEventId(System.currentTimeMillis() + System.nanoTime() + i);
    dataList.add(eventData);
  }
  return dataList;
}
Program: 81184
Project: 81184
Buggy source:
public static ArrayList<TagData> fakeTagAdsCollection(int size){
  ArrayList<TagData> dataList=new ArrayList<>();
  for (int i=0; i < size; i++) {
    TagData eventData=new TagData(new Tag("String_Node_Str"),"String_Node_Str" + i);
    dataList.add(eventData);
  }
  return dataList;
}

Fixed version (ground truth):
public static ArrayList<TagData> fakeTagAdsCollection(int size){
  ArrayList<TagData> dataList=new ArrayList<>();
  for (int i=0; i < size; i++) {
    TagData eventData=new TagData(new Tag("String_Node_Str"),"String_Node_Str" + i);
    eventData.setEventId(System.currentTimeMillis() + System.nanoTime() + i);
    dataList.add(eventData);
  }
  return dataList;
}
Program: 81185
Project: 81185
Buggy source:
public static ArrayList<Data> fakeBuisnessCollection(int size){
  ArrayList<Data> dataList=new ArrayList<>();
  for (int i=0; i < size; i++) {
    eventData=new EventData("String_Node_Str" + i);
    dataList.add(eventData);
  }
  return dataList;
}

Fixed version (ground truth):
public static ArrayList<Data> fakeBuisnessCollection(int size){
  ArrayList<Data> dataList=new ArrayList<>();
  for (int i=0; i < size; i++) {
    eventData=new EventData("String_Node_Str" + i);
    eventData.setEventId(System.currentTimeMillis() + System.nanoTime() + i);
    dataList.add(eventData);
  }
  return dataList;
}
Program: 81186
Project: 81186
Buggy source:
public static ArrayList<Data> fakeAdsCollection(int size){
  ArrayList<Data> dataList=new ArrayList<>();
  for (int i=0; i < size; i++) {
    eventData=new EventData("String_Node_Str" + i);
    dataList.add(eventData);
  }
  return dataList;
}

Fixed version (ground truth):
public static ArrayList<Data> fakeAdsCollection(int size){
  ArrayList<Data> dataList=new ArrayList<>();
  for (int i=0; i < size; i++) {
    eventData=new EventData("String_Node_Str" + i);
    eventData.setEventId(System.currentTimeMillis() + System.nanoTime() + i);
    dataList.add(eventData);
  }
  return dataList;
}
Program: 81187
Project: 81187
Buggy source:
public static ArrayList<Data> fakeDebugCollection(int size){
  ArrayList<Data> dataList=new ArrayList<>();
  for (int i=0; i < size; i++) {
    eventData=new EventData("String_Node_Str" + i);
    dataList.add(eventData);
  }
  return dataList;
}

Fixed version (ground truth):
public static ArrayList<Data> fakeDebugCollection(int size){
  ArrayList<Data> dataList=new ArrayList<>();
  for (int i=0; i < size; i++) {
    eventData=new EventData("String_Node_Str" + i);
    eventData.setEventId(System.currentTimeMillis() + System.nanoTime() + i);
    dataList.add(eventData);
  }
  return dataList;
}
Program: 81188
Project: 81188
Buggy source:
public static ArrayList<TagData> fakeTagDebugCollection(int size){
  ArrayList<TagData> dataList=new ArrayList<>();
  for (int i=0; i < size; i++) {
    TagData eventData=new TagData(new Tag("String_Node_Str"),"String_Node_Str" + i);
    dataList.add(eventData);
  }
  return dataList;
}

Fixed version (ground truth):
public static ArrayList<TagData> fakeTagDebugCollection(int size){
  ArrayList<TagData> dataList=new ArrayList<>();
  for (int i=0; i < size; i++) {
    TagData eventData=new TagData(new Tag("String_Node_Str"),"String_Node_Str" + i);
    eventData.setEventId(System.currentTimeMillis() + System.nanoTime() + i);
    dataList.add(eventData);
  }
  return dataList;
}
Program: 81189
Project: 81189
Buggy source:
/** 
 * Test to verify   {@link JsonSyntaxException} is thrown, when the byte to be deserialized gets corrupted
 * @throws SerializeException
 * @throws DeserializeException
 */
@Test(expected=Exception.class) public void testIfExceptionThrownWhenCorrupt() throws SerializeException, DeserializeException {
  GsonSerializationStrategy<Data,Batch<Data>> serializationStrategy;
  ArrayList<Data> dataCollection=Utils.fakeCollection(4);
  serializationStrategy=new GsonSerializationStrategy<>();
  BatchManager.registerBuiltInTypes(serializationStrategy);
  serializationStrategy.build();
  Batch<Data> batch=new Batch<>(dataCollection);
  byte[] serializedData=serializationStrategy.serializeBatch(batch);
  try {
    String foo=new String(serializedData,"String_Node_Str");
    foo+="String_Node_Str";
    serializedData=foo.getBytes();
  }
 catch (  UnsupportedEncodingException e) {
    e.printStackTrace();
  }
  serializationStrategy.deserializeData(serializedData);
}

Fixed version (ground truth):
/** 
 * Test to verify   {@link JsonSyntaxException} is thrown, when the byte to be deserialized gets corrupted
 * @throws SerializeException
 * @throws DeserializeException
 */
@Test(expected=DeserializeException.class) public void testIfExceptionThrownWhenCorrupt() throws SerializeException, DeserializeException {
  GsonSerializationStrategy<Data,Batch<Data>> serializationStrategy;
  ArrayList<Data> dataCollection=Utils.fakeCollection(4);
  serializationStrategy=new GsonSerializationStrategy<>();
  BatchManager.registerBuiltInTypes(serializationStrategy);
  serializationStrategy.build();
  Batch<Data> batch=new Batch<>(dataCollection);
  byte[] serializedData=serializationStrategy.serializeBatch(batch);
  try {
    String foo=new String(serializedData,"String_Node_Str");
    foo+="String_Node_Str";
    serializedData=foo.getBytes();
  }
 catch (  UnsupportedEncodingException e) {
    e.printStackTrace();
  }
  serializationStrategy.deserializeData(serializedData);
}
Program: 81190
Project: 81190
Buggy source:
@Test(expected=Exception.class) public void testSerializeException(){
  PersistenceStrategy<Data> persistenceStrategy;
  Context context;
  context=RuntimeEnvironment.application;
  persistenceStrategy=new SQLPersistenceStrategy<>(new GsonSerializationStrategy<>(),"String_Node_Str",context);
  persistenceStrategy.onInitialized();
  persistenceStrategy.add(Utils.fakeCollection(4));
}

Fixed version (ground truth):
@Test(expected=Exception.class) public void testSerializeException(){
  PersistenceStrategy<Data> persistenceStrategy;
  Context context;
  context=RuntimeEnvironment.application;
  persistenceStrategy=new SQLPersistenceStrategy<>(new GsonSerializationStrategy<>(),createRandomString(),context);
  persistenceStrategy.onInitialized();
  persistenceStrategy.add(Utils.fakeCollection(4));
}
Program: 81191
Project: 81191
Buggy source:
/** 
 * Initialize the SQLPersistenceStrategy
 */
private PersistenceStrategy<Data> initializeSQLPersistence(){
  PersistenceStrategy<Data> persistenceStrategy;
  Context context;
  context=RuntimeEnvironment.application;
  SerializationStrategy serializationStrategy=new GsonSerializationStrategy();
  BatchManager.registerBuiltInTypes(serializationStrategy);
  serializationStrategy.build();
  persistenceStrategy=new SQLPersistenceStrategy<>(serializationStrategy,"String_Node_Str",context);
  persistenceStrategy.onInitialized();
  return persistenceStrategy;
}

Fixed version (ground truth):
/** 
 * Initialize the SQLPersistenceStrategy
 */
private PersistenceStrategy<Data> initializeSQLPersistence(){
  PersistenceStrategy<Data> persistenceStrategy;
  Context context;
  context=RuntimeEnvironment.application;
  SerializationStrategy serializationStrategy=new GsonSerializationStrategy();
  BatchManager.registerBuiltInTypes(serializationStrategy);
  serializationStrategy.build();
  persistenceStrategy=new SQLPersistenceStrategy<>(serializationStrategy,createRandomString(),context);
  persistenceStrategy.onInitialized();
  return persistenceStrategy;
}
Program: 81192
Project: 81192
Buggy source:
@Override public void run(){
  assignEventIds(dataCollection);
  logEvents(dataCollection);
  if (batchingStrategy.isInitialized()) {
    batchingStrategy.onDataPushed(dataCollection);
    batchingStrategy.flush(false);
  }
 else {
    throw new IllegalAccessError("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void run(){
  batchingStrategy.flush(forced);
}