nus-yam/ex-repair huggingface dataset:
Program: 46622
Project: 46622
Buggy source:
private void saveStripInfo(ScanStrip strip,File file){
  try {
    StreamResult streamResult=new StreamResult(file);
    SAXTransformerFactory tf=(SAXTransformerFactory)SAXTransformerFactory.newInstance();
    TransformerHandler hd=tf.newTransformerHandler();
    Transformer serializer=hd.getTransformer();
    serializer.setOutputProperty(OutputKeys.ENCODING,"String_Node_Str");
    serializer.setOutputProperty(OutputKeys.INDENT,"String_Node_Str");
    hd.setResult(streamResult);
    hd.startDocument();
    strip.writeXml(hd);
    hd.endDocument();
  }
 catch (  SAXException ex) {
    log.error("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str"+ ex.getMessage());
  }
catch (  TransformerConfigurationException ex) {
    log.error("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str"+ ex.getMessage());
  }
}

Fixed version (ground truth):
private void saveStripInfo(ScanStrip strip,File file){
  try {
    StreamResult streamResult=new StreamResult(file);
    SAXTransformerFactory tf=(SAXTransformerFactory)SAXTransformerFactory.newInstance();
    TransformerHandler hd=tf.newTransformerHandler();
    Transformer serializer=hd.getTransformer();
    serializer.setOutputProperty(OutputKeys.ENCODING,"String_Node_Str");
    serializer.setOutputProperty(OutputKeys.INDENT,"String_Node_Str");
    hd.setResult(streamResult);
    hd.startDocument();
    strip.writeXml(hd);
    hd.endDocument();
  }
 catch (  SAXException ex) {
    log.severe("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str"+ ex.getMessage());
  }
catch (  TransformerConfigurationException ex) {
    log.severe("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str"+ ex.getMessage());
  }
}
Program: 46623
Project: 46623
Buggy source:
/** 
 * Save the project info in project directory (in file project.xml)
 * @throws IOException if the project cannot be saved
 */
