nus-yam/ex-repair huggingface dataset:
Program: 61256
Project: 61256
Buggy source:
@Override public FastByIDMap<FastIDSet> exportWithIDsOnly() throws TasteException {
  log.debug("String_Node_Str");
  Connection conn=null;
  Statement stmt=null;
  ResultSet rs=null;
  FastByIDMap<FastIDSet> result=new FastByIDMap<FastIDSet>();
  try {
    conn=dataSource.getConnection();
    stmt=conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);
    stmt.setFetchDirection(ResultSet.FETCH_FORWARD);
    stmt.setFetchSize(getFetchSize());
    log.debug("String_Node_Str",getAllUsersSQL);
    rs=stmt.executeQuery(getAllUsersSQL);
    boolean currentUserIDSet=false;
    long currentUserID=0L;
    FastIDSet currentItemIDs=new FastIDSet(2);
    while (rs.next()) {
      long nextUserID=getLongColumn(rs,1);
      if (currentUserIDSet && (currentUserID != nextUserID)) {
        if (!currentItemIDs.isEmpty()) {
          result.put(currentUserID,currentItemIDs);
          currentItemIDs=new FastIDSet(2);
        }
      }
 else {
        currentItemIDs.add(getLongColumn(rs,2));
      }
      currentUserID=nextUserID;
      currentUserIDSet=true;
    }
    if (!currentItemIDs.isEmpty()) {
      result.put(currentUserID,currentItemIDs);
    }
    return result;
  }
 catch (  SQLException sqle) {
    log.warn("String_Node_Str",sqle);
    throw new TasteException(sqle);
  }
 finally {
    IOUtils.quietClose(rs,stmt,conn);
  }
}

Fixed version (ground truth):
@Override public FastByIDMap<FastIDSet> exportWithIDsOnly() throws TasteException {
  log.debug("String_Node_Str");
  Connection conn=null;
  Statement stmt=null;
  ResultSet rs=null;
  FastByIDMap<FastIDSet> result=new FastByIDMap<FastIDSet>();
  try {
    conn=dataSource.getConnection();
    stmt=conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);
    stmt.setFetchDirection(ResultSet.FETCH_FORWARD);
    stmt.setFetchSize(getFetchSize());
    log.debug("String_Node_Str",getAllUsersSQL);
    rs=stmt.executeQuery(getAllUsersSQL);
    boolean currentUserIDSet=false;
    long currentUserID=0L;
    FastIDSet currentItemIDs=new FastIDSet(2);
    while (rs.next()) {
      long nextUserID=getLongColumn(rs,1);
      if (currentUserIDSet && (currentUserID != nextUserID) && !currentItemIDs.isEmpty()) {
        result.put(currentUserID,currentItemIDs);
        currentItemIDs=new FastIDSet(2);
      }
      currentItemIDs.add(getLongColumn(rs,2));
      currentUserID=nextUserID;
      currentUserIDSet=true;
    }
    if (!currentItemIDs.isEmpty()) {
      result.put(currentUserID,currentItemIDs);
    }
    return result;
  }
 catch (  SQLException sqle) {
    log.warn("String_Node_Str",sqle);
    throw new TasteException(sqle);
  }
 finally {
    IOUtils.quietClose(rs,stmt,conn);
  }
}
Program: 61257
Project: 61257
Buggy source:
@Override public FastByIDMap<PreferenceArray> exportWithPrefs() throws TasteException {
  log.debug("String_Node_Str");
  Connection conn=null;
  Statement stmt=null;
  ResultSet rs=null;
  FastByIDMap<PreferenceArray> result=new FastByIDMap<PreferenceArray>();
  try {
    conn=dataSource.getConnection();
    stmt=conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);
    stmt.setFetchDirection(ResultSet.FETCH_FORWARD);
    stmt.setFetchSize(getFetchSize());
    log.debug("String_Node_Str",getAllUsersSQL);
    rs=stmt.executeQuery(getAllUsersSQL);
    Long currentUserID=null;
    List<Preference> currentPrefs=new ArrayList<Preference>();
    while (rs.next()) {
      long nextUserID=getLongColumn(rs,1);
      if ((currentUserID != null) && !currentUserID.equals(nextUserID)) {
        if (!currentPrefs.isEmpty()) {
          result.put(currentUserID,new GenericUserPreferenceArray(currentPrefs));
          currentPrefs.clear();
        }
      }
 else {
        currentPrefs.add(buildPreference(rs));
      }
      currentUserID=nextUserID;
    }
    if (!currentPrefs.isEmpty()) {
      result.put(currentUserID,new GenericUserPreferenceArray(currentPrefs));
    }
    return result;
  }
 catch (  SQLException sqle) {
    log.warn("String_Node_Str",sqle);
    throw new TasteException(sqle);
  }
 finally {
    IOUtils.quietClose(rs,stmt,conn);
  }
}

Fixed version (ground truth):
@Override public FastByIDMap<PreferenceArray> exportWithPrefs() throws TasteException {
  log.debug("String_Node_Str");
  Connection conn=null;
  Statement stmt=null;
  ResultSet rs=null;
  FastByIDMap<PreferenceArray> result=new FastByIDMap<PreferenceArray>();
  try {
    conn=dataSource.getConnection();
    stmt=conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);
    stmt.setFetchDirection(ResultSet.FETCH_FORWARD);
    stmt.setFetchSize(getFetchSize());
    log.debug("String_Node_Str",getAllUsersSQL);
    rs=stmt.executeQuery(getAllUsersSQL);
    Long currentUserID=null;
    List<Preference> currentPrefs=new ArrayList<Preference>();
    while (rs.next()) {
      long nextUserID=getLongColumn(rs,1);
      if ((currentUserID != null) && !currentUserID.equals(nextUserID) && !currentPrefs.isEmpty()) {
        result.put(currentUserID,new GenericUserPreferenceArray(currentPrefs));
        currentPrefs.clear();
      }
      currentPrefs.add(buildPreference(rs));
      currentUserID=nextUserID;
    }
    if (!currentPrefs.isEmpty()) {
      result.put(currentUserID,new GenericUserPreferenceArray(currentPrefs));
    }
    return result;
  }
 catch (  SQLException sqle) {
    log.warn("String_Node_Str",sqle);
    throw new TasteException(sqle);
  }
 finally {
    IOUtils.quietClose(rs,stmt,conn);
  }
}
Program: 61258
Project: 61258
Buggy source:
/** 
 * Converts a value into a form that would help a human understand the internals of how the value is being interpreted.  For text-like things, this is likely to be a list of the terms found with associated weights (if any).
 * @param originalForm The original form of the value as a string.
 * @return A string that a human can read.
 */
