nus-yam/ex-repair huggingface dataset:
Program: 33033
Project: 33033
Buggy source:
List<EmpiricalCDF> generateCDFs(List<List<Double>> inputsEachClass){
  return inputsEachClass.stream().map(list -> new EmpiricalCDF(list,numBins)).collect(Collectors.toList());
}

Fixed version (ground truth):
/** 
 * always use global min and max
 * @param vector
 * @param inputsEachClass
 * @return
 */
public List<EmpiricalCDF> generateCDFs(Vector vector,List<List<Double>> inputsEachClass){
  double min=vector.minValue();
  double max=vector.maxValue();
  return inputsEachClass.stream().map(list -> new EmpiricalCDF(list,min,max,numBins)).collect(Collectors.toList());
}
Program: 33034
Project: 33034
Buggy source:
public static double distance(EmpiricalCDF cdf1,EmpiricalCDF cdf2){
  if (cdf1.numBins != cdf2.numBins) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return IntStream.range(0,cdf1.numBins + 1).mapToDouble(i -> Math.abs(cdf1.probabilities[i] - cdf2.probabilities[i])).max().getAsDouble();
}

Fixed version (ground truth):
public static double distance(EmpiricalCDF cdf1,EmpiricalCDF cdf2){
  if (cdf1.numBins != cdf2.numBins || cdf1.min != cdf2.min || cdf1.max != cdf2.max) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return IntStream.range(0,cdf1.numBins + 1).mapToDouble(i -> Math.abs(cdf1.probabilities[i] - cdf2.probabilities[i])).max().getAsDouble();
}
Program: 33035
Project: 33035
Buggy source:
private static void test2(){
  Vector vector=new DenseVector(10);
  vector.set(0,0.1);
  vector.set(1,0.2);
  vector.set(2,0.15);
  vector.set(3,0.4);
  vector.set(4,0.7);
  vector.set(8,0.9);
  vector.set(9,0.8);
  int[] labels=new int[10];
  labels[0]=0;
  labels[1]=1;
  labels[2]=2;
  labels[3]=1;
  labels[9]=2;
  FusedKolmogorovFilter filter=new FusedKolmogorovFilter();
  filter.setNumBins(10);
  List<List<Double>> inputsEachClass=filter.generateInputsEachClass(vector,labels,3);
  System.out.println(inputsEachClass);
  List<EmpiricalCDF> empiricalCDFs=filter.generateCDFs(inputsEachClass);
  System.out.println(empiricalCDFs);
  System.out.println(filter.maxDistance(empiricalCDFs));
  System.out.println(EmpiricalCDF.distance(empiricalCDFs.get(0),empiricalCDFs.get(1)));
  System.out.println(EmpiricalCDF.distance(empiricalCDFs.get(0),empiricalCDFs.get(2)));
  System.out.println(EmpiricalCDF.distance(empiricalCDFs.get(1),empiricalCDFs.get(2)));
}

Fixed version (ground truth):
private static void test2(){
  Vector vector=new DenseVector(10);
  vector.set(0,0.1);
  vector.set(1,0.2);
  vector.set(2,0.15);
  vector.set(3,0.4);
  vector.set(4,0.7);
  vector.set(8,0.9);
  vector.set(9,0.8);
  int[] labels=new int[10];
  labels[0]=0;
  labels[1]=1;
  labels[2]=2;
  labels[3]=1;
  labels[9]=2;
  FusedKolmogorovFilter filter=new FusedKolmogorovFilter();
  filter.setNumBins(10);
  List<List<Double>> inputsEachClass=filter.generateInputsEachClass(vector,labels,3);
  System.out.println(inputsEachClass);
  List<EmpiricalCDF> empiricalCDFs=filter.generateCDFs(vector,inputsEachClass);
  System.out.println(empiricalCDFs);
  System.out.println(filter.maxDistance(empiricalCDFs));
  System.out.println(EmpiricalCDF.distance(empiricalCDFs.get(0),empiricalCDFs.get(1)));
  System.out.println(EmpiricalCDF.distance(empiricalCDFs.get(0),empiricalCDFs.get(2)));
  System.out.println(EmpiricalCDF.distance(empiricalCDFs.get(1),empiricalCDFs.get(2)));
}
Program: 33036
Project: 33036
Buggy source:
private static void test1(){
  Vector vector=new DenseVector(10);
  vector.set(0,0.1);
  vector.set(1,0.2);
  vector.set(2,0.15);
  vector.set(3,0.4);
  vector.set(4,0.7);
  vector.set(8,0.9);
  int[] labels=new int[10];
  labels[0]=0;
  labels[1]=1;
  labels[2]=1;
  labels[3]=1;
  labels[9]=1;
  FusedKolmogorovFilter filter=new FusedKolmogorovFilter();
  filter.setNumBins(10);
  List<List<Double>> inputsEachClass=filter.generateInputsEachClass(vector,labels,2);
  System.out.println(inputsEachClass);
  List<EmpiricalCDF> empiricalCDFs=filter.generateCDFs(inputsEachClass);
  System.out.println(empiricalCDFs);
  System.out.println(filter.maxDistance(empiricalCDFs));
}

Fixed version (ground truth):
private static void test1(){
  Vector vector=new DenseVector(10);
  vector.set(0,0.1);
  vector.set(1,0.2);
  vector.set(2,0.15);
  vector.set(3,0.4);
  vector.set(4,0.7);
  vector.set(8,0.9);
  int[] labels=new int[10];
  labels[0]=0;
  labels[1]=1;
  labels[2]=1;
  labels[3]=1;
  labels[9]=1;
  FusedKolmogorovFilter filter=new FusedKolmogorovFilter();
  filter.setNumBins(10);
  List<List<Double>> inputsEachClass=filter.generateInputsEachClass(vector,labels,2);
  System.out.println(inputsEachClass);
  List<EmpiricalCDF> empiricalCDFs=filter.generateCDFs(vector,inputsEachClass);
  System.out.println(empiricalCDFs);
  System.out.println(filter.maxDistance(empiricalCDFs));
}
Program: 33037
Project: 33037
Buggy source:
private static void test5(){
  List<Double> list=new ArrayList<>();
  for (int i=0; i < 4; i++) {
    list.add((double)i);
  }
  for (int i=4; i < 10; i++) {
    list.add(0.0);
  }
  EmpiricalCDF cdf=new EmpiricalCDF(list,3);
  System.out.println(cdf);
  List<Double> list2=new ArrayList<>();
  for (int i=0; i < 8; i++) {
    list2.add((double)i);
  }
  for (int i=8; i < 10; i++) {
    list2.add(0.0);
  }
  EmpiricalCDF cdf2=new EmpiricalCDF(list2,3);
  System.out.println(cdf2);
  System.out.println(EmpiricalCDF.distance(cdf,cdf2));
}