public void save() throws IOException {
  File f=File.createTempFile("String_Node_Str","String_Node_Str",dir);
  try {
    StreamResult streamResult=new StreamResult(f);
    SAXTransformerFactory tf=(SAXTransformerFactory)SAXTransformerFactory.newInstance();
    TransformerHandler hd=tf.newTransformerHandler();
    Transformer serializer=hd.getTransformer();
    serializer.setOutputProperty(OutputKeys.ENCODING,"String_Node_Str");
    serializer.setOutputProperty(OutputKeys.INDENT,"String_Node_Str");
    hd.setResult(streamResult);
    hd.startDocument();
    writeXml(hd);
    hd.endDocument();
  }
 catch (  Exception e) {
    throw new IOException("String_Node_Str" + e.getMessage(),e);
  }
  f.renameTo(new File(dir,"String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Save the project info in project directory (in file project.xml)
 * @throws IOException if the project cannot be saved
 */
public void save() throws IOException {
  File f=File.createTempFile("String_Node_Str","String_Node_Str",dir);
  try {
    StreamResult streamResult=new StreamResult(f);
    SAXTransformerFactory tf=(SAXTransformerFactory)SAXTransformerFactory.newInstance();
    TransformerHandler hd=tf.newTransformerHandler();
    Transformer serializer=hd.getTransformer();
    serializer.setOutputProperty(OutputKeys.ENCODING,"String_Node_Str");
    serializer.setOutputProperty(OutputKeys.INDENT,"String_Node_Str");
    hd.setResult(streamResult);
    hd.startDocument();
    writeXml(hd);
    hd.endDocument();
  }
 catch (  Exception e) {
    throw new IOException("String_Node_Str" + e.getMessage(),e);
  }
  if (!f.renameTo(new File(dir,"String_Node_Str"))) {
    log.warning("String_Node_Str");
  }
}
Program: 46624
Project: 46624
Buggy source:
/** 
 * Add a scan strip to the project, saving it to image file if it is not yet  saved.
 * @param strip
 */
public void addScanStrip(ScanStrip strip){
  if (strip.getName() == null) {
    File scanDir=new File(dir,"String_Node_Str");
    if (!scanDir.exists()) {
      scanDir.mkdir();
    }
    int num=getLastScanFile() + 1;
    String name=String.format("String_Node_Str",num);
    RenderedImage img=strip.stripImage;
    File imgFile=new File(scanDir,name + "String_Node_Str");
    saveImage(img,imgFile);
    saveStripInfo(strip,new File(scanDir,name + "String_Node_Str"));
    strip.setName(name);
    strip.setFile(imgFile);
  }
  loadedStrips.put(strip.getName(),strip);
  scene.addFrames(strip,0,strip.getFrameCount());
}

Fixed version (ground truth):
/** 
 * Add a scan strip to the project, saving it to image file if it is not yet  saved.
 * @param strip
 */
public void addScanStrip(ScanStrip strip){
  if (strip.getName() == null) {
    File scanDir=new File(dir,"String_Node_Str");
    if (!scanDir.exists()) {
      if (!scanDir.mkdir()) {
        log.severe("String_Node_Str");
        return;
      }
    }
    int num=getLastScanFile() + 1;
    String name=String.format("String_Node_Str",num);
    RenderedImage img=strip.stripImage;
    File imgFile=new File(scanDir,name + "String_Node_Str");
    saveImage(img,imgFile);
    saveStripInfo(strip,new File(scanDir,name + "String_Node_Str"));
    strip.setName(name);
    strip.setFile(imgFile);
  }
  loadedStrips.put(strip.getName(),strip);
  scene.addFrames(strip,0,strip.getFrameCount());
}
Program: 46625
Project: 46625
Buggy source:
/** 
 * Get project object for given directory. <p> If dir is an existing directory with valid project.xml file in it, laod the  project and return it. If there is no project in the directory, return a  new empty project.
 * @param dir Project directory
 * @return The project in directory or new project if no project exists there
 */
static public Project getProject(File dir){
  File projectFile=new File(dir,"String_Node_Str");
  Project ret=null;
  if (projectFile.exists()) {
    Digester d=new Digester();
    d.push("String_Node_Str",dir);
    d.addRuleSet(new ProjectRuleSet("String_Node_Str"));
    try {
      ret=(Project)d.parse(projectFile);
    }
 catch (    IOException e) {
      log.error("String_Node_Str" + projectFile.getPath() + "String_Node_Str"+ e.getMessage());
    }
catch (    SAXException e) {
      log.error("String_Node_Str" + projectFile.getPath() + "String_Node_Str"+ e.getMessage());
    }
  }
 else {
    try {
      dir.mkdirs();
      ret=new Project(dir);
      ret.save();
    }
 catch (    IOException ex) {
      return null;
    }
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Get project object for given directory. <p> If dir is an existing directory with valid project.xml file in it, laod the  project and return it. If there is no project in the directory, return a  new empty project.
 * @param dir Project directory
 * @return The project in directory or new project if no project exists there
 */
static public Project getProject(File dir){
  File projectFile=new File(dir,"String_Node_Str");
  Project ret=null;
  if (projectFile.exists()) {
    Digester d=new Digester();
    d.push("String_Node_Str",dir);
    d.addRuleSet(new ProjectRuleSet("String_Node_Str"));
    try {
      ret=(Project)d.parse(projectFile);
    }
 catch (    IOException e) {
      log.severe("String_Node_Str" + projectFile.getPath() + "String_Node_Str"+ e.getMessage());
    }
catch (    SAXException e) {
      log.severe("String_Node_Str" + projectFile.getPath() + "String_Node_Str"+ e.getMessage());
    }
  }
 else {
    try {
      if (!dir.mkdirs()) {
        log.warning("String_Node_Str");
        return null;
      }
      ret=new Project(dir);
      ret.save();
    }
 catch (    IOException ex) {
      return null;
    }
  }
  return ret;
}
Program: 46626
Project: 46626
Buggy source:
private void saveImage(RenderedImage img,File file){
  String ftype="String_Node_Str";
  String imageFname=file.getName();
  int extIndex=imageFname.lastIndexOf("String_Node_Str") + 1;
  if (extIndex > 0) {
    ftype=imageFname.substring(extIndex);
  }
  ImageWriter writer=null;
  Iterator iter=ImageIO.getImageWritersBySuffix(ftype);
  writer=(ImageWriter)iter.next();
  if (writer != null) {
    ImageOutputStream ios=null;
    try {
      ios=ImageIO.createImageOutputStream(file);
      writer.setOutput(ios);
      ImageWriteParam param=writer.getDefaultWriteParam();
      writer.write(null,new IIOImage(img,null,null),param);
      ios.flush();
    }
 catch (    IOException ex) {
      log.error("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str"+ ex.getMessage());
    }
 finally {
      if (ios != null) {
        try {
          ios.close();
        }
 catch (        IOException e) {
          log.error("String_Node_Str" + e.getMessage());
        }
      }
      writer.dispose();
    }
  }
}

Fixed version (ground truth):
private void saveImage(RenderedImage img,File file){
  String ftype="String_Node_Str";
  String imageFname=file.getName();
  int extIndex=imageFname.lastIndexOf("String_Node_Str") + 1;
  if (extIndex > 0) {
    ftype=imageFname.substring(extIndex);
  }
  ImageWriter writer=null;
  Iterator iter=ImageIO.getImageWritersBySuffix(ftype);
  writer=(ImageWriter)iter.next();
  if (writer != null) {
    ImageOutputStream ios=null;
    try {
      ios=ImageIO.createImageOutputStream(file);
      writer.setOutput(ios);
      ImageWriteParam param=writer.getDefaultWriteParam();
      writer.write(null,new IIOImage(img,null,null),param);
      ios.flush();
    }
 catch (    IOException ex) {
      log.severe("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str"+ ex.getMessage());
    }
 finally {
      if (ios != null) {
        try {
          ios.close();
        }
 catch (        IOException e) {
          log.severe("String_Node_Str" + e.getMessage());
        }
      }
      writer.dispose();
    }
  }
}
Program: 46627
Project: 46627
Buggy source:
/** 
 * Get the nth frame of the scan
 * @param n frame to get
 * @return RemderedImage based on the sanned strip, rotated and cropped according to frame dimesions. 
 */
public RenderedImage getFrame(int n){
  if (perforations == null) {
    findPerforations();
  }
  AffineTransform xform=getFrameXform(n);
  RenderedOp rotated=AffineDescriptor.create(stripImage,xform,Interpolation.getInstance(Interpolation.INTERP_BICUBIC),null,null);
  int minx=rotated.getMinX();
  int miny=rotated.getMinY();
  int rw=rotated.getWidth();
  int rh=rotated.getHeight();
  ImageLayout layout=new ImageLayout();
  layout.setColorModel(stripImage.getColorModel());
  RenderingHints hints=new RenderingHints(JAI.KEY_IMAGE_LAYOUT,layout);
  RenderedOp background=ConstantDescriptor.create((float)FRAME_WIDTH,(float)FRAME_HEIGHT,new Short[]{0,0,0},null);
  RenderedOp frame=OverlayDescriptor.create(background,rotated,hints);
  return frame;
}

Fixed version (ground truth):
/** 
 * Get the nth frame of the scan
 * @param n frame to get
 * @return RemderedImage based on the sanned strip, rotated and cropped according to frame dimesions. 
 */
public RenderedImage getFrame(int n){
  if (perforations == null) {
    findPerforations();
  }
  AffineTransform xform=getFrameXform(n);
  RenderedOp rotated=AffineDescriptor.create(stripImage,xform,Interpolation.getInstance(Interpolation.INTERP_BICUBIC),null,null);
  ImageLayout layout=new ImageLayout();
  layout.setColorModel(stripImage.getColorModel());
  RenderingHints hints=new RenderingHints(JAI.KEY_IMAGE_LAYOUT,layout);
  RenderedOp background=ConstantDescriptor.create((float)FRAME_WIDTH,(float)FRAME_HEIGHT,new Short[]{0,0,0},null);
  RenderedOp frame=OverlayDescriptor.create(background,rotated,hints);
  return frame;
}
Program: 46629
Project: 46629
Buggy source:
/** 
 * Add frames from a scann to end of this scene
 * @param strip The scan strip
 * @param firstFrame First frame to add
 * @param frameCount Nubmer of frames to add
 */
public void addFrames(ScanStrip strip,int firstFrame,int frameCount){
  FrameRange lastRange=getLastRange();
  FrameRange newRange=new FrameRange(strip,firstFrame,getFrameCount(),frameCount);
  frames.add(newRange);
  newRange.addFrameRangeChangeListener(this);
}

Fixed version (ground truth):
/** 
 * Add frames from a scann to end of this scene
 * @param strip The scan strip
 * @param firstFrame First frame to add
 * @param frameCount Nubmer of frames to add
 */
public void addFrames(ScanStrip strip,int firstFrame,int frameCount){
  FrameRange newRange=new FrameRange(strip,firstFrame,getFrameCount(),frameCount);
  frames.add(newRange);
  newRange.addFrameRangeChangeListener(this);
}
Program: 46631
Project: 46631
Buggy source:
private void saveDebugImage(RenderedImage src,String desc,int x,int y,int w,int h){
  AffineTransform xform=AffineTransform.getTranslateInstance(0,-y);
  RenderedOp perfTrans=AffineDescriptor.create(maskImage,xform,null,null,null);
  RenderedOp perfImage=CropDescriptor.create(perfTrans,0.0f,0.0f,(float)w,(float)h,null);
  String fname=String.format("String_Node_Str",desc,y);
  try {
    ImageIO.write(perfImage,"String_Node_Str",new File(fname));
  }
 catch (  IOException e) {
    System.err.println("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
private void saveDebugImage(RenderedImage src,String desc,int x,int y,int w,int h){
  AffineTransform xform=AffineTransform.getTranslateInstance(0,-y);
  RenderedOp perfTrans=AffineDescriptor.create(maskImage,xform,null,null,null);
  RenderedOp perfImage=CropDescriptor.create(perfTrans,0.0f,0.0f,(float)w,(float)h,null);
  File f=getDebugImageFile(String.format("String_Node_Str",desc,y));
  try {
    ImageIO.write(perfImage,"String_Node_Str",f);
  }
 catch (  IOException e) {
    System.err.println("String_Node_Str" + e.getMessage());
  }
}
Program: 46632
Project: 46632
Buggy source:
/** 
 * @param args the command line arguments
 */
public static void main(String[] args){
  log.setLevel(Level.FINE);
  JAI.setDefaultTileSize(new Dimension(64,64));
  JAI.getDefaultInstance().setTileCache(new SunTileCache(100 * 1024 * 1024));
  SplitScan t=new SplitScan();
  long startTime=System.currentTimeMillis();
  System.out.println("String_Node_Str" + args[0]);
  RenderedImage img=t.readImage(args[0]);
  System.out.println("String_Node_Str" + args[1] + "String_Node_Str");
  RenderedImage maskImg=t.readImage(args[1]);
  System.out.println("String_Node_Str" + img.getWidth() + "String_Node_Str"+ img.getHeight());
  System.out.println("String_Node_Str" + maskImg.getWidth() + "String_Node_Str"+ maskImg.getHeight());
  System.out.println("String_Node_Str");
  if (img.getWidth() > img.getHeight()) {
    System.out.println("String_Node_Str");
    img=t.getRotatedImage(img);
    maskImg=t.getRotatedImage(maskImg);
  }
  RenderedImage binaryImg=t.findPerforationEdges(maskImg);
  t.scanImage=img;
  t.findPerfHolePoints(binaryImg);
  long analysisTime=System.currentTimeMillis() - startTime;
  System.out.println("String_Node_Str" + ((double)analysisTime) / 1000.0);
  t.fnameTmpl="String_Node_Str";
  if (args.length > 1) {
    t.fnameTmpl=args[2];
  }
  t.saveFrames(img,t.fnameTmpl);
  long saveTime=System.currentTimeMillis() - analysisTime - startTime;
  System.out.println("String_Node_Str" + ((double)saveTime) / 1000.0);
}

Fixed version (ground truth):
/** 
 * @param args the command line arguments
 */
public static void main(String[] args){
  parseArgs(args);
  log.setLevel(Level.FINE);
  JAI.setDefaultTileSize(new Dimension(64,64));
  JAI.getDefaultInstance().setTileCache(new SunTileCache(100 * 1024 * 1024));
  SplitScan t=new SplitScan();
  long startTime=System.currentTimeMillis();
  System.out.println("String_Node_Str" + fname);
  RenderedImage img=t.readImage(fname);
  System.out.println("String_Node_Str" + img.getWidth() + "String_Node_Str"+ img.getHeight());
  RenderedImage maskImg=img;
  if (maskName != null) {
    System.out.println("String_Node_Str" + maskName + "String_Node_Str");
    maskImg=t.readImage(maskName);
    System.out.println("String_Node_Str" + maskImg.getWidth() + "String_Node_Str"+ maskImg.getHeight());
  }
  System.out.println("String_Node_Str");
  if (img.getWidth() > img.getHeight()) {
    System.out.println("String_Node_Str");
    img=t.getRotatedImage(img);
    maskImg=t.getRotatedImage(maskImg);
  }
  RenderedImage binaryImg=t.findPerforationEdges(maskImg);
  t.scanImage=img;
  t.findPerfHolePoints(binaryImg);
  long analysisTime=System.currentTimeMillis() - startTime;
  System.out.println("String_Node_Str" + ((double)analysisTime) / 1000.0);
  t.fnameTmpl=outTmpl;
  t.saveFrames(img,outTmpl);
  long saveTime=System.currentTimeMillis() - analysisTime - startTime;
  System.out.println("String_Node_Str" + ((double)saveTime) / 1000.0);
}
Program: 46634
Project: 46634
Buggy source:
private int median(int[] arr){
  int[] copy=Arrays.copyOf(arr,arr.length);
  Arrays.sort(arr);
  return arr[arr.length >> 1];
}

Fixed version (ground truth):
private int median(int[] arr){
  int[] copy=Arrays.copyOf(arr,arr.length);
  Arrays.sort(copy);
  return copy[copy.length >> 1];
}
Program: 46635
Project: 46635
Buggy source:
private int getFrameLeft(int starty,int endy){
  ArrayList<Integer> perfBorderPoints=new ArrayList<Integer>(400);
  System.err.println(String.format("String_Node_Str",starty,endy));
  for (int n=starty; n < endy; n++) {
    if (perfBorderX[n] > 0) {
      perfBorderPoints.add(perfBorderX[n]);
    }
  }
  Collections.sort(perfBorderPoints);
  return perfBorderPoints.size() > 0 ? perfBorderPoints.get(perfBorderPoints.size() >> 1) : 0;
}

Fixed version (ground truth):
private int getFrameLeft(int starty,int endy){
  ArrayList<Integer> perfBorderPoints=new ArrayList<Integer>(400);
  for (int n=starty; n < endy; n++) {
    if (perfBorderX[n] > 0) {
      perfBorderPoints.add(perfBorderX[n]);
    }
  }
  Collections.sort(perfBorderPoints);
  return perfBorderPoints.size() > 0 ? perfBorderPoints.get(perfBorderPoints.size() >> 1) : 0;
}
Program: 46636
Project: 46636
Buggy source:
AffineTransform getFrameXform(int frame){
  int f1=Math.max(0,frame - 1);
  int f2=Math.min(perfY.size() - 1,frame + 1);
  int x1=perfX.get(f1);
  int x2=perfX.get(f2);
  int y1=perfY.get(f1);
  int y2=perfY.get(f2);
  double rot=Math.atan2((double)x2 - x1,(double)(y2 - y1));
  AffineTransform xform=AffineTransform.getTranslateInstance(-perfX.get(frame),-perfY.get(frame));
  xform.preConcatenate(AffineTransform.getRotateInstance(rot));
  xform.preConcatenate(AffineTransform.getTranslateInstance(0,frameHeight / 2));
  return xform;
}

Fixed version (ground truth):
AffineTransform getFrameXform(int frame){
  int f1=frame - 1;
  int f2=frame + 1;
  int x1=(f1 >= 0) ? perfX.get(f1) : perfX.get(0);
  int x2=(f2 < perfX.size()) ? perfX.get(f2) : perfX.get(perfX.size() - 1);
  int y1=(f1 >= 0) ? perfY.get(f1) : perfX.get(0);
  int y2=(f2 < perfX.size()) ? perfY.get(f2) : perfY.get(perfY.size() - 1);
  double rot=Math.atan2((double)x2 - x1,(double)(y2 - y1));
  AffineTransform xform=AffineTransform.getTranslateInstance(-perfX.get(frame),-perfY.get(frame));
  xform.preConcatenate(AffineTransform.getRotateInstance(rot));
  xform.preConcatenate(AffineTransform.getTranslateInstance(0,frameHeight / 2));
  return xform;
}
Program: 46637
Project: 46637
Buggy source:
public Fencing(){
  super();
  registerCommand('E',new ErrorCommand());
  registerCommand('W',new WaitCommand());
  registerCommand('T',new RecieveChallengeCommand());
  registerCommand('c',new RejectedCommand());
  registerCommand('C',new WithdrawnCommand());
  registerCommand('K',new KillCommand());
  registerCommand('b',new NewGameCommand(Game.COLOR_BLACK));
  registerCommand('w',new NewGameCommand(Game.COLOR_WHITE));
  registerCommand('h',new SetHandCommand());
  singleton=this;
}

Fixed version (ground truth):
public Fencing(){
  super();
  registerCommand('E',new ErrorCommand());
  registerCommand('W',new WaitCommand());
  registerCommand('T',new RecieveChallengeCommand());
  registerCommand('c',new RejectedCommand());
  registerCommand('C',new WithdrawnCommand());
  registerCommand('K',new KillCommand());
  registerCommand('b',new NewGameCommand(Game.COLOR_BLACK));
  registerCommand('w',new NewGameCommand(Game.COLOR_WHITE));
  registerCommand('h',new SetHandCommand());
  registerCommand('x',new PositionCommand());
  singleton=this;
}
Program: 46638
Project: 46638
Buggy source:
@Override public void execute(String in){
  stripView.setHand(in);
}

Fixed version (ground truth):
@Override public void execute(String in){
  stripView.setPositions(in);
}
Program: 46639
Project: 46639
Buggy source:
public StripView(Context context,AttributeSet attr){
  super(context,attr);
}

Fixed version (ground truth):
public StripView(Context context,AttributeSet attr){
  super(context,attr);
  init();
}
Program: 46640
Project: 46640
Buggy source:
private void resetModel(){
  model=Fencing.stripModel;
}

Fixed version (ground truth):
private void resetModel(){
  model=Fencing.stripModel;
  model.getGame().addListener(this);
}
Program: 46642
Project: 46642
Buggy source:
/** 
 * Saves the current data [Currently only saves gods]
 */
private void save(){
  try {
    log.info("String_Node_Str");
    if (!getDataFolder().exists()) {
      getDataFolder().mkdirs();
      log.info("String_Node_Str");
    }
    if (!new File(dataFile).exists()) {
      new File(dataFile).createNewFile();
      log.info("String_Node_Str");
    }
 else {
      log.info("String_Node_Str");
      InputStream is=new FileInputStream(dataFile);
      BufferedReader br=new BufferedReader(new InputStreamReader(is));
      FileWriter fw=new FileWriter(dataFile);
      PrintWriter pw=new PrintWriter(fw);
      String strLine;
      while ((strLine=br.readLine()) != null) {
        if (gods.contains(getServer().getPlayer(strLine))) {
          gods.remove(getServer().getPlayer(strLine));
        }
        if (godsRemoved.contains(strLine)) {
          pw.println((String)null);
        }
      }
      fw.close();
      is.close();
    }
    log.info("String_Node_Str");
    FileWriter fw=new FileWriter(dataFile);
    PrintWriter pw=new PrintWriter(fw);
    for (int i=0; i < gods.size(); i++) {
      if (gods.get(i) != null) {
        log.info("String_Node_Str" + gods.get(i).getDisplayName());
        pw.println(gods.get(i).getDisplayName());
      }
    }
    fw.close();
    log.info("String_Node_Str");
  }
 catch (  Exception e) {
    e.printStackTrace();
    log.severe("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Saves the current data [Currently only saves gods]
 */
private void save(){
  try {
    log.info("String_Node_Str");
    if (!getDataFolder().exists()) {
      getDataFolder().mkdirs();
      log.info("String_Node_Str");
    }
    if (!new File(dataFile).exists()) {
      new File(dataFile).createNewFile();
      log.info("String_Node_Str");
    }
 else {
      log.info("String_Node_Str");
      InputStream is=new FileInputStream(dataFile);
      BufferedReader br=new BufferedReader(new InputStreamReader(is));
      String strLine;
      while ((strLine=br.readLine()) != null) {
        if (!gods.contains(getServer().getPlayer(strLine)) && !godsRemoved.contains(getServer().getPlayer(strLine))) {
          gods.add(getServer().getPlayer(strLine));
        }
      }
      is.close();
    }
    log.info("String_Node_Str");
    FileWriter fw=new FileWriter(dataFile);
    PrintWriter pw=new PrintWriter(fw);
    for (int i=0; i < gods.size(); i++) {
      if (gods.get(i) != null) {
        log.info("String_Node_Str" + gods.get(i).getDisplayName());
        pw.println(gods.get(i).getDisplayName());
      }
    }
    fw.close();
    log.info("String_Node_Str");
  }
 catch (  Exception e) {
    e.printStackTrace();
    log.severe("String_Node_Str");
  }
}
Program: 46643
Project: 46643
Buggy source:
private void checkUpdate(){
  try {
    URL pluginInfo=new URL("String_Node_Str");
    BufferedReader in=new BufferedReader(new InputStreamReader(pluginInfo.openStream()));
    String strLine;
    while ((strLine=in.readLine()) != null) {
      if (strLine.contains("String_Node_Str")) {
        String[] tokens=strLine.split("String_Node_Str");
        String version=tokens[1];
        if (isDouble(version) && isDouble(pdfFile.getVersion())) {
          if (Double.parseDouble(version) > Double.parseDouble(pdfFile.getVersion())) {
            if (JOptionPane.showConfirmDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
              getServer().dispatchCommand(new ConsoleCommandSender(getServer()),"String_Node_Str");
            }
          }
 else {
            JOptionPane.showMessageDialog(null,"String_Node_Str");
          }
        }
 else {
          log.severe("String_Node_Str");
        }
      }
    }
  }
 catch (  MalformedURLException e) {
    log.severe("String_Node_Str");
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * WIP Auto-Update method Will check if you need to update version
 */
private void checkUpdate(){
  try {
    pluginInfo=new URL("String_Node_Str");
    BufferedReader in=new BufferedReader(new InputStreamReader(pluginInfo.openStream()));
    String strLine;
    while ((strLine=in.readLine()) != null) {
      if (strLine.contains("String_Node_Str")) {
        String[] tokens=strLine.split("String_Node_Str");
        String version=tokens[1];
        if (isDouble(version) && isDouble(pdfFile.getVersion())) {
          if (Double.parseDouble(version) > Double.parseDouble(pdfFile.getVersion())) {
            if (JOptionPane.showConfirmDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
              getServer().dispatchCommand(new ConsoleCommandSender(getServer()),"String_Node_Str");
            }
 else {
              log.warning("String_Node_Str");
            }
          }
 else {
            JOptionPane.showMessageDialog(null,"String_Node_Str");
          }
        }
 else {
          log.severe("String_Node_Str");
        }
      }
    }
  }
 catch (  MalformedURLException e) {
    log.severe("String_Node_Str");
  }
catch (  IOException e) {
    log.severe("String_Node_Str");
  }
}
Program: 46644
Project: 46644
Buggy source:
private boolean isDouble(String text){
  try {
    Double.parseDouble(text);
  }
 catch (  NumberFormatException e) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks for a double in the text
 * @param text String to check
 * @return true is the text contains a double, otherwise false
 */
private boolean isDouble(String text){
  try {
    Double.parseDouble(text);
  }
 catch (  NumberFormatException e) {
    return false;
  }
  return true;
}
Program: 46646
Project: 46646
Buggy source:
public static void replaceBlock(){
}

Fixed version (ground truth):
public static void replaceBlock(){
  Block block=replacedBlocks.get(0);
  replacedBlocks.remove(0);
  replacedBlocksMaterial.remove(0);
  if (!replacedBlocks.contains(block)) {
    replacedBlocks.get(0).setType(replacedBlocksMaterial.get(0));
  }
}
Program: 46647
Project: 46647
Buggy source:
public void onPlayerInteract(PlayerInteractEvent event){
  Player player=event.getPlayer();
  if ((event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) && player.getItemInHand().getType() == Material.WOOL) {
    Block targetBlock=player.getTargetBlock(null,1000);
    if (targetBlock.getType() != Material.AIR) {
      if (!replacedBlocks.contains(targetBlock)) {
        replacedBlocks.add(targetBlock);
        replacedBlocksMaterial.add(targetBlock.getType());
        targetBlock.setType(Material.WOOL.setData(14));
        plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin,new Runnable(){
          public void run(){
            replaceBlock();
          }
        }
,20L);
      }
 else {
        replacedBlocks.add(replacedBlocks.get(replacedBlocks.indexOf(targetBlock)));
        replacedBlocksMaterial.add(replacedBlocks.get(replacedBlocks.indexOf(targetBlock)).getType());
        targetBlock.setType((Material.WOOL).setData(14));
        plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin,new Runnable(){
          public void run(){
            replaceBlock();
          }
        }
,20L);
      }
    }
  }
}

Fixed version (ground truth):
public void onPlayerInteract(PlayerInteractEvent event){
  Player player=event.getPlayer();
  if ((event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) && player.getItemInHand().getType() == Material.WOOL) {
    Block targetBlock=player.getTargetBlock(null,1000);
    if (targetBlock.getType() != Material.AIR) {
      if (!replacedBlocks.contains(targetBlock)) {
        replacedBlocks.add(targetBlock);
        replacedBlocksMaterial.add(targetBlock.getType());
        targetBlock.setType(Wool.setData((byte)14));
        plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin,new Runnable(){
          public void run(){
            replaceBlock();
          }
        }
,20L);
      }
 else {
        replacedBlocks.add(replacedBlocks.get(replacedBlocks.indexOf(targetBlock)));
        replacedBlocksMaterial.add(replacedBlocks.get(replacedBlocks.indexOf(targetBlock)).getType());
        targetBlock.setType(Wool.setData((byte)14));
        plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin,new Runnable(){
          public void run(){
            replaceBlock();
          }
        }
,20L);
      }
    }
  }
}
Program: 46649
Project: 46649
Buggy source:
@Before public void init() throws ConnectionException, ConfigurationLoadingFailedException {
  Config config=new Config();
  final Properties prop=ConfigurationUtils.getAutomationCredentialsProperties();
  username=prop.getProperty("String_Node_Str");
  password=prop.getProperty("String_Node_Str");
  endpoint=prop.getProperty("String_Node_Str");
  config.connect(username,password,endpoint);
  connector.setConfig(config);
}

Fixed version (ground truth):
@Before public void init() throws ConnectionException, ConfigurationLoadingFailedException {
  final Properties prop=ConfigurationUtils.getAutomationCredentialsProperties();
  username=prop.getProperty("String_Node_Str");
  password=prop.getProperty("String_Node_Str");
  endpoint=prop.getProperty("String_Node_Str");
  Config config=new Config();
  config.connect(username,password,endpoint);
  connector.setConfig(config);
}
Program: 46650
Project: 46650
Buggy source:
public synchronized JiraClient<List<Object>> getClient(){
  if (client == null) {
    client=JiraClientFactory.getClient(address);
  }
  return client;
}

Fixed version (ground truth):
public synchronized JiraClient<List<Object>> getClient(){
  if (client == null) {
    setClient(JiraClientFactory.getClient(address));
  }
  return client;
}
Program: 46651
Project: 46651
Buggy source:
protected RemoteCustomFieldValue[] getRemoteCustomFieldValues(Map<String,List<String>> customFields){
  if (customFields == null) {
    return EMPTY_REMOTE_CUSTOM_FIELDS;
  }
  RemoteCustomFieldValue[] result=new RemoteCustomFieldValue[customFields.size()];
  int i=0;
  for (  Entry<String,List<String>> entry : customFields.entrySet()) {
    String customeFieldId=entry.getKey();
    List<String> fieldValues=entry.getValue();
    result[i++]=new RemoteCustomFieldValue(customeFieldId,EMPTY_PARENT_KEY,(String[])fieldValues.toArray());
  }
  return result;
}

Fixed version (ground truth):
protected RemoteCustomFieldValue[] getRemoteCustomFieldValues(Map<String,List<String>> customFields){
  if (customFields == null) {
    return EMPTY_REMOTE_CUSTOM_FIELDS;
  }
  RemoteCustomFieldValue[] result=new RemoteCustomFieldValue[customFields.size()];
  int i=0;
  for (  Entry<String,List<String>> entry : customFields.entrySet()) {
    String customeFieldId=entry.getKey();
    List<String> fieldValues=entry.getValue();
    if (fieldValues != null) {
      result[i++]=new RemoteCustomFieldValue(customeFieldId,EMPTY_PARENT_KEY,(String[])fieldValues.toArray());
    }
 else {
      result[i++]=new RemoteCustomFieldValue(customeFieldId,EMPTY_PARENT_KEY,new String[0]);
    }
  }
  return result;
}
Program: 46652
Project: 46652
Buggy source:
protected RemoteFieldValue[] createRemoteFieldValues(Map<String,List<String>> fields){
  if (fields == null) {
    return EMPTY_FIELDS;
  }
  RemoteFieldValue[] result=new RemoteFieldValue[fields.size()];
  int i=0;
  for (  Entry<String,List<String>> entry : fields.entrySet()) {
    String customeFieldId=entry.getKey();
    List<String> fieldValues=entry.getValue();
    result[i++]=new RemoteFieldValue(customeFieldId,(String[])fieldValues.toArray());
  }
  return result;
}

Fixed version (ground truth):
protected RemoteFieldValue[] createRemoteFieldValues(Map<String,List<String>> fields){
  if (fields == null) {
    return EMPTY_FIELDS;
  }
  RemoteFieldValue[] result=new RemoteFieldValue[fields.size()];
  int i=0;
  for (  Entry<String,List<String>> entry : fields.entrySet()) {
    String customeFieldId=entry.getKey();
    List<String> fieldValues=entry.getValue();
    if (fieldValues != null) {
      result[i++]=new RemoteFieldValue(customeFieldId,(String[])fieldValues.toArray());
    }
 else {
      result[i++]=new RemoteFieldValue(customeFieldId,new String[0]);
    }
  }
  return result;
}
Program: 46653
Project: 46653
Buggy source:
public ServiceProviders(List<ApplicationCredentials> credentials,Iterable<C> configurations){
  this.credentials=credentials;
  this.configurations=configurations;
}

Fixed version (ground truth):
public ServiceProviders(List<ApplicationCredentials> credentials,Iterable<C> configurations){
  this.credentials=credentials;
  this.configurations=ImmutableList.copyOf(configurations);
}
Program: 46654
Project: 46654
Buggy source:
protected List<X> mapProviders(){
  Builder<X> builder=ImmutableList.<X>builder();
  for (  ApplicationCredentials crd : credentials) {
    C configuration=Iterables.find(configurations,crd.getProviderId());
    builder.add(createProvider(crd,configuration));
  }
  return builder.build();
}

Fixed version (ground truth):
protected List<X> mapProviders(){
  Builder<X> builder=ImmutableList.<X>builder();
  List<C> configurationsList=ImmutableList.copyOf(configurations);
  for (  ApplicationCredentials crd : credentials) {
    C configuration=Iterables.find(configurationsList,crd.getProviderId());
    builder.add(createProvider(crd,configuration));
  }
  return builder.build();
}
Program: 46655
Project: 46655
Buggy source:
@Inject public LoginServiceProviders(@Login List<ApplicationCredentials> credentials,@Login Instance<ProviderConfiguration<OAuthSession>> configurations){
  super(credentials,configurations);
}

Fixed version (ground truth):
@Inject public LoginServiceProviders(@Login List<ApplicationCredentials> credentials,@Login Instance<LoginProviderConfiguration> configurations){
  super(credentials,configurations);
}
Program: 46656
Project: 46656
Buggy source:
@Override protected ServiceProvider<OAuthSession> createProvider(ApplicationCredentials crd,ProviderConfiguration<OAuthSession> configuration){
  return new ServiceProvider<OAuthSession>(crd,configuration);
}

Fixed version (ground truth):
@Override protected ServiceProvider<OAuthSession> createProvider(ApplicationCredentials crd,LoginProviderConfiguration configuration){
  return new ServiceProvider<OAuthSession>(crd,configuration);
}
Program: 46657
Project: 46657
Buggy source:
@Override public Api getApi(){
  return FacebookRegisterConfiguration.REAUTHENTICATE_API;
}

Fixed version (ground truth):
@Override public Api getApi(){
  return FacebookUserProfileConfiguration.REAUTHENTICATE_API;
}
Program: 46658
Project: 46658
Buggy source:
@Override public OAuthSession createSession(OAuthService service,ApplicationCredentials appCredentials,Token accessToken){
  return new FacebookRegisterSession(defaultExecutor,service,accessToken);
}

Fixed version (ground truth):
@Override public OAuthSession createSession(OAuthService service,ApplicationCredentials appCredentials,Token accessToken){
  return new FacebookUserProfileSession(defaultExecutor,service,accessToken);
}
Program: 46659
Project: 46659
Buggy source:
@Override public OAuthSession createSession(OAuthService service,ApplicationCredentials appCredentials,Token accessToken){
  return new TwitterRegisterSession(defaultExecutor,service,accessToken);
}

Fixed version (ground truth):
@Override public OAuthSession createSession(OAuthService service,ApplicationCredentials appCredentials,Token accessToken){
  return new TwitterUserProfileSession(defaultExecutor,service,accessToken);
}
Program: 46660
Project: 46660
Buggy source:
private Document getDocument(InputStream documentAsStream) throws Exception {
  DocumentBuilder documentBuilder=DocumentBuilderFactory.newInstance().newDocumentBuilder();
  return documentBuilder.parse(documentAsStream);
}

Fixed version (ground truth):
private Document getDocument(InputStream documentAsStream) throws Exception {
  BufferedReader bis=new BufferedReader(new InputStreamReader((documentAsStream)));
  bis.readLine();
  String line="String_Node_Str";
  StringBuffer sb=new StringBuffer();
  while (line != null) {
    if (!"String_Node_Str".equals(line.trim())) {
      sb.append(line);
    }
    line=bis.readLine();
  }
  DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
  factory.setIgnoringComments(true);
  factory.setValidating(false);
  DocumentBuilder documentBuilder=factory.newDocumentBuilder();
  InputSource is=new InputSource();
  is.setCharacterStream(new StringReader(sb.toString()));
  return documentBuilder.parse(is);
}
Program: 46662
Project: 46662
Buggy source:
@Override public void initialize(){
  LCD.drawString("String_Node_Str",0,0);
  pilot.setTravelSpeed(FAST);
  pilot.setRotateSpeed(8 * rotateSpeed * Math.PI* WHEEL_BASE / 180.0f);
  pilot.setAcceleration(MIN_ACCELERATION);
  stopwatch.reset();
  registerStopButtonInterrupt();
  Timer matchTimer=initMatchTimer();
  footUp();
  while (light.getColorID() == Color.BLACK) {
    competition=true;
  }
  matchTimer.start();
  lejos.util.Delay.msDelay(300);
}

Fixed version (ground truth):
@Override public void initialize(){
  LCD.drawString("String_Node_Str",0,0);
  pilot.setTravelSpeed(FAST);
  pilot.setRotateSpeed(FAST / (WHEEL_BASE * Math.PI) * 360.0f);
  pilot.setAcceleration(MIN_ACCELERATION);
  stopwatch.reset();
  registerStopButtonInterrupt();
  Timer matchTimer=initMatchTimer();
  footUp();
  while (light.getColorID() == Color.BLACK) {
    competition=true;
  }
  matchTimer.start();
  lejos.util.Delay.msDelay(300);
}
Program: 46663
Project: 46663
Buggy source:
public void waitForPawn(){
  while (pilot.isMoving() || obstacle) {
    if (pawnButton.isPressed())     stop();
  }
}

Fixed version (ground truth):
public void waitForPawn(){
  while (pilot.isMoving() || obstacle) {
    if (pawnButton.isPressed()) {
      stop();
      lejos.nxt.Sound.playSample(new File("String_Node_Str"));
    }
  }
}
Program: 46664
Project: 46664
Buggy source:
public void travel(double distance,boolean immret,int accel){
  currentGoal=distance;
  pilot.setAcceleration(accel);
  pilot.travel(distance,immret);
}

Fixed version (ground truth):
public void travel(double distance,boolean immret,int accel){
  currentGoal=distance;
  pilot.setAcceleration(accel);
  pilot.travel(distance,true);
  if (!immret) {
    while (pilot.isMoving() || obstacle) {
    }
  }
}
Program: 46666
Project: 46666
Buggy source:
@Override public void initialize(){
  pilot.setTravelSpeed(speed);
  pilot.setRotateSpeed(speed * Math.PI * WHEEL_BASE / 180.0f);
  registerStopButtonInterrupt();
  Timer matchTimer=initMatchTimer();
  startSonicAvoidanceThread();
  footUp();
  while (light.getColorID() == Color.BLACK) {
    competition=true;
  }
  matchTimer.start();
  lejos.util.Delay.msDelay(300);
}

Fixed version (ground truth):
@Override public void initialize(){
  pilot.setTravelSpeed(speed);
  pilot.setRotateSpeed(speed / (WHEEL_BASE * Math.PI) * 360.0f);
  registerStopButtonInterrupt();
  Timer matchTimer=initMatchTimer();
  startSonicAvoidanceThread();
  footUp();
  while (light.getColorID() == Color.BLACK) {
    competition=true;
  }
  matchTimer.start();
  lejos.util.Delay.msDelay(300);
}
Program: 46667
Project: 46667
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  ImageView iv=new ImageView(this);
  iv.setImageResource(R.drawable.nyala);
  iv.setAdjustViewBounds(true);
  iv.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
  final WifiManager wm=(WifiManager)getSystemService(Context.WIFI_SERVICE);
  IntentFilter wifilter=new IntentFilter();
  wifilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
  wsr=new WifiStatusReceiver();
  registerReceiver(wsr,wifilter);
  if (!(wm.isWifiEnabled())) {
    AlertDialog.Builder ad=new AlertDialog.Builder(this);
    ad.setMessage("String_Node_Str").setCancelable(false).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int id){
        Toast.makeText(Nyala.this,"String_Node_Str",Toast.LENGTH_SHORT).show();
        wm.setWifiEnabled(true);
      }
    }
).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int id){
        dialog.cancel();
        finish();
      }
    }
);
    AlertDialog WiFi_AD=ad.create();
    WiFi_AD.show();
  }
 else {
    ConnectivityManager cm=(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo ni=cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
    if (ni.isConnected()) {
      String apname=new String(wm.getConnectionInfo().getSSID());
      Toast.makeText(Nyala.this,"String_Node_Str" + apname + "String_Node_Str",Toast.LENGTH_LONG).show();
    }
  }
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  ImageView iv=new ImageView(this);
  iv.setImageResource(R.drawable.nyala);
  iv.setAdjustViewBounds(true);
  iv.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
  final WifiManager wm=(WifiManager)getSystemService(Context.WIFI_SERVICE);
  IntentFilter wifilter=new IntentFilter();
  wifilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
  wsr=new WifiStatusReceiver();
  registerReceiver(wsr,wifilter);
}
Program: 46670
Project: 46670
Buggy source:
@Override public void onResume(){
  super.onResume();
  connectActionPrefs=getSharedPreferences(prefStr,MODE_PRIVATE);
  connectAction=connectActionPrefs.getInt("String_Node_Str",connectAction);
  scanAction=connectActionPrefs.getInt("String_Node_Str",scanAction);
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  connectActionPrefs=getSharedPreferences(prefStr,MODE_PRIVATE);
  connectAction=connectActionPrefs.getInt("String_Node_Str",connectAction);
  scanAction=connectActionPrefs.getInt("String_Node_Str",scanAction);
  checkWiFiStatus();
}
Program: 46671
Project: 46671
Buggy source:
@Override public void onStart(){
  super.onStart();
  connectActionPrefs=getSharedPreferences(prefStr,MODE_PRIVATE);
  connectAction=connectActionPrefs.getInt("String_Node_Str",0);
  scanAction=connectActionPrefs.getInt("String_Node_Str",0);
}

Fixed version (ground truth):
@Override public void onStart(){
  super.onStart();
  int wiStatus=0;
  connectActionPrefs=getSharedPreferences(prefStr,MODE_PRIVATE);
  connectAction=connectActionPrefs.getInt("String_Node_Str",0);
  scanAction=connectActionPrefs.getInt("String_Node_Str",0);
}
Program: 46672
Project: 46672
Buggy source:
/** 
 * HTTP リクエストの Authorization ヘッダとして送信すべき文字列を返す. 形式は以下のようなものである. <pre>  OAuth realm="...", oauth_timestamp="...", oauth_verifier="...", ...</pre>
 * @param realmStr realm として含める文字列
 * @return HTTP リクエストの Authorization ヘッダとして送信すべき文字列
 */
public String getAuthorizationHeaderString(String realmStr){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str" + realmStr + "String_Node_Str");
  for (  Param p : mOauthParams) {
    sb.append("String_Node_Str");
    sb.append(OAuthEncoder.encode(p.getKey()) + "String_Node_Str");
    sb.append(OAuthEncoder.encode(p.getValue()) + "String_Node_Str");
  }
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * HTTP リクエストの Authorization ヘッダとして送信すべき文字列を返す. 形式は以下のようなものである. <pre>  OAuth realm="...", oauth_timestamp="...", oauth_verifier="...", ...</pre>
 * @param realmStr realm として含める文字列
 * @return HTTP リクエストの Authorization ヘッダとして送信すべき文字列
 */
public String getAuthorizationHeaderString(String realmStr){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str" + realmStr + "String_Node_Str");
  for (  Param p : mOauthParams) {
    sb.append("String_Node_Str");
    sb.append(OAuthEncoder.encode(p.getKey()) + "String_Node_Str");
    sb.append(OAuthEncoder.encode(p.getValue()) + "String_Node_Str");
  }
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(OAuthEncoder.encode(mSignature)).append('"');
  return sb.toString();
}
Program: 46673
Project: 46673
Buggy source:
private String createParameterNormalizationString(){
  ParamList paramList=new ParamList();
  if (mOauthParams != null)   paramList.addAll(mOauthParams);
  if (mUrlQueryParams != null)   paramList.addAll(mUrlQueryParams);
  if (mReqBodyParams != null)   paramList.addAll(mReqBodyParams);
  Param[] params=paramList.toArray(new Param[paramList.size()]);
  Arrays.sort(params,ParamComparator.getInstance());
  String ns=toNormalizationString(params);
  return ns;
}

Fixed version (ground truth):
String createParameterNormalizationString(){
  ParamList paramList=new ParamList();
  if (mOauthParams != null)   addEncodedKeyValuePairsToParamList(mOauthParams,paramList);
  if (mUrlQueryParams != null)   addEncodedKeyValuePairsToParamList(mUrlQueryParams,paramList);
  if (mReqBodyParams != null)   addEncodedKeyValuePairsToParamList(mReqBodyParams,paramList);
  paramList.sort(ParamComparator.getInstance());
  StringBuilder sb=new StringBuilder();
  for (  Param param : paramList) {
    if (sb.length() != 0)     sb.append('&');
    sb.append(param.getKey()).append('=').append(param.getValue());
  }
  return sb.toString();
}
Program: 46674
Project: 46674
Buggy source:
private void sign() throws GeneralSecurityException {
  final String signatureBaseStr=OAuthEncoder.encode(mMethodStr) + '&' + OAuthEncoder.encode(mUrlStr)+ '&'+ OAuthEncoder.encode(createParameterNormalizationString());
  final String algorithmName="String_Node_Str";
  Key key=new SecretKeySpec(mSecretsStr.getBytes(Charset.forName("String_Node_Str")),algorithmName);
  Mac mac=Mac.getInstance(algorithmName);
  mac.init(key);
  byte[] digest=mac.doFinal(signatureBaseStr.getBytes(Charset.forName("String_Node_Str")));
  String signatureStr=Base64Encoder.encode(digest);
  mOauthParams.add(new Param("String_Node_Str",signatureStr));
}

Fixed version (ground truth):
private void sign() throws GeneralSecurityException {
  final String signatureBaseStr=OAuthEncoder.encode(mMethodStr) + '&' + OAuthEncoder.encode(mUrlStr)+ '&'+ OAuthEncoder.encode(createParameterNormalizationString());
  final String algorithmName="String_Node_Str";
  Key key=new SecretKeySpec(mSecretsStr.getBytes(Charset.forName("String_Node_Str")),algorithmName);
  Mac mac=Mac.getInstance(algorithmName);
  mac.init(key);
  byte[] digest=mac.doFinal(signatureBaseStr.getBytes(Charset.forName("String_Node_Str")));
  mSignature=Base64Encoder.encode(digest);
}