@Override public String asString(String originalForm){
  return String.format("String_Node_Str",getName(),originalForm);
}

Fixed version (ground truth):
/** 
 * Converts a value into a form that would help a human understand the internals of how the value is being interpreted.  For text-like things, this is likely to be a list of the terms found with associated weights (if any).
 * @param originalForm The original form of the value as a string.
 * @return A string that a human can read.
 */
@Override public String asString(String originalForm){
  return String.format(Locale.ENGLISH,"String_Node_Str",getName(),originalForm);
}
Program: 61259
Project: 61259
Buggy source:
/** 
 * Adds a value to a vector.
 * @param originalForm1 The original form of the first value as a string.
 * @param originalForm2 The original form of the second value as a string.
 * @param data          The vector to which the value should be added.
 */
public void addInteractionToVector(String originalForm1,String originalForm2,Vector data){
  int probes=getProbes();
  String name=getName();
  for (int i=0; i < probes; i++) {
    int h1=hash1(name,originalForm1,i,data.size());
    int h2=hash2(name,originalForm1,i,data.size());
    int j=hash1(name,originalForm2,i,data.size());
    int n=(h1 + (j + 1) * h2) % data.size();
    trace(String.format("String_Node_Str",originalForm1,originalForm2),n);
    data.set(n,data.get(n) + 1);
  }
}

Fixed version (ground truth):
/** 
 * Adds a value to a vector.
 * @param originalForm1 The original form of the first value as a string.
 * @param originalForm2 The original form of the second value as a string.
 * @param data          The vector to which the value should be added.
 */
public void addInteractionToVector(String originalForm1,String originalForm2,Vector data){
  int probes=getProbes();
  String name=getName();
  for (int i=0; i < probes; i++) {
    int h1=hash1(name,originalForm1,i,data.size());
    int h2=hash2(name,originalForm1,i,data.size());
    int j=hash1(name,originalForm2,i,data.size());
    int n=(h1 + (j + 1) * h2) % data.size();
    if (n < 0) {
      n=n + data.size();
    }
    trace(String.format("String_Node_Str",originalForm1,originalForm2),n);
    data.set(n,data.get(n) + 1);
  }
}
Program: 61260
Project: 61260
Buggy source:
protected InteractionValueEncoder(String name){
  super(name,2);
}

Fixed version (ground truth):
public InteractionValueEncoder(String name){
  super(name,2);
}
Program: 61262
Project: 61262
Buggy source:
/** 
 * Emit the point to the most likely cluster
 * @param vector a VectorWritable holding the Vector
 * @param clusters a List of DirichletClusters
 * @param pi the normalized pdf Vector for the point
 * @param writer a SequenceFile.Writer to emit to
 * @throws IOException
 */
private void emitMostLikelyCluster(VectorWritable vector,List<DirichletCluster> clusters,Vector pi,Writer writer) throws IOException {
  for (int i=0; i < clusters.size(); i++) {
    double pdf=pi.get(i);
    if (pdf > threshold && clusters.get(i).getTotalCount() > 0) {
      writer.append(new IntWritable(i),new WeightedVectorWritable(pdf,vector));
    }
  }
}

Fixed version (ground truth):
/** 
 * Emit the point to the most likely cluster
 * @param vector a VectorWritable holding the Vector
 * @param clusters a List of DirichletClusters
 * @param pi the normalized pdf Vector for the point
 * @param writer a SequenceFile.Writer to emit to
 * @throws IOException
 */
private void emitMostLikelyCluster(VectorWritable vector,List<DirichletCluster> clusters,Vector pi,Writer writer) throws IOException {
  double maxPdf=0;
  int clusterId=-1;
  for (int i=0; i < clusters.size(); i++) {
    double pdf=pi.get(i);
    if (pdf > maxPdf) {
      maxPdf=pdf;
      clusterId=i;
    }
  }
  writer.append(new IntWritable(clusterId),new WeightedVectorWritable(maxPdf,vector));
}
Program: 61263
Project: 61263
Buggy source:
@Override public double pdf(VectorWritable v){
  Vector x=v.get();
  double pdf=pdf(x,stdDev.get(0));
  for (int i=1; i < x.size(); i++) {
    pdf*=pdf(x,stdDev.get(i));
  }
  return pdf;
}

Fixed version (ground truth):
@Override public double pdf(VectorWritable v){
  Vector x=v.get();
  double pdf=1;
  for (int i=0; i < x.size(); i++) {
    pdf*=UncommonDistributions.dNorm(x.getQuick(i),getCenter().getQuick(i),getRadius().getQuick(i));
  }
  return pdf;
}
Program: 61264
Project: 61264
Buggy source:
/** 
 * Calculate a pdf using the supplied sample and stdDev
 * @param x a Vector sample
 * @param sd a double std deviation
 */
private double pdf(Vector x,double sd){
  double sd2=sd * sd;
  double exp=-(x.dot(x) - 2 * x.dot(getCenter()) + getCenter().dot(getCenter())) / (2 * sd2);
  double ex=Math.exp(exp);
  return ex / (sd * SQRT2PI);
}

Fixed version (ground truth):
@Override public double pdf(VectorWritable vw){
  Vector x=vw.get();
  double pdf=0;
  for (int i=0; i < x.size(); i++) {
    double x2=x.get(i);
    double m=getCenter().get(i);
    double s=getRadius().get(i);
    double dNorm=UncommonDistributions.dNorm(x2,m,s);
    pdf+=dNorm;
  }
  return pdf / x.size();
}
Program: 61265
Project: 61265
Buggy source:
public static void main(String[] args) throws Exception {
  VectorWritable modelPrototype=new VectorWritable(new DenseVector(2));
  ModelDistribution<VectorWritable> modelDist=new GaussianClusterDistribution(modelPrototype);
  RandomUtils.useTestSeed();
  generateSamples();
  int numIterations=40;
  int numClusters=40;
  int alpha_0=1;
  int thin=3;
  int burnin=5;
  generateResults(modelDist,numClusters,numIterations,alpha_0,thin,burnin);
  new DisplayDirichlet();
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  VectorWritable modelPrototype=new VectorWritable(new DenseVector(2));
  ModelDistribution<VectorWritable> modelDist=new AsymmetricSampledNormalDistribution(modelPrototype);
  RandomUtils.useTestSeed();
  generateSamples();
  int numIterations=40;
  int numClusters=40;
  int alpha_0=1;
  int thin=3;
  int burnin=5;
  generateResults(modelDist,numClusters,numIterations,alpha_0,thin,burnin);
  new DisplayDirichlet();
}
Program: 61266
Project: 61266
Buggy source:
public double aggregate(Vector other,BinaryFunction aggregator,BinaryFunction combiner){
  double result=0.0;
  for (int i=0; i < size; i++) {
    result=aggregator.apply(result,combiner.apply(getQuick(i),other.getQuick(i)));
  }
  return result;
}