Fixed version (ground truth):
private static void test5(){
  List<Double> list=new ArrayList<>();
  for (int i=0; i < 4; i++) {
    list.add((double)i);
  }
  for (int i=4; i < 10; i++) {
    list.add(0.0);
  }
  EmpiricalCDF cdf=new EmpiricalCDF(list,0,7,7);
  System.out.println(cdf);
  List<Double> list2=new ArrayList<>();
  for (int i=0; i < 8; i++) {
    list2.add((double)i);
  }
  for (int i=8; i < 10; i++) {
    list2.add(0.0);
  }
  EmpiricalCDF cdf2=new EmpiricalCDF(list2,0,7,7);
  System.out.println(cdf2);
  System.out.println(EmpiricalCDF.distance(cdf,cdf2));
}
Program: 33038
Project: 33038
Buggy source:
private static void writeLabelTranslator(MultiLabelClfDataSet dataSet,File trecFile){
  File file=new File(trecFile,TREC_LABEL_TRANSLATOR_FILE_NAME);
  LabelTranslator labelTranslator=dataSet.getLabelTranslator();
  try (FileOutputStream fileOutputStream=new FileOutputStream(file);BufferedOutputStream bufferedOutputStream=new BufferedOutputStream(fileOutputStream);ObjectOutputStream objectOutputStream=new ObjectOutputStream(bufferedOutputStream)){
    objectOutputStream.writeObject(labelTranslator);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private static void writeLabelTranslator(MultiLabelClfDataSet dataSet,File trecFile){
  File file=new File(trecFile,TREC_LABEL_TRANSLATOR_FILE_NAME);
  LabelTranslator labelTranslator=dataSet.getLabelTranslator();
  try (FileOutputStream fileOutputStream=new FileOutputStream(file);BufferedOutputStream bufferedOutputStream=new BufferedOutputStream(fileOutputStream);ObjectOutputStream objectOutputStream=new ObjectOutputStream(bufferedOutputStream)){
    objectOutputStream.writeObject(labelTranslator);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  File txtFile=new File(trecFile,TREC_LABEL_TRANSLATOR_TEXT_FILE_NAME);
  try (BufferedWriter bufferedWriter=new BufferedWriter(new FileWriter(txtFile))){
    bufferedWriter.write(labelTranslator.toString());
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 33039
Project: 33039
Buggy source:
public static void main(String[] args) throws Exception {
  if (args.length != 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Config config=new Config(args[0]);
  System.out.println(config);
  MultiLabelIndex index=loadIndex(config);
  build(config,index);
  index.close();
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  if (args.length != 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Config config=new Config(args[0]);
  System.out.println(config);
  File output=new File(config.getString("String_Node_Str"));
  output.mkdirs();
  MultiLabelIndex index=loadIndex(config);
  build(config,index);
  index.close();
}
Program: 33040
Project: 33040
Buggy source:
private double loss(LogisticRegression logisticRegression,ClfDataSet dataSet){
  double negativeLogLikelihood=logisticRegression.dataSetLogLikelihood(dataSet) * -1;
  double penalty=penalty(logisticRegression);
  return negativeLogLikelihood + penalty;
}

Fixed version (ground truth):
private double loss(LogisticRegression logisticRegression,ClfDataSet dataSet){
  double negativeLogLikelihood=logisticRegression.dataSetLogLikelihood(dataSet) * -1;
  double penalty=penalty(logisticRegression);
  return negativeLogLikelihood / dataSet.getNumDataPoints() + penalty;
}
Program: 33041
Project: 33041
Buggy source:
public static int[] numOfUsedFeatures(LogisticRegression logisticRegression){
  int[] res=new int[logisticRegression.getNumClasses()];
  for (int k=0; k < logisticRegression.getNumClasses(); k++) {
    Vector weights=logisticRegression.getWeights().getWeightsWithoutBiasForClass(k);
    res[k]=weights.getNumNonZeroElements();
  }
  return res;
}

Fixed version (ground truth):
public static int numOfUsedFeatures(LogisticRegression logisticRegression){
  int res=0;
  for (int k=0; k < logisticRegression.getNumClasses(); k++) {
    Vector weights=logisticRegression.getWeights().getWeightsWithoutBiasForClass(k);
    res+=weights.getNumNonZeroElements();
  }
  return res;
}
Program: 33042
Project: 33042
Buggy source:
private static void verify(Config config) throws Exception {
  String input=config.getString("String_Node_Str");
  ClfDataSet dataSet=TRECFormat.loadClfDataSet(new File(input,"String_Node_Str"),DataSetType.CLF_SPARSE,true);
  LabelTranslator labelTranslator=dataSet.getSetting().getLabelTranslator();
  File modelFile=new File(config.getString("String_Node_Str"),config.getString("String_Node_Str"));
  LogisticRegression logisticRegression=LogisticRegression.deserialize(modelFile);
  System.out.println("String_Node_Str" + Arrays.toString(LogisticRegressionInspector.numOfUsedFeatures(logisticRegression)));
  int limit=config.getInt("String_Node_Str");
  for (int k=0; k < logisticRegression.getNumClasses(); k++) {
    System.out.println("String_Node_Str" + k + "String_Node_Str"+ labelTranslator.toExtLabel(k)+ "String_Node_Str");
    System.out.println(LogisticRegressionInspector.topFeatures(logisticRegression,k,limit));
    List<String> longNgrams=LogisticRegressionInspector.topFeatures(logisticRegression,k,10000).stream().map(FeatureUtility::getName).filter(str -> str.split("String_Node_Str").length >= 3).collect(Collectors.toList());
    System.out.println("String_Node_Str");
    System.out.println(longNgrams);
  }
}

Fixed version (ground truth):
private static void verify(Config config) throws Exception {
  String input=config.getString("String_Node_Str");
  ClfDataSet dataSet=TRECFormat.loadClfDataSet(new File(input,"String_Node_Str"),DataSetType.CLF_SPARSE,true);
  LabelTranslator labelTranslator=dataSet.getSetting().getLabelTranslator();
  File modelFile=new File(config.getString("String_Node_Str"),config.getString("String_Node_Str"));
  LogisticRegression logisticRegression=LogisticRegression.deserialize(modelFile);
  System.out.println("String_Node_Str" + LogisticRegressionInspector.numOfUsedFeatures(logisticRegression));
  int limit=config.getInt("String_Node_Str");
  for (int k=0; k < logisticRegression.getNumClasses(); k++) {
    System.out.println("String_Node_Str" + k + "String_Node_Str"+ labelTranslator.toExtLabel(k)+ "String_Node_Str");
    System.out.println(LogisticRegressionInspector.topFeatures(logisticRegression,k,limit));
    List<String> longNgrams=LogisticRegressionInspector.topFeatures(logisticRegression,k,10000).stream().map(FeatureUtility::getName).filter(str -> str.split("String_Node_Str").length >= 3).collect(Collectors.toList());
    System.out.println("String_Node_Str");
    System.out.println(longNgrams);
  }
}
Program: 33043
Project: 33043
Buggy source:
private void optimizeOneFeature(LinearRegression linearRegression,DataSet dataSet,double[] labels,double[] instanceWeights,double[] scores,int featureIndex){
  double oldCoeff=linearRegression.getWeights().getWeightsWithoutBias().get(featureIndex);
  double fit=0;
  double denominator=0;
  Vector featureColumn=dataSet.getColumn(featureIndex);
  for (  Vector.Element element : featureColumn.nonZeroes()) {
    int i=element.index();
    double x=element.get();
    double partialResidual=labels[i] - scores[i] + x * oldCoeff;
    fit+=instanceWeights[i] * x * partialResidual;
    denominator+=x * x * instanceWeights[i];
  }
  double numerator=softThreshold(fit);
  denominator+=regularization * (1 - l1Ratio);
  double newCoeff=numerator / denominator;
  linearRegression.getWeights().setWeight(featureIndex,newCoeff);
  double difference=newCoeff - oldCoeff;
  for (  Vector.Element element : featureColumn.nonZeroes()) {
    int i=element.index();
    double x=element.get();
    scores[i]=scores[i] + difference * x;
  }
}

Fixed version (ground truth):
private void optimizeOneFeature(LinearRegression linearRegression,DataSet dataSet,double[] labels,double[] instanceWeights,double[] scores,int featureIndex){
  double oldCoeff=linearRegression.getWeights().getWeightsWithoutBias().get(featureIndex);
  double fit=0;
  double denominator=0;
  Vector featureColumn=dataSet.getColumn(featureIndex);
  for (  Vector.Element element : featureColumn.nonZeroes()) {
    int i=element.index();
    double x=element.get();
    double partialResidual=labels[i] - scores[i] + x * oldCoeff;
    fit+=instanceWeights[i] * x * partialResidual;
    denominator+=x * x * instanceWeights[i];
  }
  double numerator=softThreshold(fit);
  denominator+=regularization * (1 - l1Ratio);
  double newCoeff=numerator / denominator;
  linearRegression.getWeights().setWeight(featureIndex,newCoeff);
  double difference=newCoeff - oldCoeff;
  if (difference != 0) {
    for (    Vector.Element element : featureColumn.nonZeroes()) {
      int i=element.index();
      double x=element.get();
      scores[i]=scores[i] + difference * x;
    }
  }
}
Program: 33044
Project: 33044
Buggy source:
private static void test4() throws Exception {
  ClfDataSet dataSet=TRECFormat.loadClfDataSet(new File(DATASETS,"String_Node_Str"),DataSetType.CLF_SPARSE,true);
  ClfDataSet testSet=TRECFormat.loadClfDataSet(new File(DATASETS,"String_Node_Str"),DataSetType.CLF_SPARSE,true);
  System.out.println(dataSet.getMetaInfo());
  LogisticRegression logisticRegression=new LogisticRegression(dataSet.getNumClasses(),dataSet.getNumFeatures());
  ElasticNetLogisticTrainer trainer=ElasticNetLogisticTrainer.getBuilder().setEpsilon(0.01).setL1Ratio(0.1).setRegularization(0.0001).build();
  StopWatch stopWatch=new StopWatch();
  stopWatch.start();
  trainer.train(logisticRegression,dataSet);
  System.out.println(stopWatch);
  System.out.println("String_Node_Str" + Accuracy.accuracy(logisticRegression,dataSet));
  System.out.println("String_Node_Str" + Accuracy.accuracy(logisticRegression,testSet));
  System.out.println("String_Node_Str" + logisticRegression.getWeights().getAllWeights().getNumNonZeroElements());
}

Fixed version (ground truth):
private static void test4() throws Exception {
  ClfDataSet dataSet=TRECFormat.loadClfDataSet(new File(DATASETS,"String_Node_Str"),DataSetType.CLF_SPARSE,true);
  ClfDataSet testSet=TRECFormat.loadClfDataSet(new File(DATASETS,"String_Node_Str"),DataSetType.CLF_SPARSE,true);
  System.out.println(dataSet.getMetaInfo());
  LogisticRegression logisticRegression=new LogisticRegression(dataSet.getNumClasses(),dataSet.getNumFeatures());
  ElasticNetLogisticTrainer trainer=ElasticNetLogisticTrainer.getBuilder().setEpsilon(0.01).setL1Ratio(1).setRegularization(4.6415888336127784E-5).build();
  StopWatch stopWatch=new StopWatch();
  stopWatch.start();
  trainer.train(logisticRegression,dataSet);
  System.out.println(stopWatch);
  System.out.println("String_Node_Str" + Accuracy.accuracy(logisticRegression,dataSet));
  System.out.println("String_Node_Str" + Accuracy.accuracy(logisticRegression,testSet));
  System.out.println("String_Node_Str" + logisticRegression.getWeights().getAllWeights().getNumNonZeroElements());
}
Program: 33045
Project: 33045
Buggy source:
public static void main(String[] args) throws Exception {
  test4();
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  test6();
}
Program: 33047
Project: 33047
Buggy source:
protected CategoricalFeatureMapper(String featureName,String source,int start,int end,Map<String,Integer> categoryIndexMap,Map<Integer,String> indexCategoryMap){
  this.featureName=featureName;
  this.source=source;
  this.start=start;
  this.end=end;
  this.categoryIndexMap=categoryIndexMap;
  this.indexCategoryMap=indexCategoryMap;
}

Fixed version (ground truth):
protected CategoricalFeatureMapper(String featureName,String source,int start,int end,Map<String,Integer> categoryIndexMap,Map<Integer,String> indexCategoryMap){
  this.featureName=featureName;
  this.source=source;
  this.start=start;
  this.end=end;
  this.categoryIndexMap=categoryIndexMap;
  this.indexCategoryMap=indexCategoryMap;
  this.settings=new HashMap<>();
}
Program: 33048
Project: 33048
Buggy source:
private void updataDataGradient(int dataPointIndex){
  double[] classProbs=this.classProbMatrix[dataPointIndex];
  int label=dataSet.getLabels()[dataPointIndex];
  for (int k=0; k < dataSet.getNumClasses(); k++) {
    if (k == label) {
      this.dataGradientMatrix[k][dataPointIndex]=classProbs[k] - 1;
    }
 else {
      this.dataGradientMatrix[k][dataPointIndex]=classProbs[k];
    }
  }
}

Fixed version (ground truth):
private void updataDataGradient(int dataPointIndex){
  double[] classProbs=this.classProbMatrix[dataPointIndex];
  int label=dataSet.getLabels()[dataPointIndex];
  for (int k=0; k < dataSet.getNumClasses(); k++) {
    if (k == label) {
      this.dataGradientMatrix[k][dataPointIndex]=1 - classProbs[k];
    }
 else {
      this.dataGradientMatrix[k][dataPointIndex]=0 - classProbs[k];
    }
  }
}
Program: 33050
Project: 33050
Buggy source:
/** 
 * assuming unigram indices for now
 */
static void loadInitialFeaturesFromFile(Config config,FeatureMappers featureMappers) throws Exception {
  File initialDataSetFile=new File(config.getString("String_Node_Str"),"String_Node_Str");
  ClfDataSet initialDataSet=TRECFormat.loadClfDataSet(initialDataSetFile,DataSetType.CLF_SPARSE,true);
  File initialFeatureFile=new File(config.getString("String_Node_Str"));
  String[] line=FileUtils.readFileToString(initialFeatureFile).split("String_Node_Str");
  List<String> unigrams=Arrays.stream(line).map(Integer::parseInt).map(i -> initialDataSet.getFeatureSetting(i).getFeatureName()).collect(Collectors.toList());
  System.out.println("String_Node_Str");
  System.out.println(unigrams);
  for (  String unigram : unigrams) {
    int featureIndex=featureMappers.nextAvailable();
    NumericalFeatureMapper mapper=NumericalFeatureMapper.getBuilder().setFeatureIndex(featureIndex).setFeatureName(unigram).setSource("String_Node_Str").build();
    featureMappers.addMapper(mapper);
  }
}

Fixed version (ground truth):
/** 
 * assuming unigram indices for now
 */
static void loadInitialFeaturesFromFile(Config config,FeatureMappers featureMappers) throws Exception {
  File initialDataSetFile=new File(config.getString("String_Node_Str"),"String_Node_Str");
  ClfDataSet initialDataSet=TRECFormat.loadClfDataSet(initialDataSetFile,DataSetType.CLF_SPARSE,true);
  File initialFeatureFile=new File(config.getString("String_Node_Str"));
  String[] line=FileUtils.readLines(initialFeatureFile).get(0).split("String_Node_Str");
  List<String> unigrams=Arrays.stream(line).map(Integer::parseInt).map(i -> initialDataSet.getFeatureSetting(i).getFeatureName()).collect(Collectors.toList());
  System.out.println("String_Node_Str");
  System.out.println(unigrams);
  for (  String unigram : unigrams) {
    int featureIndex=featureMappers.nextAvailable();
    NumericalFeatureMapper mapper=NumericalFeatureMapper.getBuilder().setFeatureIndex(featureIndex).setFeatureName(unigram).setSource("String_Node_Str").build();
    featureMappers.addMapper(mapper);
  }
}
Program: 33051
Project: 33051
Buggy source:
@Override public double getValue(Vector parameters){
  LogisticRegression tmpFunction=new LogisticRegression(this.logisticRegression.getNumClasses(),this.logisticRegression.getNumFeatures(),parameters);
  return -tmpFunction.dataSetLogLikelihood(dataSet) + parameters.norm(2) / (2 * gaussianPriorVariance);
}

Fixed version (ground truth):
@Override public double getValue(Vector parameters){
  LogisticRegression tmpFunction=new LogisticRegression(this.logisticRegression.getNumClasses(),this.logisticRegression.getNumFeatures(),parameters);
  return -tmpFunction.dataSetLogLikelihood(dataSet) + parameters.dot(parameters) / (2 * gaussianPriorVariance);
}
Program: 33052
Project: 33052
Buggy source:
public static Instances toInstances(ClfDataSet dataSet){
  List<Attribute> attributes=new ArrayList<>();
  for (int j=0; j < dataSet.getNumFeatures(); j++) {
    String name=dataSet.getFeatureSetting(j).getFeatureName();
    attributes.add(new NumericalAttribute(name));
  }
  Instances instances=new Instances(attributes);
  for (int i=0; i < dataSet.getNumDataPoints(); i++) {
    instances.add(toInstance(dataSet,i));
  }
  return instances;
}

Fixed version (ground truth):
public static Instances toInstances(ClfDataSet dataSet){
  List<Attribute> attributes=new ArrayList<>();
  for (int j=0; j < dataSet.getNumFeatures(); j++) {
    String name=dataSet.getFeatureSetting(j).getFeatureName();
    attributes.add(new NumericalAttribute(name,j));
  }
  String[] states=new String[dataSet.getNumClasses()];
  for (int k=0; k < states.length; k++) {
    states[k]="String_Node_Str" + k;
  }
  Attribute targetAttribute=new NominalAttribute("String_Node_Str",states);
  Instances instances=new Instances(attributes,targetAttribute);
  for (int i=0; i < dataSet.getNumDataPoints(); i++) {
    instances.add(toInstance(dataSet,i));
  }
  return instances;
}
Program: 33053
Project: 33053
Buggy source:
public static Instance toInstance(ClfDataSet dataSet,int dataPointIndex){
  double[] features=new double[dataSet.getNumFeatures()];
  Vector vector=dataSet.getRow(dataPointIndex);
  for (  Vector.Element element : vector.nonZeroes()) {
    int index=element.index();
    double value=element.get();
    features[index]=value;
  }
  double label=dataSet.getLabels()[dataPointIndex];
  return new Instance(features,label);
}

Fixed version (ground truth):
static Instance toInstance(ClfDataSet dataSet,int dataPointIndex){
  double[] features=new double[dataSet.getNumFeatures()];
  Vector vector=dataSet.getRow(dataPointIndex);
  for (  Vector.Element element : vector.nonZeroes()) {
    int index=element.index();
    double value=element.get();
    features[index]=value;
  }
  double label=dataSet.getLabels()[dataPointIndex];
  return new Instance(features,label);
}
Program: 33054
Project: 33054
Buggy source:
public static boolean acceptLine(String line){
  String[] split=line.split("String_Node_Str");
  String realLabel=split[1];
  return (map.containsKey(realLabel) && (split.length == 6) && !split[5].trim().equals("String_Node_Str"));
}

Fixed version (ground truth):
public static boolean acceptLine(String line){
  String[] split=line.split("String_Node_Str");
  if (split.length != 6) {
    return false;
  }
  String realLabel=split[1];
  return (map.containsKey(realLabel) && !split[5].trim().equals("String_Node_Str"));
}
Program: 33056
Project: 33056
Buggy source:
public int getEnd(){
  return end;
}

Fixed version (ground truth):
/** 
 * inclusive
 * @return
 */
public int getEnd(){
  return end;
}
Program: 33057
Project: 33057
Buggy source:
public DataSetting(){
}

Fixed version (ground truth):
public DataSetting(){
  this.extLabels=new ArrayList<>();
}
Program: 33058
Project: 33058
Buggy source:
public DataSetting copy(){
  DataSetting dataSetting=new DataSetting();
  dataSetting.setExtId(this.extId);
  dataSetting.setExtLabel(this.extLabel);
  return dataSetting;
}

Fixed version (ground truth):
public DataSetting copy(){
  DataSetting dataSetting=new DataSetting();
  dataSetting.setExtId(this.extId);
  dataSetting.setExtLabel(this.extLabel);
  for (int i=0; i < this.extLabels.size(); i++) {
    dataSetting.extLabels.add(this.extLabels.get(i));
  }
  return dataSetting;
}
Program: 33060
Project: 33060
Buggy source:
static void dumpFields(Config config,MultiLabelIndex index,IdTranslator idTranslator,String fileName) throws Exception {
  String[] fields=config.getString("String_Node_Str").split("String_Node_Str");
  int numDocs=idTranslator.numData();
  try (BufferedWriter bw=new BufferedWriter(new FileWriter(fileName))){
    for (int intId=0; intId < numDocs; intId++) {
      bw.write("String_Node_Str");
      bw.write("String_Node_Str" + intId);
      bw.write("String_Node_Str");
      bw.write("String_Node_Str");
      String extId=idTranslator.toExtId(intId);
      bw.write(extId);
      bw.write("String_Node_Str");
      for (int i=0; i < fields.length; i++) {
        String field=fields[i];
        bw.write(field + "String_Node_Str");
        bw.write(index.getStringField(extId,field));
        if (i != fields.length - 1) {
          bw.write("String_Node_Str");
        }
      }
      bw.write("String_Node_Str");
    }
  }
 }

Fixed version (ground truth):
static void dumpFields(Config config,MultiLabelIndex index,IdTranslator idTranslator,String fileName) throws Exception {
  String[] fields=config.getString("String_Node_Str").split("String_Node_Str");
  int numDocs=idTranslator.numData();
  try (BufferedWriter bw=new BufferedWriter(new FileWriter(fileName))){
    for (int intId=0; intId < numDocs; intId++) {
      bw.write("String_Node_Str");
      bw.write("String_Node_Str" + intId);
      bw.write("String_Node_Str");
      bw.write("String_Node_Str");
      String extId=idTranslator.toExtId(intId);
      bw.write(extId);
      bw.write("String_Node_Str");
      for (int i=0; i < fields.length; i++) {
        String field=fields[i];
        bw.write(field + "String_Node_Str");
        bw.write(index.getStringListField(extId,field).toString());
        if (i != fields.length - 1) {
          bw.write("String_Node_Str");
        }
      }
      bw.write("String_Node_Str");
    }
  }
 }
Program: 33062
Project: 33062
Buggy source:
public static void main(String[] args) throws Exception {
  spam_missing_all();
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  spam_test();
}
Program: 33063
Project: 33063
Buggy source:
public static void main(String[] args) throws Exception {
  if (args.length != 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Config config=new Config(args[0]);
  System.out.println(config);
  String dir=config.getString("String_Node_Str");
  Node node=nodeBuilder().client(true).clusterName(config.getString("String_Node_Str")).node();
  Client client=node.client();
  List<File> list=DirWalker.getFiles(dir).stream().filter(file -> !file.getName().startsWith("String_Node_Str")).collect(Collectors.toList());
  int id=0;
  for (  File file : list) {
    System.out.println("String_Node_Str" + id);
    XContentBuilder builder=IndexBuilder.getBuilder(file);
    IndexResponse response=client.prepareIndex("String_Node_Str","String_Node_Str","String_Node_Str" + id).setSource(builder).execute().actionGet();
    id+=1;
  }
  node.close();
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  if (args.length != 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Config config=new Config(args[0]);
  System.out.println(config);
  String dir=config.getString("String_Node_Str");
  Node node=nodeBuilder().client(true).clusterName(config.getString("String_Node_Str")).node();
  Client client=node.client();
  List<File> list=DirWalker.getFiles(dir).stream().filter(file -> !file.getName().startsWith("String_Node_Str")).collect(Collectors.toList());
  int id=0;
  for (  File file : list) {
    System.out.println("String_Node_Str" + id);
    XContentBuilder builder=Classic3IndexBuilder.getBuilder(file);
    IndexResponse response=client.prepareIndex("String_Node_Str","String_Node_Str","String_Node_Str" + id).setSource(builder).execute().actionGet();
    id+=1;
  }
  node.close();
}
Program: 33064
Project: 33064
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + lower + "String_Node_Str"+ upper+ "String_Node_Str"+ probabilisticCount+ '}';
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + lower + "String_Node_Str"+ upper+ "String_Node_Str"+ probabilisticCount+ "String_Node_Str"+ weightedSum+ "String_Node_Str"+ percentage+ '}';
}
Program: 33065
Project: 33065
Buggy source:
/** 
 * only keep non-empty intervals, also adjust(extend) their boundaries
 * @param intervals
 * @return
 */
private static List<Interval> compress(List<Interval> intervals){
  boolean inBlock=false;
  int start=0;
  int end=0;
  for (int i=0; i < intervals.size(); i++) {
    if (intervals.get(i).getProbabilisticCount() == 0) {
      if (!inBlock) {
        inBlock=true;
        start=i;
        end=i;
      }
 else {
        end=i;
      }
    }
 else {
      if (inBlock) {
        inBlock=false;
        double mid=(intervals.get(start).getLower() + intervals.get(end).getUpper()) / 2;
        intervals.get(start - 1).setUpper(mid);
        intervals.get(end + 1).setLower(mid);
      }
    }
  }
  List<Interval> compressed=new ArrayList<>(intervals.size());
  for (  Interval interval : intervals) {
    if (interval.getProbabilisticCount() != 0) {
      compressed.add(interval);
    }
  }
  return compressed;
}

Fixed version (ground truth):
/** 
 * only keep non-empty intervals, also adjust(extend) their boundaries
 * @param intervals
 * @return
 */
static List<Interval> compress(List<Interval> intervals){
  boolean inBlock=false;
  int start=0;
  int end=0;
  for (int i=0; i < intervals.size(); i++) {
    if (intervals.get(i).getProbabilisticCount() == 0) {
      if (!inBlock) {
        inBlock=true;
        start=i;
        end=i;
      }
 else {
        end=i;
      }
    }
 else {
      if (inBlock) {
        inBlock=false;
        double mid=(intervals.get(start).getLower() + intervals.get(end).getUpper()) / 2;
        intervals.get(start - 1).setUpper(mid);
        intervals.get(end + 1).setLower(mid);
      }
    }
  }
  List<Interval> compressed=new ArrayList<>(intervals.size());
  for (  Interval interval : intervals) {
    if (interval.getProbabilisticCount() != 0) {
      compressed.add(interval);
    }
  }
  return compressed;
}
Program: 33067
Project: 33067
Buggy source:
public static void main(String[] args){
  test5();
}

Fixed version (ground truth):
public static void main(String[] args){
  test12();
}
Program: 33069
Project: 33069
Buggy source:
private static double area(List<double[]> rates){
  double[] tpr=rates.get(0);
  double[] fpr=rates.get(1);
  double tmp=IntStream.range(0,tpr.length - 1).parallel().mapToDouble(i -> (fpr[i] - fpr[i + 1]) * (tpr[i] + tpr[i + 1])).sum();
  double area=Math.abs(tmp) / 2;
  return area;
}

Fixed version (ground truth):
private static double area(List<List<Double>> rates){
  List<Double> tpr=rates.get(0);
  List<Double> fpr=rates.get(1);
  double tmp=IntStream.range(0,tpr.size() - 1).parallel().mapToDouble(i -> (fpr.get(i) - fpr.get(i + 1)) * (tpr.get(i) + tpr.get(i + 1))).sum();
  double area=Math.abs(tmp) / 2;
  return area;
}
Program: 33070
Project: 33070
Buggy source:
/** 
 * assume 1 is positive, 0 is negative labels are sorted based on scores, from most likely to least likely of being positive
 * @param sortedLabels
 * @return
 */
private static List<double[]> getRates(int[] sortedLabels){
  int numData=sortedLabels.length;
  double[] truePositiveRates=new double[numData + 1];
  double[] falsePositiveRates=new double[numData + 1];
  double numPositives=Arrays.stream(sortedLabels).filter(label -> label == 1).count();
  double numNegatives=numData - numPositives;
  double truePositive=0;
  double falsePositive=0;
  truePositiveRates[0]=0;
  falsePositiveRates[0]=0;
  for (int i=1; i <= numData; i++) {
    int label=sortedLabels[i - 1];
    if (label == 1) {
      truePositive+=1;
    }
 else {
      falsePositive+=1;
    }
    truePositiveRates[i]=truePositive / numPositives;
    falsePositiveRates[i]=falsePositive / numNegatives;
  }
  List<double[]> rates=new ArrayList<>();
  rates.add(truePositiveRates);
  rates.add(falsePositiveRates);
  return rates;
}

Fixed version (ground truth):
/** 
 * assume 1 is positive, 0 is negative labels are sorted based on scores, from most likely to least likely of being positive
 * @param sortedPairs descending order by scores
 * @return
 */
private static List<List<Double>> getRates(List<Pair<Double,Integer>> sortedPairs){
  int numData=sortedPairs.size();
  List<Double> truePositiveRates=new ArrayList<>();
  List<Double> falsePositiveRates=new ArrayList<>();
  double numPositives=sortedPairs.stream().parallel().filter(pair -> pair.getSecond() == 1).count();
  double numNegatives=numData - numPositives;
  double truePositive=0;
  double falsePositive=0;
  truePositiveRates.add(0.0);
  falsePositiveRates.add(0.0);
  for (int i=0; i < numData; i++) {
    Pair<Double,Integer> pair=sortedPairs.get(i);
    int label=pair.getSecond();
    double score=pair.getFirst();
    if (label == 1) {
      truePositive+=1;
    }
 else {
      falsePositive+=1;
    }
    boolean condition1=(i < numData - 1) && (score != sortedPairs.get(i + 1).getFirst());
    boolean condition2=(i == numData - 1);
    boolean condition=condition1 || condition2;
    if (condition) {
      truePositiveRates.add(truePositive / numPositives);
      falsePositiveRates.add(falsePositive / numNegatives);
    }
  }
  List<List<Double>> rates=new ArrayList<>();
  rates.add(truePositiveRates);
  rates.add(falsePositiveRates);
  return rates;
}
Program: 33071
Project: 33071
Buggy source:
/** 
 * original order, unsorted
 * @param scores
 * @param labels
 * @return
 */
public static double auc(double[] scores,int[] labels){
  Comparator<Pair<Double,Integer>> comparator=Comparator.comparing(Pair::getFirst);
  int[] sortedLabels=IntStream.range(0,scores.length).parallel().mapToObj(i -> new Pair<>(scores[i],labels[i])).sorted(comparator.reversed()).mapToInt(Pair::getSecond).toArray();
  List<double[]> rates=getRates(sortedLabels);
  return area(rates);
}

Fixed version (ground truth):
/** 
 * original order, unsorted
 * @param scores
 * @param labels
 * @return
 */
public static double auc(double[] scores,int[] labels){
  Comparator<Pair<Double,Integer>> comparator=Comparator.comparing(Pair::getFirst);
  List<Pair<Double,Integer>> sortedPairs=IntStream.range(0,scores.length).parallel().mapToObj(i -> new Pair<>(scores[i],labels[i])).sorted(comparator.reversed()).collect(Collectors.toList());
  List<List<Double>> rates=getRates(sortedPairs);
  return area(rates);
}
Program: 33072
Project: 33072
Buggy source:
static void spam_test() throws Exception {
  spam_build();
}

Fixed version (ground truth):
static void spam_test() throws Exception {
  spam_build();
  spam_load();
}
Program: 33073
Project: 33073
Buggy source:
static void spam_load() throws Exception {
  System.out.println("String_Node_Str");
  LKTreeBoost lkTreeBoost=LKTreeBoost.deserialize(new File(TMP,"String_Node_Str"));
  ClfDataSet dataSet=TRECFormat.loadClfDataSet(new File(DATASETS,"String_Node_Str"),DataSetType.CLF_DENSE,true);
  System.out.println("String_Node_Str");
  System.out.println(dataSet.getMetaInfo());
  double accuracy=Accuracy.accuracy(lkTreeBoost,dataSet);
  System.out.println(accuracy);
  ConfusionMatrix confusionMatrix=new ConfusionMatrix(2,lkTreeBoost,dataSet);
  System.out.println("String_Node_Str");
  System.out.println(confusionMatrix.printWithExtLabels());
  System.out.println("String_Node_Str");
  System.out.println(LKTBInspector.topFeatures(lkTreeBoost,0));
  System.out.println(LKTBInspector.topFeatureIndices(lkTreeBoost,0));
  System.out.println(LKTBInspector.topFeatureNames(lkTreeBoost,0));
  System.out.println(new PerClassMeasures(confusionMatrix,0));
  System.out.println(new PerClassMeasures(confusionMatrix,1));
}

Fixed version (ground truth):
static void spam_load() throws Exception {
  System.out.println("String_Node_Str");
  LKTreeBoost lkTreeBoost=LKTreeBoost.deserialize(new File(TMP,"String_Node_Str"));
  ClfDataSet dataSet=TRECFormat.loadClfDataSet(new File(DATASETS,"String_Node_Str"),DataSetType.CLF_DENSE,true);
  System.out.println("String_Node_Str");
  System.out.println(dataSet.getMetaInfo());
  double accuracy=Accuracy.accuracy(lkTreeBoost,dataSet);
  System.out.println(accuracy);
  System.out.println("String_Node_Str" + AUC.auc(lkTreeBoost,dataSet));
  ConfusionMatrix confusionMatrix=new ConfusionMatrix(2,lkTreeBoost,dataSet);
  System.out.println("String_Node_Str");
  System.out.println(confusionMatrix.printWithExtLabels());
  System.out.println("String_Node_Str");
  System.out.println(LKTBInspector.topFeatures(lkTreeBoost,0));
  System.out.println(LKTBInspector.topFeatureIndices(lkTreeBoost,0));
  System.out.println(LKTBInspector.topFeatureNames(lkTreeBoost,0));
  System.out.println(new PerClassMeasures(confusionMatrix,0));
  System.out.println(new PerClassMeasures(confusionMatrix,1));
}
Program: 33074
Project: 33074
Buggy source:
public static void main(String[] args) throws Exception {
  gammaNBTest();
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  histogramNBTest(100);
}
Program: 33075
Project: 33075
Buggy source:
public double getDouble(String key){
  return Double.parseDouble(this.properties.getProperty(key));
}

Fixed version (ground truth):
public double getDouble(String key){
  if (!containsKey(key)) {
    throw new IllegalArgumentException("String_Node_Str" + key);
  }
  return Double.parseDouble(this.properties.getProperty(key));
}
Program: 33076
Project: 33076
Buggy source:
public String getString(String key){
  return this.properties.getProperty(key);
}

Fixed version (ground truth):
public String getString(String key){
  if (!containsKey(key)) {
    throw new IllegalArgumentException("String_Node_Str" + key);
  }
  return this.properties.getProperty(key);
}
Program: 33077
Project: 33077
Buggy source:
public int getInt(String key){
  return Integer.parseInt(this.properties.getProperty(key));
}

Fixed version (ground truth):
public int getInt(String key){
  if (!containsKey(key)) {
    throw new IllegalArgumentException("String_Node_Str" + key);
  }
  return Integer.parseInt(this.properties.getProperty(key));
}
Program: 33078
Project: 33078
Buggy source:
public boolean getBoolean(String key){
  return Boolean.parseBoolean(this.properties.getProperty(key));
}

Fixed version (ground truth):
public boolean getBoolean(String key){
  if (!containsKey(key)) {
    throw new IllegalArgumentException("String_Node_Str" + key);
  }
  return Boolean.parseBoolean(this.properties.getProperty(key));
}
Program: 33080
Project: 33080
Buggy source:
/** 
 * @param precision
 * @param recall
 * @param beta
 * @return
 */
public static double fBeta(double precision,double recall,double beta){
  return (1 + beta * beta) * precision * recall / (beta * beta * precision + recall);
}

Fixed version (ground truth):
/** 
 * @param precision
 * @param recall
 * @param beta
 * @return
 */
public static double fBeta(double precision,double recall,double beta){
  if (precision == 0 || recall == 0) {
    return 0;
  }
  return (1 + beta * beta) * precision * recall / (beta * beta * precision + recall);
}
Program: 33081
Project: 33081
Buggy source:
@Override public EncryptionMaterials getEncryptionMaterials(EncryptionContext context){
  State s=state.get();
  if (System.nanoTime() - s.lastUpdated <= ttlInNanos) {
    return s.provider.getEncryptionMaterials(context);
  }
  if (s.provider == null || System.nanoTime() - s.lastUpdated > ttlInNanos + TTL_GRACE_IN_NANO) {
    lock.lock();
  }
 else   if (!lock.tryLock()) {
    return s.provider.getEncryptionMaterials(context);
  }
  try {
    final long newVersion=keystore.getMaxVersion(materialName);
    final long currentVersion;
    final EncryptionMaterialsProvider currentProvider;
    if (newVersion < 0) {
      currentVersion=0;
      currentProvider=keystore.getOrCreate(materialName,currentVersion);
      s=new State(currentProvider,currentVersion);
      state.set(s);
    }
 else     if (newVersion != s.currentVersion) {
      currentVersion=newVersion;
      currentProvider=keystore.getProvider(materialName,currentVersion);
      cache.add(Long.toString(currentVersion),currentProvider);
      s=new State(currentProvider,currentVersion);
      state.set(s);
    }
    return s.provider.getEncryptionMaterials(context);
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
@Override public EncryptionMaterials getEncryptionMaterials(EncryptionContext context){
  State s=state.get();
  if (System.nanoTime() - s.lastUpdated <= ttlInNanos) {
    return s.provider.getEncryptionMaterials(context);
  }
  if (s.provider == null || System.nanoTime() - s.lastUpdated > ttlInNanos + TTL_GRACE_IN_NANO) {
    lock.lock();
  }
 else   if (!lock.tryLock()) {
    return s.provider.getEncryptionMaterials(context);
  }
  try {
    final long newVersion=keystore.getMaxVersion(materialName);
    final long currentVersion;
    final EncryptionMaterialsProvider currentProvider;
    if (newVersion < 0) {
      currentVersion=0;
      currentProvider=keystore.getOrCreate(materialName,currentVersion);
      cache.add(Long.toString(currentVersion),currentProvider);
    }
 else     if (newVersion != s.currentVersion) {
      currentVersion=newVersion;
      currentProvider=keystore.getProvider(materialName,currentVersion);
      cache.add(Long.toString(currentVersion),currentProvider);
    }
 else {
      currentVersion=newVersion;
      currentProvider=s.provider;
    }
    s=new State(currentProvider,currentVersion);
    state.set(s);
    return s.provider.getEncryptionMaterials(context);
  }
  finally {
    lock.unlock();
  }
}
Program: 33083
Project: 33083
Buggy source:
private void writeActionDescriptors(JsonGenerator jgen,String currentVocab,List<ActionDescriptor> actionDescriptors) throws IOException, IntrospectionException {
  for (  ActionDescriptor actionDescriptor : actionDescriptors) {
    if ("String_Node_Str".equals(actionDescriptor.getHttpMethod())) {
      continue;
    }
    jgen.writeStartObject();
    final String semanticActionType=actionDescriptor.getSemanticActionType();
    if (semanticActionType != null) {
      jgen.writeStringField("String_Node_Str",semanticActionType);
    }
    jgen.writeStringField("String_Node_Str",actionDescriptor.getHttpMethod());
    final AnnotatedParameter requestBodyInputParameter=actionDescriptor.getRequestBody();
    if (requestBodyInputParameter != null) {
      jgen.writeObjectFieldStart("String_Node_Str");
      final Class<?> clazz=requestBodyInputParameter.getParameterType();
      final Expose classExpose=clazz.getAnnotation(Expose.class);
      final String typeName;
      if (classExpose != null) {
        typeName=classExpose.value();
      }
 else {
        typeName=requestBodyInputParameter.getParameterType().getSimpleName();
      }
      jgen.writeStringField("String_Node_Str",typeName);
      jgen.writeArrayFieldStart("String_Node_Str");
      recurseSupportedProperties(jgen,currentVocab,clazz,actionDescriptor,requestBodyInputParameter,requestBodyInputParameter.getCallValue(),"String_Node_Str");
      jgen.writeEndArray();
      jgen.writeEndObject();
    }
    jgen.writeEndObject();
  }
}

Fixed version (ground truth):
private void writeActionDescriptors(JsonGenerator jgen,String currentVocab,List<ActionDescriptor> actionDescriptors) throws IOException, IntrospectionException {
  for (  ActionDescriptor actionDescriptor : actionDescriptors) {
    if ("String_Node_Str".equals(actionDescriptor.getHttpMethod())) {
      continue;
    }
    jgen.writeStartObject();
    final String semanticActionType=actionDescriptor.getSemanticActionType();
    if (semanticActionType != null) {
      jgen.writeStringField("String_Node_Str",semanticActionType);
    }
    jgen.writeStringField("String_Node_Str",actionDescriptor.getHttpMethod());
    final ActionInputParameter requestBodyInputParameter=actionDescriptor.getRequestBody();
    if (requestBodyInputParameter != null) {
      jgen.writeObjectFieldStart("String_Node_Str");
      final Class<?> clazz=requestBodyInputParameter.getParameterType();
      final Expose classExpose=clazz.getAnnotation(Expose.class);
      final String typeName;
      if (classExpose != null) {
        typeName=classExpose.value();
      }
 else {
        typeName=requestBodyInputParameter.getParameterType().getSimpleName();
      }
      jgen.writeStringField("String_Node_Str",typeName);
      jgen.writeArrayFieldStart("String_Node_Str");
      recurseSupportedProperties(jgen,currentVocab,clazz,actionDescriptor,requestBodyInputParameter,requestBodyInputParameter.getCallValue(),"String_Node_Str");
      jgen.writeEndArray();
      jgen.writeEndObject();
    }
    jgen.writeEndObject();
  }
}
Program: 33086
Project: 33086
Buggy source:
private void writeHydraVariableMapping(JsonGenerator jgen,@Nullable AnnotatedParameters annotatedParameters,Collection<String> variableNames) throws IOException {
  if (annotatedParameters != null) {
    for (    String variableName : variableNames) {
      AnnotatedParameter annotatedParameter=annotatedParameters.getAnnotatedParameter(variableName);
      if (annotatedParameter != null && annotatedParameter.getCallValue() == null) {
        jgen.writeStartObject();
        jgen.writeStringField("String_Node_Str","String_Node_Str");
        jgen.writeStringField("String_Node_Str",variableName);
        jgen.writeBooleanField("String_Node_Str",annotatedParameter.isRequired());
        jgen.writeStringField("String_Node_Str",getExposedPropertyOrParamName(annotatedParameter));
        jgen.writeEndObject();
      }
    }
  }
}

Fixed version (ground truth):
private void writeHydraVariableMapping(JsonGenerator jgen,@Nullable ActionDescriptor annotatedParameters,Collection<String> variableNames) throws IOException {
  if (annotatedParameters != null) {
    for (    String variableName : variableNames) {
      ActionInputParameter annotatedParameter=annotatedParameters.getActionInputParameter(variableName);
      if (annotatedParameter != null && annotatedParameter.getCallValue() == null) {
        jgen.writeStartObject();
        jgen.writeStringField("String_Node_Str","String_Node_Str");
        jgen.writeStringField("String_Node_Str",variableName);
        jgen.writeBooleanField("String_Node_Str",annotatedParameter.isRequired());
        jgen.writeStringField("String_Node_Str",getExposedPropertyOrParamName(annotatedParameter));
        jgen.writeEndObject();
      }
    }
  }
}
Program: 33087
Project: 33087
Buggy source:
private void writeSupportedProperty(JsonGenerator jgen,String currentVocab,AnnotatedParameter actionInputParameter,String propertyName,@SuppressWarnings("String_Node_Str") Object[] possiblePropertyValues) throws IOException {
  jgen.writeStartObject();
  if (actionInputParameter.hasCallValue() || actionInputParameter.hasInputConstraints()) {
    jgen.writeStringField(JsonLdKeywords.AT_TYPE,getPropertyOrClassNameInVocab(currentVocab,"String_Node_Str",LdContextFactory.HTTP_SCHEMA_ORG,"String_Node_Str"));
  }
  jgen.writeStringField("String_Node_Str",propertyName);
  writePossiblePropertyValues(jgen,currentVocab,actionInputParameter,possiblePropertyValues);
  jgen.writeEndObject();
}

Fixed version (ground truth):
private void writeSupportedProperty(JsonGenerator jgen,String currentVocab,ActionInputParameter actionInputParameter,String propertyName,@SuppressWarnings("String_Node_Str") Object[] possiblePropertyValues) throws IOException {
  jgen.writeStartObject();
  if (actionInputParameter.hasCallValue() || actionInputParameter.hasInputConstraints()) {
    jgen.writeStringField(JsonLdKeywords.AT_TYPE,getPropertyOrClassNameInVocab(currentVocab,"String_Node_Str",LdContextFactory.HTTP_SCHEMA_ORG,"String_Node_Str"));
  }
  jgen.writeStringField("String_Node_Str",propertyName);
  writePossiblePropertyValues(jgen,currentVocab,actionInputParameter,possiblePropertyValues);
  jgen.writeEndObject();
}