nus-yam/ex-repair huggingface dataset:
Program: 162778
Project: 162778
Buggy source:
@Override public Iterable<String> buildUpdates(JavaPairRDD<String,String> newData){
  if (model == null) {
    return Collections.emptyList();
  }
  JavaRDD<Example> examplesRDD=newData.values().map(MLFunctions.PARSE_FN).map(new ToExampleFn(inputSchema,model.getEncodings()));
  DecisionForest forest=model.getForest();
  JavaPairRDD<Pair<Integer,String>,Iterable<Feature>> targetsByTreeAndID=examplesRDD.flatMapToPair(new ToTreeNodeFeatureFn(forest)).groupByKey();
  List<String> updates=new ArrayList<>();
  if (inputSchema.isClassification()) {
    List<Tuple2<Pair<Integer,String>,Map<Integer,Long>>> countsByTreeAndID=targetsByTreeAndID.mapValues(new TargetCategoryCountFn()).collect();
    for (    Tuple2<Pair<Integer,String>,Map<Integer,Long>> p : countsByTreeAndID) {
      Object[] updateTokens={p._1().getFirst(),p._1().getSecond(),p._2()};
      updates.add(TextUtils.joinJSON(Arrays.asList(updateTokens)));
    }
  }
 else {
    List<Tuple2<Pair<Integer,String>,Mean>> meanTargetsByTreeAndID=targetsByTreeAndID.mapValues(new MeanNewTargetFn()).collect();
    for (    Tuple2<Pair<Integer,String>,Mean> p : meanTargetsByTreeAndID) {
      Mean mean=p._2();
      Object[] updateTokens={p._1().getFirst(),p._1().getSecond(),mean.getResult(),mean.getN()};
      updates.add(TextUtils.joinJSON(Arrays.asList(updateTokens)));
    }
  }
  return updates;
}

Fixed version (ground truth):
@Override public Iterable<String> buildUpdates(JavaPairRDD<String,String> newData){
  if (model == null) {
    return Collections.emptyList();
  }
  JavaRDD<Example> examplesRDD=newData.values().map(MLFunctions.PARSE_FN).map(new ToExampleFn(inputSchema,model.getEncodings()));
  DecisionForest forest=model.getForest();
  JavaPairRDD<Pair<Integer,String>,Iterable<Feature>> targetsByTreeAndID=examplesRDD.flatMapToPair(new ToTreeNodeFeatureFn(forest)).groupByKey();
  List<String> updates=new ArrayList<>();
  if (inputSchema.isClassification()) {
    List<Tuple2<Pair<Integer,String>,Map<Integer,Long>>> countsByTreeAndID=targetsByTreeAndID.mapValues(new TargetCategoryCountFn()).collect();
    for (    Tuple2<Pair<Integer,String>,Map<Integer,Long>> p : countsByTreeAndID) {
      Integer treeID=p._1().getFirst();
      String nodeID=p._1().getSecond();
      updates.add(TextUtils.joinJSON(Arrays.asList(treeID,nodeID,p._2())));
    }
  }
 else {
    List<Tuple2<Pair<Integer,String>,Mean>> meanTargetsByTreeAndID=targetsByTreeAndID.mapValues(new MeanNewTargetFn()).collect();
    for (    Tuple2<Pair<Integer,String>,Mean> p : meanTargetsByTreeAndID) {
      Integer treeID=p._1().getFirst();
      String nodeID=p._1().getSecond();
      Mean mean=p._2();
      updates.add(TextUtils.joinJSON(Arrays.asList(treeID,nodeID,mean.getResult(),mean.getN())));
    }
  }
  return updates;
}
Program: 162779
Project: 162779
Buggy source:
@Override public Pair<String,String> generate(int id,RandomGenerator random){
  PMML pmml=PMMLUtils.buildSkeletonPMML();
  double dummyCount=2.0 * (id + 1);
  DataDictionary dataDictionary=new DataDictionary();
  dataDictionary.setNumberOfFields(2);
  DataField predictor=new DataField(new FieldName("String_Node_Str"),OpType.CATEGORICAL,DataType.STRING);
  predictor.getValues().add(new Value("String_Node_Str"));
  predictor.getValues().add(new Value("String_Node_Str"));
  dataDictionary.getDataFields().add(predictor);
  DataField target=new DataField(new FieldName("String_Node_Str"),OpType.CATEGORICAL,DataType.STRING);
  target.getValues().add(new Value("String_Node_Str"));
  target.getValues().add(new Value("String_Node_Str"));
  dataDictionary.getDataFields().add(target);
  pmml.setDataDictionary(dataDictionary);
  MiningSchema miningSchema=new MiningSchema();
  MiningField predictorMF=new MiningField(new FieldName("String_Node_Str"));
  predictorMF.setOptype(OpType.CATEGORICAL);
  predictorMF.setUsageType(FieldUsageType.ACTIVE);
  predictorMF.setImportance(0.5);
  miningSchema.getMiningFields().add(predictorMF);
  MiningField targetMF=new MiningField(new FieldName("String_Node_Str"));
  targetMF.setOptype(OpType.CATEGORICAL);
  targetMF.setUsageType(FieldUsageType.PREDICTED);
  miningSchema.getMiningFields().add(targetMF);
  Node rootNode=new Node();
  rootNode.setId("String_Node_Str");
  rootNode.setRecordCount(dummyCount);
  rootNode.setPredicate(new True());
  double halfCount=dummyCount / 2;
  Node left=new Node();
  left.setId("String_Node_Str");
  left.setRecordCount(halfCount);
  left.setPredicate(new True());
  left.getScoreDistributions().add(new ScoreDistribution("String_Node_Str",halfCount));
  Node right=new Node();
  right.setId("String_Node_Str");
  right.setRecordCount(halfCount);
  right.setPredicate(new SimpleSetPredicate(new Array("String_Node_Str",Array.Type.STRING),new FieldName("String_Node_Str"),SimpleSetPredicate.BooleanOperator.IS_NOT_IN));
  right.getScoreDistributions().add(new ScoreDistribution("String_Node_Str",halfCount));
  rootNode.getNodes().add(right);
  rootNode.getNodes().add(left);
  TreeModel treeModel=new TreeModel(miningSchema,rootNode,MiningFunctionType.CLASSIFICATION);
  treeModel.setSplitCharacteristic(TreeModel.SplitCharacteristic.BINARY_SPLIT);
  treeModel.setMissingValueStrategy(MissingValueStrategyType.DEFAULT_CHILD);
  treeModel.setMiningSchema(miningSchema);
  pmml.getModels().add(treeModel);
  return new Pair<>("String_Node_Str",PMMLUtils.toString(pmml));
}