Fixed version (ground truth):
public double aggregate(Vector other,BinaryFunction aggregator,BinaryFunction combiner){
  if (size < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  double result=combiner.apply(getQuick(0),other.getQuick(0));
  for (int i=1; i < size; i++) {
    result=aggregator.apply(result,combiner.apply(getQuick(i),other.getQuick(i)));
  }
  return result;
}
Program: 61267
Project: 61267
Buggy source:
/** 
 * Merge the given canopy into the canopies list. If it touches any existing canopy (norm<T1) then add the center of each to the other. If it covers any other canopies (norm<T2), then merge the given canopy with the closest covering canopy. If the given canopy does not cover any other canopies, add it to the canopies list.
 * @param aCanopy a MeanShiftCanopy to be merged
 * @param canopies the List<Canopy> to be appended
 */
public void mergeCanopy(MeanShiftCanopy aCanopy,List<MeanShiftCanopy> canopies){
  MeanShiftCanopy closestCoveringCanopy=null;
  double closestNorm=Double.MAX_VALUE;
  for (  MeanShiftCanopy canopy : canopies) {
    double norm=measure.distance(canopy.getCenter(),aCanopy.getCenter());
    if (norm < t1) {
      aCanopy.touch(canopy);
    }
    if (norm < t2) {
      if ((closestCoveringCanopy == null) || (norm < closestNorm)) {
        closestNorm=norm;
        closestCoveringCanopy=canopy;
      }
    }
  }
  if (closestCoveringCanopy == null) {
    canopies.add(aCanopy);
  }
 else {
    closestCoveringCanopy.merge(aCanopy);
  }
}

Fixed version (ground truth):
/** 
 * Merge the given canopy into the canopies list. If it touches any existing canopy (norm<T1) then add the center of each to the other. If it covers any other canopies (norm<T2), then merge the given canopy with the closest covering canopy. If the given canopy does not cover any other canopies, add it to the canopies list.
 * @param aCanopy a MeanShiftCanopy to be merged
 * @param canopies the List<Canopy> to be appended
 */
public void mergeCanopy(MeanShiftCanopy aCanopy,List<MeanShiftCanopy> canopies){
  MeanShiftCanopy closestCoveringCanopy=null;
  double closestNorm=Double.MAX_VALUE;
  for (  MeanShiftCanopy canopy : canopies) {
    double norm=measure.distance(canopy.getCenter(),aCanopy.getCenter());
    if (norm < t1) {
      aCanopy.touch(canopy);
    }
    if (norm < t2 && ((closestCoveringCanopy == null) || (norm < closestNorm))) {
      closestNorm=norm;
      closestCoveringCanopy=canopy;
    }
  }
  if (closestCoveringCanopy == null) {
    canopies.add(aCanopy);
  }
 else {
    closestCoveringCanopy.merge(aCanopy);
  }
}
Program: 61268
Project: 61268
Buggy source:
/** 
 * This is the reference mean-shift implementation. Given its inputs it iterates over the points and clusters until their centers converge or until the maximum number of iterations is exceeded.
 * @param points the input List<Vector> of points
 * @param measure the DistanceMeasure to use
 * @param numIter the maximum number of iterations
 */
public static List<MeanShiftCanopy> clusterPoints(List<Vector> points,DistanceMeasure measure,double convergenceThreshold,double t1,double t2,int numIter){
  MeanShiftCanopyClusterer clusterer=new MeanShiftCanopyClusterer(measure,t1,t2,convergenceThreshold);
  List<MeanShiftCanopy> canopies=new ArrayList<MeanShiftCanopy>();
  int nextCanopyId=0;
  for (  Vector point : points) {
    clusterer.mergeCanopy(new MeanShiftCanopy(point,nextCanopyId++),canopies);
  }
  boolean converged=false;
  for (int iter=0; !converged && iter < numIter; iter++) {
    converged=runMeanShiftCanopyIteration(canopies,clusterer);
  }
  return canopies;
}

Fixed version (ground truth):
/** 
 * This is the reference mean-shift implementation. Given its inputs it iterates over the points and clusters until their centers converge or until the maximum number of iterations is exceeded.
 * @param points the input List<Vector> of points
 * @param measure the DistanceMeasure to use
 * @param numIter the maximum number of iterations
 */
public static List<MeanShiftCanopy> clusterPoints(List<Vector> points,DistanceMeasure measure,double convergenceThreshold,double t1,double t2,int numIter){
  MeanShiftCanopyClusterer clusterer=new MeanShiftCanopyClusterer(measure,t1,t2,convergenceThreshold);
  List<MeanShiftCanopy> canopies=new ArrayList<MeanShiftCanopy>();
  int nextCanopyId=0;
  for (  Vector point : points) {
    clusterer.mergeCanopy(new MeanShiftCanopy(point,nextCanopyId++),canopies);
  }
  boolean converged=false;
  for (int iter=0; !converged && iter < numIter; iter++) {
    converged=true;
    List<MeanShiftCanopy> migratedCanopies=new ArrayList<MeanShiftCanopy>();
    for (    MeanShiftCanopy canopy : canopies) {
      converged=clusterer.shiftToMean(canopy) && converged;
      clusterer.mergeCanopy(canopy,migratedCanopies);
    }
    canopies=migratedCanopies;
  }
  return canopies;
}
Program: 61269
Project: 61269
Buggy source:
/** 
 * Print a graphical representation of the clustered image points as a 10x10 character mask 
 */
private void printImage(List<MeanShiftCanopy> canopies){
  char[][] out=new char[10][10];
  for (int i=0; i < out.length; i++) {
    for (int j=0; j < out[0].length; j++) {
      out[i][j]=' ';
    }
  }
  for (  MeanShiftCanopy canopy : canopies) {
    int ch='A' + canopy.getCanopyId();
    for (    int pid : canopy.getBoundPoints().elements()) {
      Vector pt=raw[pid];
      out[(int)pt.getQuick(0)][(int)pt.getQuick(1)]=(char)ch;
    }
  }
  for (  char[] anOut : out) {
    System.out.println(anOut);
  }
}

Fixed version (ground truth):
/** 
 * Print a graphical representation of the clustered image points as a 10x10 character mask 
 */
private void printImage(List<MeanShiftCanopy> canopies){
  char[][] out=new char[10][10];
  for (int i=0; i < out.length; i++) {
    for (int j=0; j < out[0].length; j++) {
      out[i][j]=' ';
    }
  }
  for (  MeanShiftCanopy canopy : canopies) {
    int ch='A' + canopy.getCanopyId();
    for (    int pid : canopy.getBoundPoints().toList()) {
      Vector pt=raw[pid];
      out[(int)pt.getQuick(0)][(int)pt.getQuick(1)]=(char)ch;
    }
  }
  for (  char[] anOut : out) {
    System.out.println(anOut);
  }
}
Program: 61272
Project: 61272
Buggy source:
@Override public void paint(Graphics g){
  Graphics2D g2=(Graphics2D)g;
  double sx=(double)res / DS;
  g2.setTransform(AffineTransform.getScaleInstance(sx,sx));
  g2.setColor(Color.BLACK);
  Vector dv=new DenseVector(2).assign(SIZE / 2.0);
  Vector dv1=new DenseVector(2).assign(t1);
  Vector dv2=new DenseVector(2).assign(t2);
  DisplayDirichlet.plotRectangle(g2,new DenseVector(2).assign(2),dv);
  DisplayDirichlet.plotRectangle(g2,new DenseVector(2).assign(-2),dv);
  g2.setColor(Color.DARK_GRAY);
  dv.assign(0.03);
  for (  VectorWritable v : SAMPLE_DATA) {
    DisplayDirichlet.plotRectangle(g2,v.get(),dv);
  }
  int i=0;
  for (  MeanShiftCanopy canopy : canopies) {
    if (canopy.getBoundPoints().toList().size() > 0.015 * DisplayDirichlet.SAMPLE_DATA.size()) {
      g2.setColor(COLORS[Math.min(i++,DisplayDirichlet.COLORS.length - 1)]);
      for (      int v : canopy.getBoundPoints().elements()) {
        DisplayDirichlet.plotRectangle(g2,SAMPLE_DATA.get(v).get(),dv);
      }
      DisplayDirichlet.plotEllipse(g2,canopy.getCenter(),dv1);
      DisplayDirichlet.plotEllipse(g2,canopy.getCenter(),dv2);
    }
  }
}

Fixed version (ground truth):
@Override public void paint(Graphics g){
  Graphics2D g2=(Graphics2D)g;
  double sx=(double)res / DS;
  g2.setTransform(AffineTransform.getScaleInstance(sx,sx));
  g2.setColor(Color.BLACK);
  Vector dv=new DenseVector(2).assign(SIZE / 2.0);
  Vector dv1=new DenseVector(2).assign(t1);
  Vector dv2=new DenseVector(2).assign(t2);
  DisplayDirichlet.plotRectangle(g2,new DenseVector(2).assign(2),dv);
  DisplayDirichlet.plotRectangle(g2,new DenseVector(2).assign(-2),dv);
  g2.setColor(Color.DARK_GRAY);
  dv.assign(0.03);
  for (  VectorWritable v : SAMPLE_DATA) {
    DisplayDirichlet.plotRectangle(g2,v.get(),dv);
  }
  int i=0;
  for (  MeanShiftCanopy canopy : canopies) {
    if (canopy.getBoundPoints().toList().size() > 0.015 * DisplayDirichlet.SAMPLE_DATA.size()) {
      g2.setColor(COLORS[Math.min(i++,DisplayDirichlet.COLORS.length - 1)]);
      int count=0;
      Vector center=new DenseVector(2);
      for (      int vix : canopy.getBoundPoints().toList()) {
        Vector v=SAMPLE_DATA.get(vix).get();
        count++;
        v.addTo(center);
        DisplayDirichlet.plotRectangle(g2,v,dv);
      }
      center=center.divide(count);
      DisplayDirichlet.plotEllipse(g2,center,dv1);
      DisplayDirichlet.plotEllipse(g2,center,dv2);
    }
  }
}
Program: 61273
Project: 61273
Buggy source:
public boolean inProgress(){
synchronized (inProgress) {
    return inProgress;
  }
}

Fixed version (ground truth):
public boolean inProgress(){
  return inProgress;
}
Program: 61274
Project: 61274
Buggy source:
void setInProgress(boolean status){
synchronized (inProgress) {
    inProgress=status;
  }
}

Fixed version (ground truth):
void setInProgress(boolean status){
  inProgress=status;
}
Program: 61275
Project: 61275
Buggy source:
/** 
 */
protected double b00(double a,double b,RandomEngine randomGenerator){
  if (a != a_last || b != b_last) {
    a_last=a;
    b_last=b;
    a_=a - 1.0;
    b_=b - 1.0;
    double c=(b * b_) / (a * a_);
    t=(c == 1.0) ? 0.5 : (1.0 - Math.sqrt(c)) / (1.0 - c);
    fa=Math.exp(a_ * Math.log(t));
    fb=Math.exp(b_ * Math.log(1.0 - t));
    p1=t / a;
    p2=(1.0 - t) / b + p1;
  }
  double X;
  while (true) {
    double Z;
    double V;
    double U;
    if ((U=randomGenerator.raw() * p2) <= p1) {
      Z=Math.exp(Math.log(U / p1) / a);
      X=t * Z;
      if ((V=randomGenerator.raw() * fb) <= 1.0 - b_ * X) {
        break;
      }
      if (V <= 1.0 + (fb - 1.0) * Z) {
        if (Math.log(V) <= b_ * Math.log(1.0 - X)) {
          break;
        }
      }
    }
 else {
      Z=Math.exp(Math.log((U - p1) / (p2 - p1)) / b);
      X=1.0 - (1.0 - t) * Z;
      if ((V=randomGenerator.raw() * fa) <= 1.0 - a_ * (1.0 - X)) {
        break;
      }
      if (V <= 1.0 + (fa - 1.0) * Z) {
        if (Math.log(V) <= a_ * Math.log(X)) {
          break;
        }
      }
    }
  }
  return (X);
}

Fixed version (ground truth):
/** 
 */
protected double b00(double a,double b,RandomEngine randomGenerator){
  if (a != a_last || b != b_last) {
    a_last=a;
    b_last=b;
    a_=a - 1.0;
    b_=b - 1.0;
    double c=(b * b_) / (a * a_);
    if (Math.abs(c - 1.0) < 1e-8) {
      t=0.5;
    }
 else {
      t=(1.0 - Math.sqrt(c)) / (1.0 - c);
    }
    fa=Math.exp(a_ * Math.log(t));
    fb=Math.exp(b_ * Math.log(1.0 - t));
    p1=t / a;
    p2=(1.0 - t) / b + p1;
  }
  double X;
  while (true) {
    double Z;
    double V;
    double U;
    if ((U=randomGenerator.raw() * p2) <= p1) {
      Z=Math.exp(Math.log(U / p1) / a);
      X=t * Z;
      if ((V=randomGenerator.raw() * fb) <= 1.0 - b_ * X) {
        break;
      }
      if (V <= 1.0 + (fb - 1.0) * Z) {
        if (Math.log(V) <= b_ * Math.log(1.0 - X)) {
          break;
        }
      }
    }
 else {
      Z=Math.exp(Math.log((U - p1) / (p2 - p1)) / b);
      X=1.0 - (1.0 - t) * Z;
      if ((V=randomGenerator.raw() * fa) <= 1.0 - a_ * (1.0 - X)) {
        break;
      }
      if (V <= 1.0 + (fa - 1.0) * Z) {
        if (Math.log(V) <= a_ * Math.log(X)) {
          break;
        }
      }
    }
  }
  return (X);
}
Program: 61276
Project: 61276
Buggy source:
private static void setIOSort(JobConf conf){
  conf.setInt("String_Node_Str",100);
  conf.setInt("String_Node_Str",1000);
  String javaOpts=conf.get("String_Node_Str");
  if (javaOpts != null) {
    Matcher m=Pattern.compile("String_Node_Str").matcher(javaOpts);
    if (m.matches()) {
      int heapMB=Integer.parseInt(m.group(1));
      conf.setInt("String_Node_Str",heapMB / 2);
    }
  }
}

Fixed version (ground truth):
private static void setIOSort(JobConf conf){
  conf.setInt("String_Node_Str",100);
  conf.setInt("String_Node_Str",200);
  String javaOpts=conf.get("String_Node_Str");
  if (javaOpts != null) {
    Matcher m=Pattern.compile("String_Node_Str").matcher(javaOpts);
    if (m.find()) {
      int heapMB=Integer.parseInt(m.group(1));
      String megabyteOrGigabyte=m.group(2);
      if ("String_Node_Str".equalsIgnoreCase(megabyteOrGigabyte)) {
        heapMB*=1024;
      }
      conf.setInt("String_Node_Str",heapMB / 2);
    }
  }
}
Program: 61277
Project: 61277
Buggy source:
private Vector maybePruneUserVector(Vector userVector){
  if (userVector.getNumNondefaultElements() <= MAX_PREFS_CONSIDERED) {
    return userVector;
  }
  OpenIntIntHashMap countCounts=new OpenIntIntHashMap();
  Iterator<Vector.Element> it=userVector.iterateNonZero();
  while (it.hasNext()) {
    int index=it.next().index();
    int count=indexCounts.get(index);
    countCounts.adjustOrPutValue(count,1,1);
  }
  int resultingSizeAtCutoff=0;
  int cutoff=0;
  while (resultingSizeAtCutoff <= MAX_PREFS_CONSIDERED) {
    cutoff++;
    int count=indexCounts.get(cutoff);
    resultingSizeAtCutoff+=count;
  }
  Iterator<Vector.Element> it2=userVector.iterateNonZero();
  while (it2.hasNext()) {
    Vector.Element e=it2.next();
    int index=e.index();
    int count=indexCounts.get(index);
    if (count > cutoff) {
      e.set(0.0);
    }
  }
  return userVector;
}

Fixed version (ground truth):
private Vector maybePruneUserVector(Vector userVector){
  if (userVector.getNumNondefaultElements() <= MAX_PREFS_CONSIDERED) {
    return userVector;
  }
  OpenIntIntHashMap countCounts=new OpenIntIntHashMap();
  Iterator<Vector.Element> it=userVector.iterateNonZero();
  while (it.hasNext()) {
    int index=it.next().index();
    int count=indexCounts.get(index);
    countCounts.adjustOrPutValue(count,1,1);
  }
  IntArrayList countsList=new IntArrayList(countCounts.size());
  countCounts.keys(countsList);
  int[] counts=countsList.elements();
  Arrays.sort(counts);
  int resultingSizeAtCutoff=0;
  int cutoffIndex=0;
  while (cutoffIndex < counts.length && resultingSizeAtCutoff <= MAX_PREFS_CONSIDERED) {
    int cutoff=counts[cutoffIndex];
    cutoffIndex++;
    int count=countCounts.get(cutoff);
    resultingSizeAtCutoff+=count;
  }
  cutoffIndex--;
  if (resultingSizeAtCutoff > MAX_PREFS_CONSIDERED) {
    int cutoff=counts[cutoffIndex];
    Iterator<Vector.Element> it2=userVector.iterateNonZero();
    while (it2.hasNext()) {
      Vector.Element e=it2.next();
      int index=e.index();
      int count=indexCounts.get(index);
      if (count >= cutoff) {
        e.set(0.0);
      }
    }
  }
  return userVector;
}
Program: 61278
Project: 61278
Buggy source:
/** 
 * Return a human-readable formatted string representation of the vector, not intended to be complete nor usable as an input/output representation such as Json
 * @param v a Vector
 * @return a String
 */
public static String formatVector(Vector v,String[] bindings){
  StringBuilder buf=new StringBuilder();
  int nzero=0;
  Iterator<Element> iterateNonZero=v.iterateNonZero();
  while (iterateNonZero.hasNext()) {
    iterateNonZero.next();
    nzero++;
  }
  if ((nzero < v.size()) || (bindings != null)) {
    buf.append('[');
    for (int i=0; i < v.size(); i++) {
      double elem=v.get(i);
      if (elem == 0.0) {
        continue;
      }
      String label;
      if ((bindings != null) && ((label=bindings[i]) != null)) {
        buf.append(label).append(':');
      }
 else {
        buf.append(i).append(':');
      }
      buf.append(String.format(Locale.ENGLISH,"String_Node_Str",elem)).append("String_Node_Str");
    }
  }
 else {
    buf.append('[');
    for (int i=0; i < v.size(); i++) {
      double elem=v.get(i);
      buf.append(String.format(Locale.ENGLISH,"String_Node_Str",elem)).append("String_Node_Str");
    }
  }
  buf.setLength(buf.length() - 2);
  buf.append(']');
  return buf.toString();
}

Fixed version (ground truth):
/** 
 * Return a human-readable formatted string representation of the vector, not intended to be complete nor usable as an input/output representation such as Json
 * @param v a Vector
 * @return a String
 */
public static String formatVector(Vector v,String[] bindings){
  StringBuilder buf=new StringBuilder();
  int nzero=0;
  Iterator<Element> iterateNonZero=v.iterateNonZero();
  while (iterateNonZero.hasNext()) {
    iterateNonZero.next();
    nzero++;
  }
  if ((nzero < v.size()) || (bindings != null)) {
    buf.append('[');
    for (int i=0; i < v.size(); i++) {
      double elem=v.get(i);
      if (elem == 0.0) {
        continue;
      }
      String label;
      if ((bindings != null) && ((label=bindings[i]) != null)) {
        buf.append(label).append(':');
      }
 else {
        buf.append(i).append(':');
      }
      buf.append(String.format(Locale.ENGLISH,"String_Node_Str",elem)).append("String_Node_Str");
    }
  }
 else {
    buf.append('[');
    for (int i=0; i < v.size(); i++) {
      double elem=v.get(i);
      buf.append(String.format(Locale.ENGLISH,"String_Node_Str",elem)).append("String_Node_Str");
    }
  }
  if (buf.length() > 1) {
    buf.setLength(buf.length() - 2);
  }
  buf.append(']');
  return buf.toString();
}
Program: 61279
Project: 61279
Buggy source:
/** 
 * This method is used by the CanopyMapper to perform canopy inclusion tests and to emit the point keyed by its covering canopies to the output. if the point is not covered by any canopies (due to canopy centroid clustering), emit the point to the closest covering canopy.
 * @param point the point to be added
 * @param canopies the List<Canopy> to be appended
 * @param collector an OutputCollector in which to emit the point
 * @param reporter to report status of the job
 */
public void emitPointToExistingCanopies(Vector point,List<Canopy> canopies,OutputCollector<Text,VectorWritable> collector,Reporter reporter) throws IOException {
  double minDist=Double.MAX_VALUE;
  Canopy closest=null;
  boolean isCovered=false;
  for (  Canopy canopy : canopies) {
    double dist=measure.distance(canopy.getCenter().getLengthSquared(),canopy.getCenter(),point);
    if (dist < t1) {
      isCovered=true;
      VectorWritable vw=new VectorWritable(point);
      collector.collect(new Text(canopy.getIdentifier()),vw);
      reporter.setStatus("String_Node_Str" + canopy.getIdentifier());
    }
 else     if (dist < minDist) {
      minDist=dist;
      closest=canopy;
    }
  }
  if (!isCovered) {
    VectorWritable vw=new VectorWritable(point);
    collector.collect(new Text(closest.getIdentifier()),vw);
    reporter.setStatus("String_Node_Str" + closest.getIdentifier());
  }
}

Fixed version (ground truth):
/** 
 * This method is used by the CanopyMapper to perform canopy inclusion tests and to emit the point keyed by its covering canopies to the output. if the point is not covered by any canopies (due to canopy centroid clustering), emit the point to the closest covering canopy.
 * @param point the point to be added
 * @param canopies the List<Canopy> to be appended
 * @param collector an OutputCollector in which to emit the point
 * @param reporter to report status of the job
 */
public void emitPointToExistingCanopies(Vector point,List<Canopy> canopies,OutputCollector<IntWritable,VectorWritable> collector,Reporter reporter) throws IOException {
  double minDist=Double.MAX_VALUE;
  Canopy closest=null;
  boolean isCovered=false;
  for (  Canopy canopy : canopies) {
    double dist=measure.distance(canopy.getCenter().getLengthSquared(),canopy.getCenter(),point);
    if (dist < t1) {
      isCovered=true;
      VectorWritable vw=new VectorWritable(point);
      collector.collect(new IntWritable(canopy.getId()),vw);
      reporter.setStatus("String_Node_Str" + canopy.getIdentifier());
    }
 else     if (dist < minDist) {
      minDist=dist;
      closest=canopy;
    }
  }
  if (!isCovered) {
    collector.collect(new IntWritable(closest.getId()),new VectorWritable(point));
    reporter.setStatus("String_Node_Str" + closest.getIdentifier());
  }
}
Program: 61280
Project: 61280
Buggy source:
/** 
 * Run the job
 * @param points the input points directory pathname String
 * @param canopies the input canopies directory pathname String
 * @param output the output directory pathname String
 * @param measureClassName the DistanceMeasure class name
 * @param t1 the T1 distance threshold
 * @param t2 the T2 distance threshold
 */
public static void runJob(String points,String canopies,String output,String measureClassName,double t1,double t2) throws IOException {
  Configurable client=new JobClient();
  JobConf conf=new JobConf(ClusterDriver.class);
  conf.set(CanopyConfigKeys.DISTANCE_MEASURE_KEY,measureClassName);
  conf.set(CanopyConfigKeys.T1_KEY,String.valueOf(t1));
  conf.set(CanopyConfigKeys.T2_KEY,String.valueOf(t2));
  conf.set(CanopyConfigKeys.CANOPY_PATH_KEY,canopies);
  conf.setInputFormat(SequenceFileInputFormat.class);
  conf.setOutputKeyClass(Text.class);
  conf.setOutputValueClass(VectorWritable.class);
  conf.setOutputFormat(SequenceFileOutputFormat.class);
  FileInputFormat.setInputPaths(conf,new Path(points));
  Path outPath=new Path(output + DEFAULT_CLUSTER_OUTPUT_DIRECTORY);
  FileOutputFormat.setOutputPath(conf,outPath);
  conf.setMapperClass(ClusterMapper.class);
  conf.setReducerClass(IdentityReducer.class);
  client.setConf(conf);
  FileSystem dfs=FileSystem.get(outPath.toUri(),conf);
  if (dfs.exists(outPath)) {
    dfs.delete(outPath,true);
  }
  JobClient.runJob(conf);
}

Fixed version (ground truth):
/** 
 * Run the job
 * @param points the input points directory pathname String
 * @param canopies the input canopies directory pathname String
 * @param output the output directory pathname String
 * @param measureClassName the DistanceMeasure class name
 * @param t1 the T1 distance threshold
 * @param t2 the T2 distance threshold
 */
public static void runJob(String points,String canopies,String output,String measureClassName,double t1,double t2) throws IOException {
  Configurable client=new JobClient();
  JobConf conf=new JobConf(ClusterDriver.class);
  conf.set(CanopyConfigKeys.DISTANCE_MEASURE_KEY,measureClassName);
  conf.set(CanopyConfigKeys.T1_KEY,String.valueOf(t1));
  conf.set(CanopyConfigKeys.T2_KEY,String.valueOf(t2));
  conf.set(CanopyConfigKeys.CANOPY_PATH_KEY,canopies);
  conf.setInputFormat(SequenceFileInputFormat.class);
  conf.setOutputKeyClass(IntWritable.class);
  conf.setOutputValueClass(VectorWritable.class);
  conf.setOutputFormat(SequenceFileOutputFormat.class);
  FileInputFormat.setInputPaths(conf,new Path(points));
  Path outPath=new Path(output + DEFAULT_CLUSTER_OUTPUT_DIRECTORY);
  FileOutputFormat.setOutputPath(conf,outPath);
  conf.setMapperClass(ClusterMapper.class);
  conf.setReducerClass(IdentityReducer.class);
  conf.setNumReduceTasks(0);
  client.setConf(conf);
  FileSystem dfs=FileSystem.get(outPath.toUri(),conf);
  if (dfs.exists(outPath)) {
    dfs.delete(outPath,true);
  }
  JobClient.runJob(conf);
}
Program: 61281
Project: 61281
Buggy source:
@Override public void map(WritableComparable<?> key,VectorWritable point,OutputCollector<Text,VectorWritable> output,Reporter reporter) throws IOException {
  canopyClusterer.emitPointToExistingCanopies(point.get(),canopies,output,reporter);
}

Fixed version (ground truth):
@Override public void map(WritableComparable<?> key,VectorWritable point,OutputCollector<IntWritable,VectorWritable> output,Reporter reporter) throws IOException {
  canopyClusterer.emitPointToExistingCanopies(point.get(),canopies,output,reporter);
}
Program: 61282
Project: 61282
Buggy source:
/** 
 * Run the job using supplied arguments
 * @param input the directory pathname for input points
 * @param stateIn the directory pathname for input state
 * @param output the directory pathname for output points
 */
public static void runClustering(String input,String stateIn,String output){
  Configurable client=new JobClient();
  JobConf conf=new JobConf(DirichletDriver.class);
  conf.setOutputKeyClass(Text.class);
  conf.setOutputValueClass(Text.class);
  FileInputFormat.setInputPaths(conf,new Path(input));
  Path outPath=new Path(output);
  FileOutputFormat.setOutputPath(conf,outPath);
  conf.setMapperClass(DirichletMapper.class);
  conf.setNumReduceTasks(0);
  client.setConf(conf);
  try {
    JobClient.runJob(conf);
  }
 catch (  IOException e) {
    log.warn(e.toString(),e);
  }
}

Fixed version (ground truth):
/** 
 * Run the job using supplied arguments
 * @param input the directory pathname for input points
 * @param stateIn the directory pathname for input state
 * @param output the directory pathname for output points
 */
public static void runClustering(String input,String stateIn,String output){
  JobConf conf=new JobConf(DirichletDriver.class);
  conf.setJobName("String_Node_Str");
  conf.setOutputKeyClass(IntWritable.class);
  conf.setOutputValueClass(VectorWritable.class);
  FileInputFormat.setInputPaths(conf,new Path(input));
  Path outPath=new Path(output);
  FileOutputFormat.setOutputPath(conf,outPath);
  conf.setMapperClass(DirichletClusterMapper.class);
  conf.setInputFormat(SequenceFileInputFormat.class);
  conf.setOutputFormat(SequenceFileOutputFormat.class);
  conf.setNumReduceTasks(0);
  conf.set(STATE_IN_KEY,stateIn);
  try {
    JobClient.runJob(conf);
  }
 catch (  IOException e) {
    log.warn(e.toString(),e);
  }
}
Program: 61283
Project: 61283
Buggy source:
/** 
 * Run the job using supplied arguments
 * @param input the directory pathname for input points
 * @param output the directory pathname for output points
 * @param modelFactory the String ModelDistribution class name to use
 * @param numClusters the number of models
 * @param maxIterations the maximum number of iterations
 * @param alpha_0 the alpha_0 value for the DirichletDistribution
 * @param numReducers the number of Reducers desired
 */
public static void runJob(String input,String output,String modelFactory,String modelPrototype,int prototypeSize,int numClusters,int maxIterations,double alpha_0,int numReducers) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException, SecurityException, NoSuchMethodException, InvocationTargetException {
  String stateIn=output + "String_Node_Str";
  writeInitialState(output,stateIn,modelFactory,modelPrototype,prototypeSize,numClusters,alpha_0);
  for (int iteration=0; iteration < maxIterations; iteration++) {
    log.info("String_Node_Str",iteration);
    String stateOut=output + "String_Node_Str" + (iteration + 1);
    runIteration(input,stateIn,stateOut,modelFactory,modelPrototype,prototypeSize,numClusters,alpha_0,numReducers);
    stateIn=stateOut;
  }
}

Fixed version (ground truth):
/** 
 * Run the job using supplied arguments
 * @param input the directory pathname for input points
 * @param output the directory pathname for output points
 * @param modelFactory the String ModelDistribution class name to use
 * @param modelPrototype the String class name of the model prototype
 * @param prototypeSize the int size of the prototype to use
 * @param numClusters the number of models
 * @param maxIterations the maximum number of iterations
 * @param alpha_0 the alpha_0 value for the DirichletDistribution
 * @param numReducers the number of Reducers desired
 */
public static void runJob(String input,String output,String modelFactory,String modelPrototype,int prototypeSize,int numClusters,int maxIterations,double alpha_0,int numReducers) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException, SecurityException, NoSuchMethodException, InvocationTargetException {
  String stateIn=output + "String_Node_Str";
  writeInitialState(output,stateIn,modelFactory,modelPrototype,prototypeSize,numClusters,alpha_0);
  for (int iteration=0; iteration < maxIterations; iteration++) {
    log.info("String_Node_Str",iteration);
    String stateOut=output + "String_Node_Str" + (iteration + 1);
    runIteration(input,stateIn,stateOut,modelFactory,modelPrototype,prototypeSize,numClusters,alpha_0,numReducers);
    stateIn=stateOut;
  }
  runClustering(input,stateIn,output + "String_Node_Str");
}
Program: 61284
Project: 61284
Buggy source:
/** 
 * @return value reference if key is found, filled in with value data, or null if not found
 */
public V get(K key,V value) throws IOException {
  for (  MapFile.Reader reader : readers) {
    if (reader.get(key,value) != null) {
      return value;
    }
  }
  log.debug("String_Node_Str",key);
  return null;
}

Fixed version (ground truth):
/** 
 * @return value reference if key is found, filled in with value data, or null if not found
 */
public V get(K key,V value) throws IOException {
  for (  MapFile.Reader reader : readers) {
    V theValue;
    if ((theValue=(V)reader.get(key,value)) != null) {
      return theValue;
    }
  }
  log.debug("String_Node_Str",key);
  return null;
}
Program: 61285
Project: 61285
Buggy source:
@Override public void readFields(DataInput in) throws IOException {
  recommended=new ArrayList<RecommendedItem>();
  try {
    do {
      long itemID=in.readLong();
      float value=in.readFloat();
      if (!Float.isNaN(value)) {
        RecommendedItem recommendedItem=new GenericRecommendedItem(itemID,value);
        recommended.add(recommendedItem);
      }
    }
 while (true);
  }
 catch (  EOFException eofe) {
  }
catch (  ArrayIndexOutOfBoundsException aiooe) {
  }
}

Fixed version (ground truth):
@Override public void readFields(DataInput in) throws IOException {
  int size=in.readInt();
  recommended=new ArrayList<RecommendedItem>(size);
  for (int i=0; i < size; i++) {
    long itemID=in.readLong();
    float value=in.readFloat();
    RecommendedItem recommendedItem=new GenericRecommendedItem(itemID,value);
    recommended.add(recommendedItem);
  }
}
Program: 61286
Project: 61286
Buggy source:
@Override public String toString(){
  StringBuilder result=new StringBuilder(200);
  result.append('[');
  boolean first=true;
  for (  RecommendedItem item : recommended) {
    if (first) {
      first=false;
    }
 else {
      result.append(',');
    }
    result.append(item.getItemID());
    result.append(':');
    result.append(item.getValue());
  }
  result.append(']');
  return result.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder result=new StringBuilder(200);
  result.append('[');
  boolean first=true;
  for (  RecommendedItem item : recommended) {
    if (first) {
      first=false;
    }
 else {
      result.append(',');
    }
    result.append(String.valueOf(item.getItemID()));
    result.append(':');
    result.append(String.valueOf(item.getValue()));
  }
  result.append(']');
  return result.toString();
}
Program: 61287
Project: 61287
Buggy source:
@Override public void write(DataOutput out) throws IOException {
  for (  RecommendedItem item : recommended) {
    out.writeLong(item.getItemID());
    out.writeFloat(item.getValue());
  }
}

Fixed version (ground truth):
@Override public void write(DataOutput out) throws IOException {
  out.writeInt(recommended.size());
  for (  RecommendedItem item : recommended) {
    out.writeLong(item.getItemID());
    out.writeFloat(item.getValue());
  }
}
Program: 61288
Project: 61288
Buggy source:
private CooccurrenceCache(MapFilesMap<IntWritable,VectorWritable> map){
  this.map=map;
  columnVector=new VectorWritable();
  columnVector.set(new RandomAccessSparseVector(Integer.MAX_VALUE,1000));
}

Fixed version (ground truth):
private CooccurrenceCache(MapFilesMap<IntWritable,VectorWritable> map){
  this.map=map;
}
Program: 61289
Project: 61289
Buggy source:
@Override public Vector get(IntWritable key) throws TasteException {
  VectorWritable writable;
  try {
    writable=map.get(key,columnVector);
  }
 catch (  IOException ioe) {
    throw new TasteException(ioe);
  }
  if (writable == null) {
    return null;
  }
  Vector value=writable.get();
  if (value == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  columnVector=new VectorWritable();
  columnVector.set(new RandomAccessSparseVector(Integer.MAX_VALUE,1000));
  return value;
}

Fixed version (ground truth):
@Override public Vector get(IntWritable key) throws TasteException {
  VectorWritable columnVector=new VectorWritable();
  try {
    columnVector=map.get(key,columnVector);
  }
 catch (  IOException ioe) {
    throw new TasteException(ioe);
  }
  if (columnVector == null) {
    return null;
  }
  Vector value=columnVector.get();
  if (value == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  return value;
}
Program: 61291
Project: 61291
Buggy source:
public ItemPrefWithLengthWritable[] getItemPrefs(){
  Writable[] writables=get();
  ItemPrefWithLengthWritable[] itemPrefs=new ItemPrefWithLengthWritable[writables.length];
  for (int n=0; n < writables.length; n++) {
    itemPrefs[n]=(ItemPrefWithLengthWritable)writables[n];
  }
  return itemPrefs;
}

Fixed version (ground truth):
public ItemPrefWithLengthWritable[] getItemPrefs(){
  return (ItemPrefWithLengthWritable[])toArray();
}
Program: 61292
Project: 61292
Buggy source:
public UserPrefWritable[] getUserPrefs(){
  Writable[] writables=get();
  UserPrefWritable[] userPrefs=new UserPrefWritable[writables.length];
  for (int n=0; n < writables.length; n++) {
    userPrefs[n]=(UserPrefWritable)writables[n];
  }
  return userPrefs;
}

Fixed version (ground truth):
public UserPrefWritable[] getUserPrefs(){
  return (UserPrefWritable[])toArray();
}
Program: 61293
Project: 61293
Buggy source:
protected void processFile(FileLineIterator dataOrUpdateFileIterator,FastByIDMap<?> data){
  log.info("String_Node_Str");
  AtomicInteger count=new AtomicInteger();
  while (dataOrUpdateFileIterator.hasNext()) {
    String line=dataOrUpdateFileIterator.next();
    if (line.length() > 0) {
      processLine(line,data);
      int currentCount=count.incrementAndGet();
      if (currentCount % 1000000 == 0) {
        log.info("String_Node_Str",currentCount);
      }
    }
  }
  log.info("String_Node_Str",count.get());
}

Fixed version (ground truth):
protected void processFile(FileLineIterator dataOrUpdateFileIterator,FastByIDMap<?> data,boolean fromPriorData){
  log.info("String_Node_Str");
  AtomicInteger count=new AtomicInteger();
  while (dataOrUpdateFileIterator.hasNext()) {
    String line=dataOrUpdateFileIterator.next();
    if (line.length() > 0) {
      processLine(line,data,fromPriorData);
      int currentCount=count.incrementAndGet();
      if (currentCount % 1000000 == 0) {
        log.info("String_Node_Str",currentCount);
      }
    }
  }
  log.info("String_Node_Str",count.get());
}
Program: 61296
Project: 61296
Buggy source:
@Override protected DataModel buildModel() throws IOException {
  FastByIDMap<Collection<Preference>> data=new FastByIDMap<Collection<Preference>>();
  FileLineIterator iterator=new FileLineIterator(getDataFile(),false);
  processFile(iterator,data);
  return new GenericDataModel(GenericDataModel.toDataMap(data,true));
}

Fixed version (ground truth):
@Override protected DataModel buildModel() throws IOException {
  FastByIDMap<Collection<Preference>> data=new FastByIDMap<Collection<Preference>>();
  FileLineIterator iterator=new FileLineIterator(getDataFile(),false);
  processFile(iterator,data,false);
  return new GenericDataModel(GenericDataModel.toDataMap(data,true));
}