Fixed version (ground truth):
@Override public Pair<String,String> generate(int id,RandomGenerator random){
  if (id == 0) {
    PMML pmml=buildModel();
    return new Pair<>("String_Node_Str",PMMLUtils.toString(pmml));
  }
 else {
    String nodeID="String_Node_Str" + ((id % 2 == 0) ? '-' : '+');
    Map<Integer,Integer> counts=new HashMap<>();
    counts.put(0,1);
    counts.put(1,2);
    return new Pair<>("String_Node_Str",TextUtils.joinJSON(Arrays.asList(0,nodeID,counts)));
  }
}
Program: 162780
Project: 162780
Buggy source:
@GET @Produces(MediaType.TEXT_HTML) public String error(@Context HttpServletRequest request){
  StringBuilder html=new StringBuilder(1000);
  html.append("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  html.append("String_Node_Str");
  Object statusCode=request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
  if (statusCode != null) {
    html.append(' ').append(statusCode);
  }
  html.append("String_Node_Str");
  Object requestURI=request.getAttribute(RequestDispatcher.ERROR_REQUEST_URI);
  if (requestURI != null) {
    html.append("String_Node_Str");
    html.append(JspHelper.escapeXml(requestURI));
  }
  html.append("String_Node_Str");
  Object message=request.getAttribute(RequestDispatcher.ERROR_MESSAGE);
  if (message != null) {
    html.append("String_Node_Str");
    html.append(JspHelper.escapeXml(message));
    html.append("String_Node_Str");
  }
  Throwable throwable=(Throwable)request.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
  if (throwable != null) {
    StringWriter sw=new StringWriter();
    throwable.printStackTrace(new PrintWriter(sw));
    html.append("String_Node_Str");
    html.append(JspHelper.escapeXml(sw.toString()));
    html.append("String_Node_Str");
  }
  html.append("String_Node_Str");
  return html.toString();
}

Fixed version (ground truth):
@GET @Produces(MediaType.TEXT_HTML) public Response error(@Context HttpServletRequest request){
  StringBuilder html=new StringBuilder(1000);
  html.append("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  html.append("String_Node_Str");
  Number statusCode=(Number)request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
  if (statusCode != null) {
    html.append(' ').append(statusCode);
  }
  html.append("String_Node_Str");
  Object requestURI=request.getAttribute(RequestDispatcher.ERROR_REQUEST_URI);
  if (requestURI != null) {
    html.append("String_Node_Str");
    html.append(JspHelper.escapeXml(requestURI));
  }
  html.append("String_Node_Str");
  Object message=request.getAttribute(RequestDispatcher.ERROR_MESSAGE);
  if (message != null) {
    html.append("String_Node_Str");
    html.append(JspHelper.escapeXml(message));
    html.append("String_Node_Str");
  }
  Throwable throwable=(Throwable)request.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
  if (throwable != null) {
    StringWriter sw=new StringWriter();
    throwable.printStackTrace(new PrintWriter(sw));
    html.append("String_Node_Str");
    html.append(JspHelper.escapeXml(sw.toString()));
    html.append("String_Node_Str");
  }
  html.append("String_Node_Str");
  Response.Status finalStatus=statusCode == null ? Response.Status.OK : Response.Status.fromStatusCode(statusCode.intValue());
  return Response.status(finalStatus).entity(html.toString()).build();
}
Program: 162781
Project: 162781
Buggy source:
@Test public void testError(){
  MockHttpServletRequest mockRequest=new MockHttpServletRequest();
  mockRequest.setAttribute(RequestDispatcher.ERROR_STATUS_CODE,500);
  mockRequest.setAttribute(RequestDispatcher.ERROR_REQUEST_URI,"String_Node_Str");
  mockRequest.setAttribute(RequestDispatcher.ERROR_MESSAGE,"String_Node_Str");
  mockRequest.setAttribute(RequestDispatcher.ERROR_EXCEPTION,new IllegalStateException());
  String response=new ErrorResource().error(mockRequest);
  assertTrue(response.contains("String_Node_Str"));
  assertTrue(response.contains("String_Node_Str"));
  assertTrue(response.contains("String_Node_Str"));
  assertTrue(response.contains("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testError(){
  MockHttpServletRequest mockRequest=new MockHttpServletRequest();
  mockRequest.setAttribute(RequestDispatcher.ERROR_STATUS_CODE,500);
  mockRequest.setAttribute(RequestDispatcher.ERROR_REQUEST_URI,"String_Node_Str");
  mockRequest.setAttribute(RequestDispatcher.ERROR_MESSAGE,"String_Node_Str");
  mockRequest.setAttribute(RequestDispatcher.ERROR_EXCEPTION,new IllegalStateException());
  Response response=new ErrorResource().error(mockRequest);
  assertEquals(500,response.getStatus());
  String responseBody=response.getEntity().toString();
  assertTrue(responseBody.contains("String_Node_Str"));
  assertTrue(responseBody.contains("String_Node_Str"));
  assertTrue(responseBody.contains("String_Node_Str"));
  assertTrue(responseBody.contains("String_Node_Str"));
}
Program: 162782
Project: 162782
Buggy source:
@Test public void testServingLayerSecure() throws Exception {
  Path keystoreFile=SecureAPIConfigIT.buildKeystoreFile();
  Map<String,Object> overlay=buildOverlay();
  overlay.put("String_Node_Str","String_Node_Str" + keystoreFile + "String_Node_Str");
  overlay.put("String_Node_Str","String_Node_Str");
  Config config=ConfigUtils.overlayOn(overlay,ConfigUtils.getDefault());
  doTestServingLayer(config);
}

Fixed version (ground truth):
@Test public void testServingLayerSecure() throws Exception {
  Path keystoreFile=SecureAPIConfigIT.buildKeystoreFile();
  Map<String,Object> overlay=buildOverlay();
  overlay.put("String_Node_Str","String_Node_Str" + keystoreFile + "String_Node_Str");
  overlay.put("String_Node_Str","String_Node_Str");
  Config config=ConfigUtils.overlayOn(overlay,ConfigUtils.getDefault());
  try {
    doTestServingLayer(config);
  }
  finally {
    Files.delete(Paths.get(config.getString("String_Node_Str")));
  }
}
Program: 162783
Project: 162783
Buggy source:
@Override public Void call(JavaPairRDD<K,M> newData,Time timestamp) throws IOException, InterruptedException {
  long count=newData.count();
  if (count == 0) {
    log.info("String_Node_Str");
    return null;
  }
  log.info("String_Node_Str",count);
  Configuration hadoopConf=sparkContext.hadoopConfiguration();
  JavaPairRDD<K,M> pastData;
  Path inputPathPattern=new Path(dataDirString + "String_Node_Str");
  FileSystem fs=FileSystem.get(hadoopConf);
  FileStatus[] inputPathStatuses=fs.globStatus(inputPathPattern);
  if (inputPathStatuses == null || inputPathStatuses.length == 0) {
    log.info("String_Node_Str",inputPathPattern);
    pastData=null;
  }
 else {
    log.info("String_Node_Str",inputPathStatuses[0].getPath());
    Configuration updatedConf=new Configuration(hadoopConf);
    updatedConf.set(FileInputFormat.INPUT_DIR,joinFSPaths(fs,inputPathStatuses));
    @SuppressWarnings("String_Node_Str") JavaPairRDD<Writable,Writable> pastWritableData=(JavaPairRDD<Writable,Writable>)sparkContext.newAPIHadoopRDD(updatedConf,SequenceFileInputFormat.class,keyWritableClass,messageWritableClass);
    pastData=pastWritableData.mapToPair(new WritableToValueFunction<>(keyClass,messageClass,keyWritableClass,messageWritableClass));
  }
  try (TopicProducer<String,U> producer=new TopicProducerImpl<>(updateBroker,updateTopic)){
    updateInstance.runUpdate(sparkContext,timestamp.milliseconds(),newData,pastData,modelDirString,producer);
  }
   return null;
}

Fixed version (ground truth):
@Override public Void call(JavaPairRDD<K,M> newData,Time timestamp) throws IOException, InterruptedException {
  if (newData.take(1).isEmpty()) {
    log.info("String_Node_Str");
    return null;
  }
  log.info("String_Node_Str",timestamp);
  Configuration hadoopConf=sparkContext.hadoopConfiguration();
  JavaPairRDD<K,M> pastData;
  Path inputPathPattern=new Path(dataDirString + "String_Node_Str");
  FileSystem fs=FileSystem.get(hadoopConf);
  FileStatus[] inputPathStatuses=fs.globStatus(inputPathPattern);
  if (inputPathStatuses == null || inputPathStatuses.length == 0) {
    log.info("String_Node_Str",inputPathPattern);
    pastData=null;
  }
 else {
    log.info("String_Node_Str",inputPathStatuses[0].getPath());
    Configuration updatedConf=new Configuration(hadoopConf);
    updatedConf.set(FileInputFormat.INPUT_DIR,joinFSPaths(fs,inputPathStatuses));
    @SuppressWarnings("String_Node_Str") JavaPairRDD<Writable,Writable> pastWritableData=(JavaPairRDD<Writable,Writable>)sparkContext.newAPIHadoopRDD(updatedConf,SequenceFileInputFormat.class,keyWritableClass,messageWritableClass);
    pastData=pastWritableData.mapToPair(new WritableToValueFunction<>(keyClass,messageClass,keyWritableClass,messageWritableClass));
  }
  try (TopicProducer<String,U> producer=new TopicProducerImpl<>(updateBroker,updateTopic)){
    updateInstance.runUpdate(sparkContext,timestamp.milliseconds(),newData,pastData,modelDirString,producer);
  }
   return null;
}
Program: 162784
Project: 162784
Buggy source:
@Override public Void call(JavaPairRDD<Writable,Writable> rdd,Time time){
  long count=rdd.count();
  if (count > 0) {
    String file=prefix + "String_Node_Str" + time.milliseconds()+ "String_Node_Str"+ suffix;
    log.info("String_Node_Str",count,file);
    rdd.saveAsNewAPIHadoopFile(file,keyWritableClass,messageWritableClass,outputFormatClass,hadoopConf);
  }
 else {
    log.info("String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
@Override public Void call(JavaPairRDD<Writable,Writable> rdd,Time time){
  if (rdd.take(1).isEmpty()) {
    log.info("String_Node_Str");
  }
 else {
    String file=prefix + "String_Node_Str" + time.milliseconds()+ "String_Node_Str"+ suffix;
    log.info("String_Node_Str",file);
    rdd.saveAsNewAPIHadoopFile(file,keyWritableClass,messageWritableClass,outputFormatClass,hadoopConf);
  }
  return null;
}
Program: 162785
Project: 162785
Buggy source:
@Override public Void call(JavaPairRDD<K,M> newData) throws IOException {
  long count=newData.count();
  if (count > 0) {
    log.info("String_Node_Str",count);
    try (TopicProducer<String,U> producer=new TopicProducerImpl<>(updateBroker,updateTopic)){
      for (      U update : modelManager.buildUpdates(newData)) {
        producer.send("String_Node_Str",update);
      }
    }
   }
 else {
    log.debug("String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
@Override public Void call(JavaPairRDD<K,M> newData) throws IOException {
  if (newData.take(1).isEmpty()) {
    log.debug("String_Node_Str");
  }
 else {
    log.info("String_Node_Str");
    try (TopicProducer<String,U> producer=new TopicProducerImpl<>(updateBroker,updateTopic)){
      for (      U update : modelManager.buildUpdates(newData)) {
        producer.send("String_Node_Str",update);
      }
    }
   }
  return null;
}
Program: 162788
Project: 162788
Buggy source:
private Pair<JavaRDD<M>,JavaRDD<M>> splitTrainTest(JavaRDD<M> newData,JavaRDD<M> pastData){
  Preconditions.checkNotNull(newData);
  if (testFraction <= 0.0) {
    return new Pair<>(pastData == null ? newData : newData.union(pastData),null);
  }
  if (testFraction >= 1.0) {
    return new Pair<>(pastData,newData);
  }
  if (newData.count() == 0) {
    return new Pair<>(pastData,null);
  }
  Pair<JavaRDD<M>,JavaRDD<M>> newTrainTest=splitNewDataToTrainTest(newData);
  JavaRDD<M> newTrainData=newTrainTest.getFirst();
  return new Pair<>(pastData == null ? newTrainData : newTrainData.union(pastData),newTrainTest.getSecond());
}

Fixed version (ground truth):
private Pair<JavaRDD<M>,JavaRDD<M>> splitTrainTest(JavaRDD<M> newData,JavaRDD<M> pastData){
  Preconditions.checkNotNull(newData);
  if (testFraction <= 0.0) {
    return new Pair<>(pastData == null ? newData : newData.union(pastData),null);
  }
  if (testFraction >= 1.0) {
    return new Pair<>(pastData,newData);
  }
  if (empty(newData)) {
    return new Pair<>(pastData,null);
  }
  Pair<JavaRDD<M>,JavaRDD<M>> newTrainTest=splitNewDataToTrainTest(newData);
  JavaRDD<M> newTrainData=newTrainTest.getFirst();
  return new Pair<>(pastData == null ? newTrainData : newTrainData.union(pastData),newTrainTest.getSecond());
}
Program: 162789
Project: 162789
Buggy source:
@Override public Prediction apply(DecisionTree tree){
  return tree.classify(test);
}

Fixed version (ground truth):
@Override public Prediction apply(DecisionTree tree){
  return tree.predict(test);
}
Program: 162790
Project: 162790
Buggy source:
/** 
 * @param predictorIndex index (0-based) among only predictors (not ID, not ignored, not target)
 * @return index (0-based) among all features
 */
public int predictorToFeatureIndex(int predictorIndex){
  Integer featureIndex=allToPredictorMap.inverse().get(predictorIndex);
  Preconditions.checkArgument(featureIndex != null);
  return featureIndex;
}

Fixed version (ground truth):
/** 
 * @param predictorIndex index (0-based) among only predictors (not ID, not ignored, not target)
 * @return index (0-based) among all features
 */
public int predictorToFeatureIndex(int predictorIndex){
  Integer featureIndex=allToPredictorMap.inverse().get(predictorIndex);
  Preconditions.checkArgument(featureIndex != null,"String_Node_Str",predictorIndex);
  return featureIndex;
}
Program: 162791
Project: 162791
Buggy source:
/** 
 * @param featureIndex index (0-based) among all features
 * @return index (0-based) among only predictors (not ID, not ignored, not target)
 */
public int featureToPredictorIndex(int featureIndex){
  Integer predictorIndex=allToPredictorMap.get(featureIndex);
  Preconditions.checkArgument(predictorIndex != null);
  return predictorIndex;
}

Fixed version (ground truth):
/** 
 * @param featureIndex index (0-based) among all features
 * @return index (0-based) among only predictors (not ID, not ignored, not target)
 */
public int featureToPredictorIndex(int featureIndex){
  Integer predictorIndex=allToPredictorMap.get(featureIndex);
  Preconditions.checkArgument(predictorIndex != null,"String_Node_Str",featureIndex);
  return predictorIndex;
}
Program: 162792
Project: 162792
Buggy source:
@Override public Boolean call(Example example){
  CategoricalPrediction prediction=(CategoricalPrediction)forest.classify(example);
  CategoricalFeature target=(CategoricalFeature)example.getTarget();
  return prediction.getMostProbableCategoryEncoding() == target.getEncoding();
}

Fixed version (ground truth):
@Override public Boolean call(Example example){
  CategoricalPrediction prediction=(CategoricalPrediction)forest.predict(example);
  CategoricalFeature target=(CategoricalFeature)example.getTarget();
  return prediction.getMostProbableCategoryEncoding() == target.getEncoding();
}
Program: 162793
Project: 162793
Buggy source:
static double rmse(final DecisionForest forest,JavaRDD<Example> examples){
  double mse=examples.mapToDouble(new DoubleFunction<Example>(){
    @Override public double call(    Example example){
      NumericPrediction prediction=(NumericPrediction)forest.classify(example);
      NumericFeature target=(NumericFeature)example.getTarget();
      double diff=prediction.getPrediction() - target.getValue();
      return diff * diff;
    }
  }
).mean();
  return Math.sqrt(mse);
}

Fixed version (ground truth):
static double rmse(final DecisionForest forest,JavaRDD<Example> examples){
  double mse=examples.mapToDouble(new DoubleFunction<Example>(){
    @Override public double call(    Example example){
      NumericPrediction prediction=(NumericPrediction)forest.predict(example);
      NumericFeature target=(NumericFeature)example.getTarget();
      double diff=prediction.getPrediction() - target.getValue();
      return diff * diff;
    }
  }
).mean();
  return Math.sqrt(mse);
}
Program: 162794
Project: 162794
Buggy source:
static double accuracy(final DecisionForest forest,JavaRDD<Example> examples){
  long total=examples.count();
  long correct=examples.filter(new Function<Example,Boolean>(){
    @Override public Boolean call(    Example example){
      CategoricalPrediction prediction=(CategoricalPrediction)forest.classify(example);
      CategoricalFeature target=(CategoricalFeature)example.getTarget();
      return prediction.getMostProbableCategoryEncoding() == target.getEncoding();
    }
  }
).count();
  return (double)correct / total;
}

Fixed version (ground truth):
static double accuracy(final DecisionForest forest,JavaRDD<Example> examples){
  long total=examples.count();
  long correct=examples.filter(new Function<Example,Boolean>(){
    @Override public Boolean call(    Example example){
      CategoricalPrediction prediction=(CategoricalPrediction)forest.predict(example);
      CategoricalFeature target=(CategoricalFeature)example.getTarget();
      return prediction.getMostProbableCategoryEncoding() == target.getEncoding();
    }
  }
).count();
  return (double)correct / total;
}
Program: 162797
Project: 162797
Buggy source:
protected static void checkExtensions(PMML pmml,Map<String,?> expected){
  for (  Map.Entry<String,?> e : expected.entrySet()) {
    assertEquals(e.getValue().toString(),AppPMMLUtils.getExtensionValue(pmml,e.getKey()));
  }
}

Fixed version (ground truth):
protected static void checkExtensions(PMML pmml,Map<String,?> expected){
  for (  Map.Entry<String,?> e : expected.entrySet()) {
    String key=e.getKey();
    assertEquals("String_Node_Str" + key + "String_Node_Str",e.getValue().toString(),AppPMMLUtils.getExtensionValue(pmml,key));
  }
}
Program: 162799
Project: 162799
Buggy source:
protected static void checkDataDictionary(InputSchema schema,DataDictionary dataDictionary){
  assertNotNull(dataDictionary);
  assertEquals(schema.getNumFeatures(),dataDictionary.getNumberOfFields().intValue());
  List<DataField> dataFields=dataDictionary.getDataFields();
  assertEquals(schema.getNumFeatures(),dataFields.size());
  for (  DataField dataField : dataFields) {
    String featureName=dataField.getName().getValue();
    if (schema.isNumeric(featureName)) {
      assertEquals(OpType.CONTINUOUS,dataField.getOptype());
      assertEquals(DataType.DOUBLE,dataField.getDataType());
    }
 else     if (schema.isCategorical(featureName)) {
      assertEquals(OpType.CATEGORICAL,dataField.getOptype());
      assertEquals(DataType.STRING,dataField.getDataType());
    }
 else {
      assertNull(dataField.getOptype());
      assertNull(dataField.getDataType());
    }
  }
}

Fixed version (ground truth):
protected static void checkDataDictionary(InputSchema schema,DataDictionary dataDictionary){
  assertNotNull(dataDictionary);
  assertEquals("String_Node_Str",schema.getNumFeatures(),dataDictionary.getNumberOfFields().intValue());
  List<DataField> dataFields=dataDictionary.getDataFields();
  assertEquals(schema.getNumFeatures(),dataFields.size());
  for (  DataField dataField : dataFields) {
    String featureName=dataField.getName().getValue();
    if (schema.isNumeric(featureName)) {
      assertEquals("String_Node_Str" + featureName,OpType.CONTINUOUS,dataField.getOptype());
      assertEquals("String_Node_Str" + featureName,DataType.DOUBLE,dataField.getDataType());
    }
 else     if (schema.isCategorical(featureName)) {
      assertEquals("String_Node_Str" + featureName,OpType.CATEGORICAL,dataField.getOptype());
      assertEquals("String_Node_Str" + featureName,DataType.STRING,dataField.getDataType());
    }
 else {
      assertNull(dataField.getOptype());
      assertNull(dataField.getDataType());
    }
  }
}
Program: 162802
Project: 162802
Buggy source:
private static BufferedReader buildReader(String contentEncoding,InputStream in) throws IOException {
switch (contentEncoding) {
case "String_Node_Str":
    in=new ZipInputStream(in);
  break;
case "String_Node_Str":
case "String_Node_Str":
in=new GZIPInputStream(in);
break;
}
return new BufferedReader(new InputStreamReader(in,StandardCharsets.UTF_8));
}

Fixed version (ground truth):
private static BufferedReader buildReader(String contentEncoding,InputStream in) throws IOException {
  if (contentEncoding != null) {
switch (contentEncoding) {
case "String_Node_Str":
      in=new ZipInputStream(in);
    break;
case "String_Node_Str":
case "String_Node_Str":
  in=new GZIPInputStream(in);
break;
}
}
return new BufferedReader(new InputStreamReader(in,StandardCharsets.UTF_8));
}
Program: 162803
Project: 162803
Buggy source:
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public List<Double> getEstimatePreferences(@PathParam("String_Node_Str") final Integer userID,@PathParam("String_Node_Str") final List<PathSegment> pathSegmentsList){
  ALSServingModelManager alsServingModelManager=(ALSServingModelManager)servletContext.getAttribute("String_Node_Str");
  ALSServingModel alsServingModel=alsServingModelManager.getModel();
  List<Integer> itemIdsList=new ArrayList<>(pathSegmentsList.size());
  for (  PathSegment pathSegment : pathSegmentsList) {
    itemIdsList.add(Integer.valueOf(pathSegment.getPath()));
  }
  return alsServingModel.estimatePreference(userID,itemIdsList);
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public List<Double> getEstimatePreferences(@PathParam("String_Node_Str") Integer userID,@PathParam("String_Node_Str") List<PathSegment> pathSegmentsList){
  ALSServingModelManager alsServingModelManager=(ALSServingModelManager)servletContext.getAttribute("String_Node_Str");
  ALSServingModel alsServingModel=alsServingModelManager.getModel();
  List<Integer> itemIdsList=new ArrayList<>(pathSegmentsList.size());
  for (  PathSegment pathSegment : pathSegmentsList) {
    itemIdsList.add(Integer.valueOf(pathSegment.getPath()));
  }
  return alsServingModel.estimatePreference(userID,itemIdsList);
}
Program: 162804
Project: 162804
Buggy source:
@GET @Produces(MediaType.APPLICATION_JSON) @Path("String_Node_Str") public List<Double> getEstimatesForAnonymous(@PathParam("String_Node_Str") final int toItemID,@PathParam("String_Node_Str") final List<PathSegment> pathSegmentList){
  ALSServingModelManager alsServingModelManager=(ALSServingModelManager)servletContext.getAttribute("String_Node_Str");
  ALSServingModel alsServingModel=alsServingModelManager.getModel();
  List<Integer> itemIdList=new ArrayList<>(pathSegmentList.size());
  for (  PathSegment pathSegment : pathSegmentList) {
    itemIdList.add(Integer.valueOf(pathSegment.getPath()));
  }
{
  }
  return Arrays.asList(1.2,3.4);
}

Fixed version (ground truth):
@GET @Produces(MediaType.APPLICATION_JSON) @Path("String_Node_Str") public List<Double> getEstimatesForAnonymous(@PathParam("String_Node_Str") int toItemID,@PathParam("String_Node_Str") List<PathSegment> pathSegmentList){
  ALSServingModelManager alsServingModelManager=(ALSServingModelManager)servletContext.getAttribute("String_Node_Str");
  ALSServingModel alsServingModel=alsServingModelManager.getModel();
  List<Integer> itemIdList=new ArrayList<>(pathSegmentList.size());
  for (  PathSegment pathSegment : pathSegmentList) {
    itemIdList.add(Integer.valueOf(pathSegment.getPath()));
  }
{
  }
  return Arrays.asList(1.2,3.4);
}
Program: 162805
Project: 162805
Buggy source:
/** 
 * android-changed Android does not use a SecurityManager. This will simply execute the runnable ingoring permisions.
 */
public void runWithPermissions(Runnable r,Permission... permissions){
  r.run();
}

Fixed version (ground truth):
/** 
 * android-changed Android does not use a SecurityManager. This will simply execute the runnable ignoring permissions.
 */
public void runWithPermissions(Runnable r,Permission... permissions){
  r.run();
}
Program: 162806
Project: 162806
Buggy source:
/** 
 * android-changed Android does not use a SecurityManager. This will simply execute the runnable ingoring permisions.
 */
public void runWithSecurityManagerWithPermissions(Runnable r,Permission... permissions){
  r.run();
}

Fixed version (ground truth):
/** 
 * android-changed Android does not use a SecurityManager. This will simply execute the runnable ignoring permissions.
 */
public void runWithSecurityManagerWithPermissions(Runnable r,Permission... permissions){
  r.run();
}
Program: 162807
Project: 162807
Buggy source:
/** 
 * Create a ProcessInstanceLimiter instance using the default shareed file named ProcessInstanceLimiter_DEFAULT_SHARED_MAP_ in the tmp directory.
 * @param sharedMapPath - The path to a file which will be used to store the sharedmap (the file need not pre-exist)
 * @param callback      - An instance of the Callback interface, which will receivecallbacks
 * @throws IOException - if the default shared file cannot be created
 */
public ProcessInstanceLimiter(String sharedMapPath,Callback callback) throws IOException {
  this.sharedMapPath=sharedMapPath;
  this.callback=callback;
  ChronicleMapBuilder<String,Data> builder=ChronicleMapBuilder.of(String.class,Data.class);
  builder.entries(1000);
  builder.averageKeySize((DEFAULT_PROCESS_NAME + "String_Node_Str").length());
  this.theSharedMap=builder.createPersistedTo(new File(sharedMapPath));
  Thread t=new Thread(this,"String_Node_Str");
  t.setDaemon(true);
  t.start();
}

Fixed version (ground truth):
/** 
 * Create a ProcessInstanceLimiter instance using the default shared file named ProcessInstanceLimiter_DEFAULT_SHARED_MAP_ in the tmp directory.
 * @param sharedMapPath - The path to a file which will be used to store the sharedmap (the file need not pre-exist)
 * @param callback      - An instance of the Callback interface, which will receivecallbacks
 * @throws IOException - if the default shared file cannot be created
 */
public ProcessInstanceLimiter(String sharedMapPath,Callback callback) throws IOException {
  this.sharedMapPath=sharedMapPath;
  this.callback=callback;
  ChronicleMapBuilder<String,Data> builder=ChronicleMapBuilder.of(String.class,Data.class);
  builder.entries(1000);
  builder.averageKeySize((DEFAULT_PROCESS_NAME + "String_Node_Str").length());
  this.theSharedMap=builder.createPersistedTo(new File(sharedMapPath));
  Thread t=new Thread(this,"String_Node_Str");
  t.setDaemon(true);
  t.start();
}
Program: 162808
Project: 162808
Buggy source:
@Override public ByteBuffer getUsing(@Nullable ByteBuffer using){
  if (using == null || using.capacity() < bb.remaining()) {
    using=ByteBuffer.allocate(bb.remaining());
  }
 else {
    using.position(0);
    using.limit(bb.capacity());
  }
  bytes.bytesStore(bytesStore,bb.position(),bb.remaining());
  bytes.read(using);
  using.flip();
  return using;
}

Fixed version (ground truth):
@Override public ByteBuffer getUsing(@Nullable ByteBuffer using){
  if (using == null || using.capacity() < bb.remaining()) {
    using=ByteBuffer.allocate(bb.remaining());
  }
 else {
    using.position(0);
    using.limit(bb.remaining());
  }
  bytes.bytesStore(bytesStore,bb.position(),bb.remaining());
  bytes.read(using);
  using.flip();
  return using;
}
Program: 162809
Project: 162809
Buggy source:
@NotNull @Override public List<T> read(Bytes in,@Nullable List<T> using){
  int size=in.readInt();
  if (using == null) {
    using=new ArrayList<>(size);
  }
 else   if (using.size() < size) {
    while (using.size() < size) {
      using.add(null);
    }
  }
 else   if (using.size() > size) {
    using.subList(size,using.size()).clear();
  }
  for (int i=0; i < size; i++) {
    using.set(i,elementReader.read(in,using.get(i)));
  }
  return using;
}

Fixed version (ground truth):
@NotNull @Override public List<T> read(Bytes in,@Nullable List<T> using){
  int size=in.readInt();
  if (using == null) {
    using=new ArrayList<>(size);
    for (int i=0; i < size; i++) {
      using.add(null);
    }
  }
 else   if (using.size() < size) {
    while (using.size() < size) {
      using.add(null);
    }
  }
 else   if (using.size() > size) {
    using.subList(size,using.size()).clear();
  }
  for (int i=0; i < size; i++) {
    using.set(i,elementReader.read(in,using.get(i)));
  }
  return using;
}
Program: 162810
Project: 162810
Buggy source:
public void addKnownItems(String id,List<CharSequence> items){
  try (ExternalMapQueryContext<CharSequence,List<CharSequence>,?> c=knownItems.queryContext(id)){
    if (c.writeLock().tryLock(1,MINUTES)) {
      putNoReturn(c,items);
    }
 else {
      throw new RuntimeException("String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void addKnownItems(ChronicleMap<CharSequence,List<CharSequence>> knownItems,String id,List<CharSequence> items){
  try (ExternalMapQueryContext<CharSequence,List<CharSequence>,?> c=knownItems.queryContext(id)){
    if (c.writeLock().tryLock(1,MINUTES)) {
      putNoReturn(c,items);
    }
 else {
      throw new RuntimeException("String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
}
Program: 162814
Project: 162814
Buggy source:
public final void basicRecover(File file,RandomAccessFile raf) throws IOException {
  this.file=file;
  long segmentHeadersOffset=computeSegmentHeadersOffset();
  long sizeInBytesWithoutTiers=computeSizeInBytesWithoutTiers(segmentHeadersOffset);
  long sizeBeyondSegments=Math.max(raf.length() - sizeInBytesWithoutTiers,0);
  int allocatedExtraTierBulks=(int)(sizeBeyondSegments / tierBulkSizeInBytes);
  long mapSize=pageAlign(sizeInBytesWithoutTiers + allocatedExtraTierBulks * tierBulkSizeInBytes);
  initBytesStoreAndHeadersViews(map(raf,mapSize,0));
  resetGlobalMutableStateLock(file);
  recoverAllocatedExtraTierBulks(file,allocatedExtraTierBulks);
  recoverSegmentHeadersOffset(file,segmentHeadersOffset);
  initBulks();
}

Fixed version (ground truth):
public final void basicRecover(File file,RandomAccessFile raf) throws IOException {
  this.file=file;
  long segmentHeadersOffset=computeSegmentHeadersOffset();
  long sizeInBytesWithoutTiers=computeSizeInBytesWithoutTiers(segmentHeadersOffset);
  long sizeBeyondSegments=Math.max(raf.length() - sizeInBytesWithoutTiers,0);
  int allocatedExtraTierBulks=(int)(sizeBeyondSegments / tierBulkSizeInBytes);
  long mapSize=pageAlign(sizeInBytesWithoutTiers + allocatedExtraTierBulks * tierBulkSizeInBytes);
  initBytesStoreAndHeadersViews(map(raf,mapSize,0));
  resetGlobalMutableStateLock(file);
  recoverAllocatedExtraTierBulks(file,allocatedExtraTierBulks);
  recoverSegmentHeadersOffset(file,segmentHeadersOffset);
  initOffsetsAndBulks();
}
Program: 162815
Project: 162815
Buggy source:
public void removeDuplicatesInSegment(){
  long startHlPos=0L;
  VanillaChronicleMap<?,?,?> m=mh.m();
  CompactOffHeapLinearHashTable hashLookup=m.hashLookup;
  long currentTierBaseAddr=s.tierBaseAddr;
  while (!hashLookup.empty(hashLookup.readEntry(currentTierBaseAddr,startHlPos))) {
    startHlPos=hashLookup.step(startHlPos);
  }
  long hlPos=startHlPos;
  int steps=0;
  long entries=0;
  tierIteration:   do {
    hlPos=hashLookup.step(hlPos);
    steps++;
    long entry=hashLookup.readEntry(currentTierBaseAddr,hlPos);
    if (!hashLookup.empty(entry)) {
      e.readExistingEntry(hashLookup.value(entry));
      Data key=(Data)e.key();
      try (ExternalMapQueryContext<?,?,?> c=m.queryContext(key)){
        MapEntry<?,?> entry2=c.entry();
        Data<?> key2=entry2.key();
        if (key2.bytes().address(key2.offset()) != key.bytes().address(key.offset())) {
          lh.LOG.error("String_Node_Str" + "String_Node_Str",key,c.segmentIndex(),entry2.value(),e.value());
          if (hashLookup.remove(currentTierBaseAddr,hlPos) != hlPos) {
            hlPos=hashLookup.stepBack(hlPos);
            steps--;
          }
          continue tierIteration;
        }
      }
       entries++;
    }
  }
 while (hlPos != startHlPos || steps == 0);
  recoverTierEntriesCounter(entries);
  recoverLowestPossibleFreeChunkTiered();
}

Fixed version (ground truth):
public void removeDuplicatesInSegment(){
  long startHlPos=0L;
  VanillaChronicleMap<?,?,?> m=mh.m();
  CompactOffHeapLinearHashTable hashLookup=m.hashLookup;
  long currentTierBaseAddr=s.tierBaseAddr;
  while (!hashLookup.empty(hashLookup.readEntry(currentTierBaseAddr,startHlPos))) {
    startHlPos=hashLookup.step(startHlPos);
  }
  long hlPos=startHlPos;
  int steps=0;
  long entries=0;
  tierIteration:   do {
    hlPos=hashLookup.step(hlPos);
    steps++;
    long entry=hashLookup.readEntry(currentTierBaseAddr,hlPos);
    if (!hashLookup.empty(entry)) {
      e.readExistingEntry(hashLookup.value(entry));
      Data key=(Data)e.key();
      try (ExternalMapQueryContext<?,?,?> c=m.queryContext(key)){
        MapEntry<?,?> entry2=c.entry();
        Data<?> key2=((MapEntry)c).key();
        if (key2.bytes().address(key2.offset()) != key.bytes().address(key.offset())) {
          lh.LOG.error("String_Node_Str" + "String_Node_Str",key,c.segmentIndex(),entry2 != null ? ((MapEntry)c).value() : "String_Node_Str",!e.entryDeleted() ? e.value() : "String_Node_Str");
          if (hashLookup.remove(currentTierBaseAddr,hlPos) != hlPos) {
            hlPos=hashLookup.stepBack(hlPos);
            steps--;
          }
          continue tierIteration;
        }
      }
       entries++;
    }
  }
 while (hlPos != startHlPos || steps == 0);
  recoverTierEntriesCounter(entries);
  recoverLowestPossibleFreeChunkTiered();
}
Program: 162816
Project: 162816
Buggy source:
public boolean entryDeleted(){
  return s.segmentBS.readBoolean(entryDeletedOffset());
}

Fixed version (ground truth):
@Override public boolean entryDeleted(){
  return s.segmentBS.readBoolean(entryDeletedOffset());
}
Program: 162817
Project: 162817
Buggy source:
private void cleanupModificationIterationBits(){
  ReplicatedChronicleMap<?,?,?> m=rh.m();
  ReplicatedChronicleMap<?,?,?>.ModificationIterator[] its=m.acquireAllModificationIterators();
  ReusableBitSet freeList=s.freeList;
  for (long pos=0; ; ) {
    long nextPos=freeList.nextSetBit(pos);
    if (nextPos > pos) {
      for (      ReplicatedChronicleMap<?,?,?>.ModificationIterator it : its) {
        it.clearRange0(s.tierIndex,pos,nextPos);
      }
    }
    if (nextPos > 0) {
      e.readExistingEntry(nextPos);
      if (e.entrySizeInChunks > 1) {
        for (        ReplicatedChronicleMap<?,?,?>.ModificationIterator it : its) {
          it.clearRange0(s.tierIndex,nextPos + 1,nextPos + e.entrySizeInChunks);
        }
      }
      pos=nextPos + e.entrySizeInChunks;
    }
 else {
      if (pos < m.actualChunksPerSegmentTier) {
        for (        ReplicatedChronicleMap<?,?,?>.ModificationIterator it : its) {
          it.clearRange0(s.tierIndex,pos,m.actualChunksPerSegmentTier);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void cleanupModificationIterationBits(){
  ReplicatedChronicleMap<?,?,?> m=rh.m();
  ReplicatedChronicleMap<?,?,?>.ModificationIterator[] its=m.acquireAllModificationIterators();
  ReusableBitSet freeList=s.freeList;
  for (long pos=0; pos < m.actualChunksPerSegmentTier; ) {
    long nextPos=freeList.nextSetBit(pos);
    if (nextPos > pos) {
      for (      ReplicatedChronicleMap<?,?,?>.ModificationIterator it : its) {
        it.clearRange0(s.tierIndex,pos,nextPos);
      }
    }
    if (nextPos > 0) {
      e.readExistingEntry(nextPos);
      if (e.entrySizeInChunks > 1) {
        for (        ReplicatedChronicleMap<?,?,?>.ModificationIterator it : its) {
          it.clearRange0(s.tierIndex,nextPos + 1,nextPos + e.entrySizeInChunks);
        }
      }
      pos=nextPos + e.entrySizeInChunks;
    }
 else {
      for (      ReplicatedChronicleMap<?,?,?>.ModificationIterator it : its) {
        it.clearRange0(s.tierIndex,pos,m.actualChunksPerSegmentTier);
      }
      break;
    }
  }
}
Program: 162818
Project: 162818
Buggy source:
@Override public void doRemoveCompletely(){
  boolean wasDeleted=e.entryDeleted();
  super.doRemove();
  if (wasDeleted)   s.tierDeleted(s.tierDeleted() - 1);
}

Fixed version (ground truth):
@Override public void doRemoveCompletely(){
  boolean wasDeleted=e.entryDeleted();
  super.doRemove();
  ru.dropChange();
  if (wasDeleted)   s.tierDeleted(s.tierDeleted() - 1);
}
Program: 162819
Project: 162819
Buggy source:
@Override public void doRemoveCompletely(){
  boolean wasDeleted=e.entryDeleted();
  super.doRemove();
  if (wasDeleted)   s.tierDeleted(s.tierDeleted() - 1L);
}

Fixed version (ground truth):
@Override public void doRemoveCompletely(){
  boolean wasDeleted=e.entryDeleted();
  super.doRemove();
  ru.dropChange();
  if (wasDeleted)   s.tierDeleted(s.tierDeleted() - 1L);
}
Program: 162820
Project: 162820
Buggy source:
public void putNewVolatile(long value){
  if (ks.searchStatePresent())   throw new AssertionError();
  hl().checkValueForPut(value);
  long currentEntry=hl().readEntry(addr(),hlp.hashLookupPos);
  hl().writeEntryVolatile(addr(),hlp.hashLookupPos,currentEntry,searchKey,value);
}

Fixed version (ground truth):
public void putNewVolatile(long entryPos){
  boolean keySearchReInit=!ks.keySearchInit();
  if (ks.searchStatePresent())   throw new AssertionError();
  if (keySearchReInit) {
    e.readExistingEntry(entryPos);
  }
  hl().checkValueForPut(entryPos);
  long currentEntry=hl().readEntry(addr(),hlp.hashLookupPos);
  hl().writeEntryVolatile(addr(),hlp.hashLookupPos,currentEntry,searchKey,entryPos);
}
Program: 162821
Project: 162821
Buggy source:
abstract boolean keySearchInit();

Fixed version (ground truth):
public abstract boolean keySearchInit();
Program: 162822
Project: 162822
Buggy source:
@Override public void updateOrigin(byte newIdentifier,long newTimestamp){
  checkOnEachPublicOperation.checkOnEachPublicOperation();
  s.innerWriteLock.lock();
  updateReplicationState(newTimestamp,newIdentifier);
}

Fixed version (ground truth):
@Override public void updateOrigin(byte newIdentifier,long newTimestamp){
  checkOnEachPublicOperation.checkOnEachPublicOperation();
  s.innerWriteLock.lock();
  updateReplicationState(newIdentifier,newTimestamp);
}
Program: 162823
Project: 162823
Buggy source:
void updateReplicationState(long timestamp,byte identifier){
  initDelayedUpdateChecksum(true);
  Bytes segmentBytes=s.segmentBytesForWrite();
  segmentBytes.writePosition(replicationBytesOffset);
  segmentBytes.writeLong(timestamp);
  segmentBytes.writeByte(identifier);
}

Fixed version (ground truth):
void updateReplicationState(byte identifier,long timestamp){
  initDelayedUpdateChecksum(true);
  Bytes segmentBytes=s.segmentBytesForWrite();
  segmentBytes.writePosition(replicationBytesOffset);
  segmentBytes.writeLong(timestamp);
  segmentBytes.writeByte(identifier);
}
Program: 162824
Project: 162824
Buggy source:
public void updatedReplicationStateOnPresentEntry(){
  if (!ru.replicationUpdateInit()) {
    s.innerWriteLock.lock();
    long timestamp;
    if (identifier() != mh.m().identifier()) {
      timestamp=Math.max(timestamp() + 1,mh.m().timeProvider.currentTime());
    }
 else {
      timestamp=mh.m().timeProvider.currentTime();
    }
    updateReplicationState(timestamp,mh.m().identifier());
  }
}

Fixed version (ground truth):
public void updatedReplicationStateOnPresentEntry(){
  if (!ru.replicationUpdateInit()) {
    s.innerWriteLock.lock();
    long timestamp;
    if (identifier() != mh.m().identifier()) {
      timestamp=Math.max(timestamp() + 1,mh.m().timeProvider.currentTime());
    }
 else {
      timestamp=mh.m().timeProvider.currentTime();
    }
    updateReplicationState(mh.m().identifier(),timestamp);
  }
}
Program: 162825
Project: 162825
Buggy source:
public void updatedReplicationStateOnAbsentEntry(){
  if (!ru.replicationUpdateInit()) {
    s.innerWriteLock.lock();
    updateReplicationState(mh.m().timeProvider.currentTime(),mh.m().identifier());
  }
}

Fixed version (ground truth):
public void updatedReplicationStateOnAbsentEntry(){
  if (!ru.replicationUpdateInit()) {
    s.innerWriteLock.lock();
    updateReplicationState(mh.m().identifier(),mh.m().timeProvider.currentTime());
  }
}
Program: 162826
Project: 162826
Buggy source:
public void initReplicationInput(Bytes replicatedInputBytes){
  initReplicatedInputBytes(replicatedInputBytes);
  bootstrapTimestamp=replicatedInputBytes.readLong();
  riTimestamp=replicatedInputBytes.readStopBit();
  riId=replicatedInputBytes.readByte();
  ru.initReplicationUpdate(riTimestamp,riId);
  isDeleted=replicatedInputBytes.readBoolean();
  riKeySize=mh.m().keySizeMarshaller.readSize(replicatedInputBytes);
  riKeyOffset=replicatedInputBytes.readPosition();
  if (!isDeleted) {
    replicatedInputBytes.readSkip(riKeySize);
    riValueSize=mh.m().valueSizeMarshaller.readSize(replicatedInputBytes);
    riValueOffset=replicatedInputBytes.readPosition();
  }
}

Fixed version (ground truth):
public void initReplicationInput(Bytes replicatedInputBytes){
  initReplicatedInputBytes(replicatedInputBytes);
  bootstrapTimestamp=replicatedInputBytes.readLong();
  riTimestamp=replicatedInputBytes.readStopBit();
  riId=replicatedInputBytes.readByte();
  ru.initReplicationUpdate(riId,riTimestamp);
  isDeleted=replicatedInputBytes.readBoolean();
  riKeySize=mh.m().keySizeMarshaller.readSize(replicatedInputBytes);
  riKeyOffset=replicatedInputBytes.readPosition();
  if (!isDeleted) {
    replicatedInputBytes.readSkip(riKeySize);
    riValueSize=mh.m().valueSizeMarshaller.readSize(replicatedInputBytes);
    riValueOffset=replicatedInputBytes.readPosition();
  }
}
Program: 162827
Project: 162827
Buggy source:
@Override public void remotePut(Data<V> newValue,byte remoteIdentifier,long timestamp){
  mh.m().setLastModificationTime(remoteIdentifier,timestamp);
  s.innerUpdateLock.lock();
  mh.m().remoteOperations.put(this,newValue);
}

Fixed version (ground truth):
@Override public void remotePut(Data<V> newValue,byte remoteIdentifier,long timestamp){
  ru.initReplicationUpdate(remoteIdentifier,timestamp);
  mh.m().setLastModificationTime(remoteIdentifier,timestamp);
  s.innerUpdateLock.lock();
  mh.m().remoteOperations.put(this,newValue);
}
Program: 162828
Project: 162828
Buggy source:
@Override public void remoteRemove(byte remoteIdentifier,long timestamp){
  mh.m().setLastModificationTime(remoteIdentifier,timestamp);
  s.innerWriteLock.lock();
  mh.m().remoteOperations.remove(this);
}

Fixed version (ground truth):
@Override public void remoteRemove(byte remoteIdentifier,long timestamp){
  ru.initReplicationUpdate(remoteIdentifier,timestamp);
  mh.m().setLastModificationTime(remoteIdentifier,timestamp);
  s.innerWriteLock.lock();
  mh.m().remoteOperations.remove(this);
}
Program: 162829
Project: 162829
Buggy source:
public void initReplicationUpdate(long timestamp,byte identifier){
  innerRemoteTimestamp=timestamp;
  if (identifier == 0)   throw new IllegalStateException("String_Node_Str");
  innerRemoteIdentifier=identifier;
}

Fixed version (ground truth):
public void initReplicationUpdate(byte identifier,long timestamp){
  innerRemoteTimestamp=timestamp;
  if (identifier == 0)   throw new IllegalStateException("String_Node_Str");
  innerRemoteIdentifier=identifier;
}
Program: 162830
Project: 162830
Buggy source:
@Stage("String_Node_Str") private void unlinkFromSegmentContextsChain(){
}

Fixed version (ground truth):
@Stage("String_Node_Str") private void unlinkFromSegmentContextsChain(){
  LocksInterface prevContext=rootContextLockedOnThisSegment;
  while (true) {
    LocksInterface nextNode=prevContext.nextNode();
    if (nextNode == this || nextNode == null)     break;
    prevContext=nextNode;
  }
  verifyInnermostContext();
  prevContext.setNextNode(null);
}