nus-yam/ex-repair huggingface dataset:
Program: 31731
Project: 31731
Buggy source:
@Override public void waitUntilDocReady(int timeout,TimeUnit unit){
  String state=String.valueOf(engine.executeScript("String_Node_Str")).trim().toLowerCase(Locale.ENGLISH);
  if ("String_Node_Str".equals(state)) {
    return;
  }
  LOG.debug("String_Node_Str" + timeout + "String_Node_Str"+ unit.toString());
  CountDownLatch latch=new CountDownLatch(1);
  DocumentListener listener=new SyncDocumentListener(latch);
  addDocumentListener(listener);
  try {
    latch.await(timeout,unit);
  }
 catch (  InterruptedException e) {
    throw new Ui4jExecutionTimeoutException(e,timeout,unit);
  }
  removeListener(listener);
}

Fixed version (ground truth):
@Override public void waitUntilDocReady(int timeout,TimeUnit unit){
  String state=executeScript("String_Node_Str").toString().trim().toLowerCase(Locale.ENGLISH);
  if ("String_Node_Str".equals(state)) {
    return;
  }
  LOG.debug("String_Node_Str" + timeout + "String_Node_Str"+ unit.toString());
  CountDownLatch latch=new CountDownLatch(1);
  DocumentListener listener=new SyncDocumentListener(latch);
  addDocumentListener(listener);
  try {
    latch.await(timeout,unit);
  }
 catch (  InterruptedException e) {
    throw new Ui4jExecutionTimeoutException(e,timeout,unit);
  }
  removeListener(listener);
}
Program: 31732
Project: 31732
Buggy source:
@Override public void unregister(EventTarget node,String event,EventHandler handler){
  if (node instanceof WebKitElement) {
    WebKitElement elementImpl=(WebKitElement)node;
    EventListener listener=listeners.get(handler);
    listeners.remove(handler);
    elementImpl.removeAttribute("String_Node_Str");
    elementImpl.getNode().removeEventListener(event,listener,false);
  }
}

Fixed version (ground truth):
@Override public void unregister(EventTarget node,String event,EventHandler handler){
  if (node instanceof WebKitDocument) {
    node=((WebKitDocument)node).getBody().getParent();
  }
  if (node instanceof WebKitElement) {
    WebKitElement elementImpl=(WebKitElement)node;
    EventListener listener=listeners.get(handler);
    listeners.remove(handler);
    elementImpl.removeAttribute("String_Node_Str");
    elementImpl.getNode().removeEventListener(event,listener,false);
  }
}
Program: 31733
Project: 31733
Buggy source:
@Override public void register(EventTarget node,String event,EventHandler handler){
  if (node instanceof WebKitElement) {
    WebKitElement elementImpl=(WebKitElement)node;
    WebKitEventListener listener=new WebKitEventListener(elementImpl,context,event,handler);
    listeners.put(handler,listener);
    elementImpl.setAttribute("String_Node_Str","String_Node_Str");
    elementImpl.getNode().addEventListener(event,listener,false);
  }
}

Fixed version (ground truth):
@Override public void register(EventTarget node,String event,EventHandler handler){
  if (node instanceof WebKitDocument) {
    node=((WebKitDocument)node).getBody().getParent();
  }
  if (node instanceof WebKitElement) {
    WebKitElement elementImpl=(WebKitElement)node;
    WebKitEventListener listener=new WebKitEventListener(elementImpl,context,event,handler);
    listeners.put(handler,listener);
    elementImpl.setAttribute("String_Node_Str","String_Node_Str");
    elementImpl.getNode().addEventListener(event,listener,false);
  }
}
Program: 31734
Project: 31734
Buggy source:
private synchronized void gotResult(boolean success,String message){
  this.initWithSuccess=success;
  failureFound=message;
  notify();
}

Fixed version (ground truth):
private synchronized void gotResult(boolean success,String message){
  initWithSuccess=success;
  failureFound=message;
  completed=true;
  notify();
}
Program: 31735
Project: 31735
Buggy source:
public synchronized void waitForResult(long timeoutMs){
  try {
    wait(timeoutMs);
    if (!initWithSuccess) {
      throw new RuntimeException(String.format("String_Node_Str",TimeUnit.MILLISECONDS.toSeconds(timeoutMs)));
    }
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public synchronized void waitForResult(long timeoutMs){
  try {
    wait(timeoutMs);
    if (!completed) {
      throw new RuntimeException(String.format("String_Node_Str",TimeUnit.MILLISECONDS.toSeconds(timeoutMs)));
    }
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}
Program: 31736
Project: 31736
Buggy source:
protected EmbeddedMysql(final MysqldConfig config){
  this.config=config;
  IRuntimeConfig runtimeConfig=new RuntimeConfigBuilder().defaults().build();
  this.executable=new MysqldStarter(runtimeConfig).prepare(config);
  try {
    this.process=executable.start(Distribution.detectFor(config.getVersion()),config,runtimeConfig);
    getClient(SCHEMA).executeCommands(format("String_Node_Str",config.getUsername(),config.getPassword()));
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
protected EmbeddedMysql(final MysqldConfig config){
  this.config=config;
  IRuntimeConfig runtimeConfig=new RuntimeConfigBuilder().defaults().build();
  this.executable=new MysqldStarter(runtimeConfig).prepare(config);
  try {
    executable.start();
    getClient(SCHEMA).executeCommands(format("String_Node_Str",config.getUsername(),config.getPassword()));
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 31737
Project: 31737
Buggy source:
public synchronized void stop(){
  if (isRunning.getAndSet(false)) {
    process.stop();
    executable.stop();
  }
}

Fixed version (ground truth):
public synchronized void stop(){
  if (isRunning.getAndSet(false)) {
    executable.stop();
  }
}
Program: 31738
Project: 31738
Buggy source:
@Override protected List<String> getCommandLine(Distribution distribution,MysqldConfig config,IExtractedFileSet exe) throws IOException {
  final String baseDir=exe.generatedBaseDir().getAbsolutePath();
  return Collections.newArrayList(exe.executable().getAbsolutePath(),"String_Node_Str","String_Node_Str",String.format("String_Node_Str",baseDir),String.format("String_Node_Str",baseDir),String.format("String_Node_Str",baseDir),String.format("String_Node_Str",pidFile(exe.executable())),String.format("String_Node_Str",baseDir),String.format("String_Node_Str",config.getPort()),String.format("String_Node_Str",baseDir));
}

Fixed version (ground truth):
@Override protected List<String> getCommandLine(Distribution distribution,MysqldConfig config,IExtractedFileSet exe) throws IOException {
  final String baseDir=exe.generatedBaseDir().getAbsolutePath();
  return Collections.newArrayList(exe.executable().getAbsolutePath(),"String_Node_Str","String_Node_Str","String_Node_Str",String.format("String_Node_Str",baseDir),String.format("String_Node_Str",baseDir),String.format("String_Node_Str",baseDir),String.format("String_Node_Str",pidFile(exe.executable())),String.format("String_Node_Str",baseDir),String.format("String_Node_Str",config.getPort()),String.format("String_Node_Str",baseDir));
}
Program: 31739
Project: 31739
Buggy source:
/** 
 * Returns falls if the phrase only contains upper case characters
 * @param phrase
 * @return
 */
private boolean isOkToLower(String phrase){
  int lower=0;
  int upper=0;
  for (  char p : phrase.toCharArray()) {
    if (Character.isLowerCase(p)) {
      lower++;
    }
    if (Character.isUpperCase(p)) {
      upper++;
    }
  }
  if (upper > lower) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Returns falls if the phrase only contains upper case characters
 * @param phrase
 * @return
 */
private boolean isOkToLower(String phrase){
  int lower=0;
  int upper=0;
  for (  char p : phrase.toCharArray()) {
    if (Character.isLowerCase(p)) {
      lower++;
    }
    if (Character.isUpperCase(p)) {
      upper++;
    }
  }
  if (upper > lower && upper < 5) {
    return false;
  }
  return true;
}
Program: 31740
Project: 31740
Buggy source:
public void setVocabularyName(String vocabularyName){
  if (vocabularyName.equals("String_Node_Str")) {
    setThesaurusFeatures(false);
  }
  this.vocabularyName=vocabularyName;
}

Fixed version (ground truth):
public void setVocabularyName(String vocabularyName){
  if (vocabularyName.equals("String_Node_Str")) {
    setThesaurusFeatures(false);
    this.vocabularyName="String_Node_Str";
  }
 else {
    String fileName=vocabularyName.substring(vocabularyName.lastIndexOf("String_Node_Str") + 1);
    String vocabularyFileName=fileName.substring(0,fileName.indexOf("String_Node_Str"));
    this.vocabularyName=vocabularyFileName;
  }
}
Program: 31744
Project: 31744
Buggy source:
private static final String instanceIp(Request request){
  return request.instances[CommonUtil.rand.nextInt(request.instances.length)];
}

Fixed version (ground truth):
private static final String instanceIp(Request request){
  return request.instances[rand.nextInt(request.instances.length)];
}
Program: 31747
Project: 31747
Buggy source:
private Config(){
  File file=new File("String_Node_Str");
  String basicAuthUserTmp=null;
  String basicAuthPassTmp=null;
  String secretATmp=null;
  String secretBTmp=null;
  String secretCTmp=null;
  String secretDTmp=null;
  String mandrillKeyTmp=null;
  String mandrillEmailTmp=null;
  try {
    FileUtils.touch(file);
    props.load(new FileInputStream(file));
    basicAuthUserTmp=props.getProperty("String_Node_Str",Random.next());
    basicAuthPassTmp=props.getProperty("String_Node_Str",Random.next());
    secretATmp=props.getProperty("String_Node_Str",Random.next());
    secretBTmp=props.getProperty("String_Node_Str",Random.next());
    secretCTmp=props.getProperty("String_Node_Str",Random.next());
    secretDTmp=props.getProperty("String_Node_Str",Random.next());
    mandrillKeyTmp=props.getProperty("String_Node_Str");
    mandrillEmailTmp=props.getProperty("String_Node_Str");
    props.store(new FileOutputStream(new File("String_Node_Str")),null);
  }
 catch (  Throwable t) {
    Log.exception(t);
  }
  basicAuthUser=basicAuthUserTmp;
  basicAuthPass=basicAuthPassTmp;
  secretA=secretATmp;
  secretB=secretBTmp;
  secretC=secretCTmp;
  secretD=secretDTmp;
  mandrillKey=mandrillKeyTmp;
  mandrillEmail=mandrillEmailTmp;
}

Fixed version (ground truth):
private Config(){
  File lock=new File("String_Node_Str");
  while (lock.exists()) {
    try {
      Thread.sleep(SLEEP);
    }
 catch (    Throwable t) {
    }
  }
  try {
    FileUtils.touch(lock);
  }
 catch (  Throwable t) {
    Log.exception(t);
  }
  File file=new File("String_Node_Str");
  FileInputStream streamIn=null;
  try {
    FileUtils.touch(file);
    streamIn=new FileInputStream(file);
    props.load(streamIn);
  }
 catch (  Throwable t) {
    Log.exception(t);
  }
  IOUtils.closeQuietly(streamIn);
  basicAuthUser=getAndSet("String_Node_Str",Random.next());
  basicAuthPass=getAndSet("String_Node_Str",Random.next());
  secretA=getAndSet("String_Node_Str",Random.next());
  secretB=getAndSet("String_Node_Str",Random.next());
  secretC=getAndSet("String_Node_Str",Random.next());
  secretD=getAndSet("String_Node_Str",Random.next());
  mandrillKey=getAndSet("String_Node_Str","String_Node_Str");
  mandrillEmail=getAndSet("String_Node_Str","String_Node_Str");
  FileOutputStream streamOut=null;
  try {
    streamOut=new FileOutputStream(file);
    props.store(streamOut,null);
  }
 catch (  Throwable t) {
    Log.exception(t);
  }
  IOUtils.closeQuietly(streamOut);
  FileUtils.deleteQuietly(lock);
}
Program: 31748
Project: 31748
Buggy source:
static synchronized void start(String name,boolean useLoopback,int port,boolean isClient,ExceptionListener listener,Callback callback){
synchronized (listenerLock) {
    WebApp.listener=listener;
  }
  try {
    Log.init(name,!WebApp.DEV);
  }
 catch (  Throwable t) {
    t.printStackTrace();
    System.exit(1);
  }
  try {
    if (DEV || useLoopback) {
      INTERNAL_URL=URI.create("String_Node_Str" + port);
    }
 else {
      INTERNAL_URL=URI.create("String_Node_Str" + port);
    }
    Log.info("String_Node_Str");
    if (callback != null) {
      callback.call();
    }
    WebAppConfig config=new WebAppConfig(isClient);
    HttpServer httpServer=GrizzlyHttpServerFactory.createHttpServer(INTERNAL_URL,config,false);
    CompressionConfig compressionConfig=httpServer.getListener("String_Node_Str").getCompressionConfig();
    compressionConfig.setCompressionMode(CompressionConfig.CompressionMode.ON);
    compressionConfig.setCompressionMinSize(1);
    compressionConfig.setCompressableMimeTypes(config.mimeTypes());
    httpServer.start();
    final Object lock=new Object();
synchronized (lock) {
      lock.wait();
    }
  }
 catch (  Throwable t) {
    Log.exception(t);
    t.printStackTrace();
    System.exit(2);
  }
}

Fixed version (ground truth):
static synchronized void start(String name,boolean useLoopback,int port,boolean isClient,ExceptionListener listener,Callback callback){
  Config.instance.init();
synchronized (listenerLock) {
    WebApp.listener=listener;
  }
  try {
    Log.init(name,!WebApp.DEV);
  }
 catch (  Throwable t) {
    t.printStackTrace();
    System.exit(1);
  }
  try {
    if (DEV || useLoopback) {
      INTERNAL_URL=URI.create("String_Node_Str" + port);
    }
 else {
      INTERNAL_URL=URI.create("String_Node_Str" + port);
    }
    Log.info("String_Node_Str");
    if (callback != null) {
      callback.call();
    }
    WebAppConfig config=new WebAppConfig(isClient);
    HttpServer httpServer=GrizzlyHttpServerFactory.createHttpServer(INTERNAL_URL,config,false);
    CompressionConfig compressionConfig=httpServer.getListener("String_Node_Str").getCompressionConfig();
    compressionConfig.setCompressionMode(CompressionConfig.CompressionMode.ON);
    compressionConfig.setCompressionMinSize(1);
    compressionConfig.setCompressableMimeTypes(config.mimeTypes());
    httpServer.start();
    final Object lock=new Object();
synchronized (lock) {
      lock.wait();
    }
  }
 catch (  Throwable t) {
    Log.exception(t);
    t.printStackTrace();
    System.exit(2);
  }
}
Program: 31749
Project: 31749
Buggy source:
public static Image buildPDFPreview(int page,int zoom){
  float newScale=((float)zoom) / 100.0f;
  BufferedImage pageImage=null;
  try (PDDocument pdDocument=PDFService.getPDDocument()){
    PDFRenderer pdfRenderer=new PDFRenderer(pdDocument);
    pageImage=pdfRenderer.renderImage(page - 1,newScale,ImageType.RGB);
    return pageImage;
  }
 catch (  IOException ex) {
    Exceptions.printStackTrace(ex);
  }
  return null;
}

Fixed version (ground truth):
public static Image buildPDFPreview(int page,int zoom){
  float newScale=((float)zoom) / 100.0f;
  BufferedImage pageImage=null;
  try (PDDocument pdDocument=PDFService.getPDDocument()){
    PDFRenderer pdfRenderer=new PDFRenderer(pdDocument);
    if (pdfRenderer != null && pdDocument.getNumberOfPages() >= page && page > 0) {
      pageImage=pdfRenderer.renderImage(page - 1);
      int width=(int)(newScale * pageImage.getWidth());
      int height=(int)(newScale * pageImage.getHeight());
      return pageImage.getScaledInstance(width,height,SCALE_TYPE);
    }
    return pageImage;
  }
 catch (  IOException ex) {
    Exceptions.printStackTrace(ex);
  }
  return null;
}
Program: 31751
Project: 31751
Buggy source:
/** 
 * Confirm file saving and show the confirmation dialog
 * @author WhiteHsu
 * @param file the selected file
 * @param currentFIle current file saved in Editor Top Component
 * @return the selected file object
 */
private static File confirmFileSave(File file,File currentFile){
  int reply=JOptionPane.NO_OPTION;
  while (file != null && file.exists() && !file.equals(currentFile) && reply == JOptionPane.NO_OPTION) {
    reply=JOptionPane.showConfirmDialog(null,file.getAbsoluteFile() + "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION);
    if (reply == JOptionPane.NO_OPTION) {
      file=FileChooserService.getSelectedFile("String_Node_Str","String_Node_Str",FileChooserService.DialogType.SAVE,true);
    }
  }
  return file;
}

Fixed version (ground truth):
/** 
 * Confirm file saving and show the confirmation dialog
 * @author WhiteHsu
 * @param file the selected file
 * @param currentFIle current file saved in Editor Top Component
 * @return the selected file object
 */
private static File confirmFileSave(File file,File currentFile){
  int reply=JOptionPane.NO_OPTION;
  while (file != null && file.exists() && !file.equals(currentFile) && reply == JOptionPane.NO_OPTION) {
    reply=JOptionPane.showConfirmDialog(null,file.getAbsoluteFile() + "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION);
    if (reply != JOptionPane.YES_OPTION) {
      file=FileChooserService.getSelectedFile("String_Node_Str","String_Node_Str",FileChooserService.DialogType.SAVE,true);
    }
  }
  return file;
}
Program: 31752
Project: 31752
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  String content=etc.getEditorContent();
  File file=FileChooserService.getSelectedFile("String_Node_Str","String_Node_Str",DialogType.SAVE,true);
  int reply=JOptionPane.NO_OPTION;
  while (file != null && file.exists() && reply == JOptionPane.NO_OPTION) {
    reply=JOptionPane.showConfirmDialog(null,file.getAbsoluteFile() + "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION);
    if (reply == JOptionPane.NO_OPTION) {
      file=FileChooserService.getSelectedFile("String_Node_Str","String_Node_Str",DialogType.SAVE,true);
    }
  }
  if (file != null) {
    FileService.writeToFile(file.getAbsolutePath(),content);
    LOGGER.log("String_Node_Str" + file.getAbsolutePath());
    etc.setCurrentFile(file);
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  String content=etc.getEditorContent();
  File file=FileChooserService.getSelectedFile("String_Node_Str","String_Node_Str",DialogType.SAVE,true);
  file=SaveConfirmDialog.confirmFileSave(JOptionPane.NO_OPTION,file,etc.getCurrentFile());
  if (file != null) {
    FileService.writeToFile(file.getAbsolutePath(),content);
    LOGGER.log("String_Node_Str" + file.getAbsolutePath());
    etc.setCurrentFile(file);
  }
}
Program: 31753
Project: 31753
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  String content=etc.getEditorContent();
  File file=etc.getCurrentFile();
  if (file == null)   file=FileChooserService.getSelectedFile("String_Node_Str","String_Node_Str",DialogType.SAVE,true);
  if (file != null) {
    FileService.writeToFile(file.getAbsolutePath(),content);
    LOGGER.log("String_Node_Str" + file.getAbsolutePath());
    etc.setCurrentFile(file);
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  String content=etc.getEditorContent();
  File file=etc.getCurrentFile();
  if (file == null)   file=FileChooserService.getSelectedFile("String_Node_Str","String_Node_Str",DialogType.SAVE,true);
  file=SaveConfirmDialog.confirmFileSave(JOptionPane.NO_OPTION,file,etc.getCurrentFile());
  if (file != null) {
    FileService.writeToFile(file.getAbsolutePath(),content);
    LOGGER.log("String_Node_Str" + file.getAbsolutePath());
    etc.setCurrentFile(file);
  }
}
Program: 31755
Project: 31755
Buggy source:
public static File getSelectedFile(String extension,String description,DialogType type,boolean fixExtension){
  JFileChooser chooser=new JFileChooser();
  FileNameExtensionFilter filter=new FileNameExtensionFilter(description,extension);
  chooser.setFileFilter(filter);
  int returnVal=0;
switch (type) {
case SAVE:
    returnVal=chooser.showSaveDialog(null);
  break;
case OPEN:
returnVal=chooser.showOpenDialog(null);
break;
case PDF:
returnVal=chooser.showDialog(null,"String_Node_Str");
break;
}
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file=chooser.getSelectedFile();
String filePath=file.getAbsolutePath();
if (fixExtension && !filePath.endsWith("String_Node_Str" + extension)) {
file=new File(filePath + "String_Node_Str" + extension);
}
return file;
}
return null;
}

Fixed version (ground truth):
public static File getSelectedFile(String extension,String description,DialogType type,boolean fixExtension){
  JFileChooser chooser=new JFileChooser();
  FileNameExtensionFilter filter=new FileNameExtensionFilter(description,extension);
  chooser.setFileFilter(filter);
  int returnVal=0;
switch (type) {
case SAVE:
    returnVal=chooser.showSaveDialog(null);
  break;
case OPEN:
returnVal=chooser.showOpenDialog(null);
break;
case PDF:
returnVal=chooser.showDialog(null,"String_Node_Str");
break;
}
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file=chooser.getSelectedFile();
if (file.exists()) {
String filePath=file.getAbsolutePath();
if (fixExtension && !filePath.endsWith("String_Node_Str" + extension)) {
file=new File(filePath + "String_Node_Str" + extension);
}
return file;
}
}
return null;
}
Program: 31756
Project: 31756
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  TopComponent tc=WindowManager.getDefault().findTopComponent("String_Node_Str");
  EditorTopComponent etc=(EditorTopComponent)tc;
  etc.redoAction();
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  TopComponent tc=WindowManager.getDefault().findTopComponent("String_Node_Str");
  EditorTopComponent etc=(EditorTopComponent)tc;
  etc.redoAction();
  etc.setDirty(true);
}
Program: 31757
Project: 31757
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  TopComponent tc=WindowManager.getDefault().findTopComponent("String_Node_Str");
  EditorTopComponent etc=(EditorTopComponent)tc;
  etc.undoAction();
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  TopComponent tc=WindowManager.getDefault().findTopComponent("String_Node_Str");
  EditorTopComponent etc=(EditorTopComponent)tc;
  etc.undoAction();
  etc.setDirty(true);
}
Program: 31758
Project: 31758
Buggy source:
public void commentOutText(){
  String highlightedTextArea=rSyntaxTextArea.getSelectedText();
  try {
    if (highlightedTextArea != null) {
      if (highlightedTextArea.startsWith("String_Node_Str")) {
        rSyntaxTextArea.replaceSelection(highlightedTextArea.replace("String_Node_Str","String_Node_Str"));
      }
 else {
        rSyntaxTextArea.replaceSelection(highlightedTextArea.replace("String_Node_Str","String_Node_Str"));
      }
    }
 else {
      int currentOffsetFromLineStart=rSyntaxTextArea.getCaretOffsetFromLineStart();
      int currentCaretPosition=0;
      int lineStartPosition=0;
      currentCaretPosition=rSyntaxTextArea.getCaretPosition();
      lineStartPosition=currentCaretPosition - currentOffsetFromLineStart;
      String firstChar=rSyntaxTextArea.getText(lineStartPosition,lineStartPosition + 1);
      if (firstChar.startsWith("String_Node_Str")) {
        rSyntaxTextArea.replaceRange("String_Node_Str",lineStartPosition,lineStartPosition + 1);
      }
 else {
        rSyntaxTextArea.replaceRange("String_Node_Str",lineStartPosition,lineStartPosition);
      }
    }
  }
 catch (  Exception err) {
    Exceptions.printStackTrace(err);
  }
}

Fixed version (ground truth):
public void commentOutText(){
  String highlightedTextArea=rSyntaxTextArea.getSelectedText();
  if (highlightedTextArea != null) {
    highlightedTextArea=findStartSymbol();
    if (highlightedTextArea.startsWith("String_Node_Str")) {
      rSyntaxTextArea.replaceSelection(highlightedTextArea.replace("String_Node_Str","String_Node_Str"));
    }
 else {
      String[] array=highlightedTextArea.split("String_Node_Str");
      String tempStr="String_Node_Str";
      for (int i=0; i < array.length; i++) {
        if (i != array.length - 1) {
          array[i]="String_Node_Str" + array[i] + "String_Node_Str";
          tempStr=tempStr + array[i];
        }
 else {
          array[i]="String_Node_Str" + array[i];
          tempStr=tempStr + array[i];
        }
      }
      rSyntaxTextArea.replaceSelection(tempStr);
    }
  }
 else {
    try {
      int currentOffsetFromLineStart=rSyntaxTextArea.getCaretOffsetFromLineStart();
      int currentCaretPosition=0;
      int lineStartPosition=0;
      currentCaretPosition=rSyntaxTextArea.getCaretPosition();
      lineStartPosition=currentCaretPosition - currentOffsetFromLineStart;
      String firstChar=rSyntaxTextArea.getText(lineStartPosition,lineStartPosition + 1);
      if (firstChar.startsWith("String_Node_Str")) {
        rSyntaxTextArea.replaceRange("String_Node_Str",lineStartPosition,lineStartPosition + 1);
      }
 else {
        rSyntaxTextArea.replaceRange("String_Node_Str",lineStartPosition,lineStartPosition);
      }
    }
 catch (    BadLocationException ex) {
      Exceptions.printStackTrace(ex);
    }
  }
}
Program: 31759
Project: 31759
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  TopComponent tc=WindowManager.getDefault().findTopComponent("String_Node_Str");
  EditorTopComponent etc=(EditorTopComponent)tc;
  etc.commentOutText();
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  TopComponent tc=WindowManager.getDefault().findTopComponent("String_Node_Str");
  EditorTopComponent etc=(EditorTopComponent)tc;
  etc.commentOutText();
  etc.setDirty(true);
}
Program: 31760
Project: 31760
Buggy source:
public static PDPage getPDFPage(int number){
  PDPage page=null;
  try {
    File pdfFile=new File(PDF_PATH);
    if (pdfFile.exists()) {
      inputPDF=PDDocument.load(pdfFile);
      List<PDPage> allPages=inputPDF.getDocumentCatalog().getAllPages();
      if (allPages != null && !allPages.isEmpty() && allPages.size() >= number && number > 0) {
        page=allPages.get(number - 1);
      }
    }
  }
 catch (  IOException ex) {
    Exceptions.printStackTrace(ex);
  }
  return page;
}

Fixed version (ground truth):
public static PDPage getPDFPage(int number){
  PDPage page=null;
  File pdfFile=null;
  try {
    pdfFile=new File(PDF_PATH);
    if (pdfFile.exists()) {
      inputPDF=PDDocument.load(pdfFile);
      List<PDPage> allPages=inputPDF.getDocumentCatalog().getAllPages();
      if (allPages != null && !allPages.isEmpty() && allPages.size() >= number && number > 0) {
        page=allPages.get(number - 1);
      }
    }
  }
 catch (  IOException ex) {
    closeDocument();
  }
  return page;
}
Program: 31761
Project: 31761
Buggy source:
@Override public void run(){
  try {
    InputStreamReader isr=new InputStreamReader(is);
    BufferedReader br=new BufferedReader(isr);
    while (true) {
      String s=br.readLine();
      if (s == null)       break;
      outputComponent.logToOutput("String_Node_Str" + name + "String_Node_Str"+ s);
    }
    is.close();
  }
 catch (  IOException ex) {
    LOGGER.log(Level.WARNING,"String_Node_Str",new Object[]{name,ex});
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    InputStreamReader isr=new InputStreamReader(is);
    BufferedReader br=new BufferedReader(isr);
    while (true) {
      String s=br.readLine();
      if (s == null)       break;
      outputComponent.logToOutput("String_Node_Str" + name + "String_Node_Str"+ s);
    }
  }
 catch (  IOException ex) {
    LOGGER.log(Level.WARNING,"String_Node_Str",new Object[]{name,ex});
  }
 finally {
    IOUtils.closeQuietly(is);
  }
}
Program: 31762
Project: 31762
Buggy source:
private int colorFromDB(double d){
  return cma[levelFromDB(d,dBLowerBound,dBUpperBound,cma.length)];
}

Fixed version (ground truth):
private int colorFromDB(double d){
  return cma[levelFromDB(d,dBLowerBound,dBUpperBound,cma.length)] + 0xff000000;
}
Program: 31763
Project: 31763
Buggy source:
double[] getViewPhysicalRange(){
  double[] r=new double[12];
  if (getShowMode() == AnalyzerGraphic.PlotMode.SPECTRUM) {
    r[0]=spectrumPlot.axisX.vMinInView();
    r[1]=spectrumPlot.axisX.vMaxInView();
    r[2]=spectrumPlot.axisY.vMaxInView();
    r[3]=spectrumPlot.axisY.vMinInView();
    r[4]=0;
    r[5]=0;
    r[6]=spectrumPlot.axisX.vLowerBound;
    r[7]=spectrumPlot.axisX.vUpperBound;
    r[8]=AnalyzerGraphic.minDB;
    r[9]=AnalyzerGraphic.maxDB;
    r[10]=0;
    r[11]=0;
  }
 else {
    r[0]=spectrogramPlot.axisFreq.vMinInView();
    r[1]=spectrogramPlot.axisFreq.vMaxInView();
    if (r[0] > r[1]) {
      double t=r[0];
      r[0]=r[1];
      r[1]=t;
    }
    r[2]=spectrogramPlot.spectrogramBMP.dBLowerBound;
    r[3]=spectrogramPlot.spectrogramBMP.dBUpperBound;
    r[4]=spectrogramPlot.axisTime.vMinInView();
    r[5]=spectrogramPlot.axisTime.vMaxInView();
    r[6]=spectrogramPlot.axisFreq.vLowerBound;
    r[7]=spectrogramPlot.axisFreq.vUpperBound;
    if (r[6] > r[7]) {
      double t=r[6];
      r[6]=r[7];
      r[7]=t;
    }
    r[8]=AnalyzerGraphic.minDB;
    r[9]=AnalyzerGraphic.maxDB;
    r[10]=spectrogramPlot.axisTime.vLowerBound;
    r[11]=spectrogramPlot.axisTime.vUpperBound;
  }
  return r;
}

Fixed version (ground truth):
double[] getViewPhysicalRange(){
  double[] r=new double[12];
  if (getShowMode() == AnalyzerGraphic.PlotMode.SPECTRUM) {
    r[0]=spectrumPlot.axisX.vMinInView();
    r[1]=spectrumPlot.axisX.vMaxInView();
    r[2]=spectrumPlot.axisY.vMaxInView();
    r[3]=spectrumPlot.axisY.vMinInView();
    r[4]=0;
    r[5]=0;
    r[6]=spectrumPlot.axisX.vLowerBound;
    r[7]=spectrumPlot.axisX.vUpperBound;
    r[8]=AnalyzerGraphic.minDB;
    r[9]=AnalyzerGraphic.maxDB;
    r[10]=0;
    r[11]=0;
  }
 else {
    r[0]=spectrogramPlot.axisFreq.vMinInView();
    r[1]=spectrogramPlot.axisFreq.vMaxInView();
    if (r[0] > r[1]) {
      double t=r[0];
      r[0]=r[1];
      r[1]=t;
    }
    r[2]=spectrogramPlot.spectrogramBMP.dBLowerBound;
    r[3]=spectrogramPlot.spectrogramBMP.dBUpperBound;
    r[4]=spectrogramPlot.axisTime.vMinInView();
    r[5]=spectrogramPlot.axisTime.vMaxInView();
    r[6]=spectrogramPlot.axisFreq.vLowerBound;
    r[7]=spectrogramPlot.axisFreq.vUpperBound;
    if (r[6] > r[7]) {
      double t=r[6];
      r[6]=r[7];
      r[7]=t;
    }
    r[8]=AnalyzerGraphic.minDB;
    r[9]=AnalyzerGraphic.maxDB;
    r[10]=spectrogramPlot.axisTime.vLowerBound;
    r[11]=spectrogramPlot.axisTime.vUpperBound;
  }
  for (int i=6; i < r.length; i+=2) {
    if (r[i] > r[i + 1]) {
      double t=r[i];
      r[i]=r[i + 1];
      r[i + 1]=t;
    }
  }
  return r;
}
Program: 31765
Project: 31765
Buggy source:
void setTimeMultiplier(int nAve){
  timeMultiplier=nAve;
  axisTime.vUpperBound=timeWatch * timeMultiplier;
}

Fixed version (ground truth):
void setTimeMultiplier(int nAve){
  timeMultiplier=nAve;
  if (showModeSpectrogram == TimeAxisMode.SHIFT) {
    axisTime.vLowerBound=timeWatch * timeMultiplier;
  }
 else {
    axisTime.vUpperBound=timeWatch * timeMultiplier;
  }
  axisTime.setZoomShift(axisTime.getZoom(),axisTime.getShift());
}
Program: 31767
Project: 31767
Buggy source:
public void switch2Spectrogram(){
  if (showMode == PlotMode.SPECTRUM && canvasHeight > 0) {
    Log.v(TAG,"String_Node_Str");
    if (spectrogramPlot.showFreqAlongX) {
      yZoom=spectrogramPlot.axisTime.getZoom();
      yShift=spectrogramPlot.axisTime.getShift();
      spectrogramPlot.axisFreq.setZoomShift(xZoom,xShift);
    }
 else {
      yZoom=xZoom;
      yShift=1 - 1 / xZoom - xShift;
      xZoom=spectrogramPlot.axisTime.getZoom();
      xShift=spectrogramPlot.axisTime.getShift();
      spectrogramPlot.axisFreq.setZoomShift(yZoom,yShift);
    }
  }
  spectrogramPlot.prepare();
  showMode=PlotMode.SPECTROGRAM;
}

Fixed version (ground truth):
public void switch2Spectrogram(){
  if (showMode == PlotMode.SPECTRUM && canvasHeight > 0) {
    Log.v(TAG,"String_Node_Str");
    if (spectrogramPlot.showFreqAlongX) {
      yZoom=spectrogramPlot.axisTime.getZoom();
      yShift=spectrogramPlot.axisTime.getShift();
      spectrogramPlot.axisFreq.setZoomShift(xZoom,xShift);
    }
 else {
      yZoom=xZoom;
      yShift=1 - 1 / xZoom - xShift;
      xZoom=spectrogramPlot.axisTime.getZoom();
      xShift=spectrogramPlot.axisTime.getShift();
      spectrogramPlot.axisFreq.setZoomShift(yZoom,yShift);
    }
  }
  spectrogramPlot.spectrogramBMP.updateAxis(spectrogramPlot.axisFreq);
  spectrogramPlot.prepare();
  showMode=PlotMode.SPECTROGRAM;
}
Program: 31768
Project: 31768
Buggy source:
private void SaveViewRange(double[] rr,boolean isLock){
  SharedPreferences sharedPref=PreferenceManager.getDefaultSharedPreferences(ct);
  SharedPreferences.Editor editor=sharedPref.edit();
  for (int i=0; i < rr.length; i++) {
    AnalyzerUtil.putDouble(editor,"String_Node_Str" + i,rr[i]);
  }
  editor.putBoolean("String_Node_Str",isLock);
  editor.apply();
}

Fixed version (ground truth):
private void SaveViewRange(double[] rr,boolean isLock){
  SharedPreferences sharedPref=PreferenceManager.getDefaultSharedPreferences(ct);
  SharedPreferences.Editor editor=sharedPref.edit();
  for (int i=0; i < rr.length; i++) {
    AnalyzerUtil.putDouble(editor,"String_Node_Str" + i,rr[i]);
  }
  editor.putBoolean("String_Node_Str",isLock);
  editor.commit();
}
Program: 31773
Project: 31773
Buggy source:
boolean isImportantLabel(int j){
  return isAlmostInteger(log10(values[j]));
}

Fixed version (ground truth):
boolean isImportantLabel(int j){
  return AnalyzerUtil.isAlmostInteger(log10(values[j]));
}
Program: 31774
Project: 31774
Buggy source:
void reverseBounds(){
  double oldVL=vLowerViewBound;
  double oldVU=vUpperViewBound;
  setBounds(vUpperBound,vLowerBound);
  setZoomShiftFromV(oldVU,oldVL);
}

Fixed version (ground truth):
void reverseBounds(){
  double oldVL=vLowerViewBound;
  double oldVU=vUpperViewBound;
  setBounds(vUpperBound,vLowerBound);
  setViewBounds(oldVU,oldVL);
}
Program: 31775
Project: 31775
Buggy source:
void setBounds(double _vLowerBound,double _vHigherBound){
  vLowerBound=_vLowerBound;
  vUpperBound=_vHigherBound;
  vLowerViewBound=vLowerBound;
  vUpperViewBound=vUpperBound;
  zoom=1;
  shift=0;
}

Fixed version (ground truth):
void setBounds(double _vL,double _vU){
  vLowerBound=_vL;
  vUpperBound=_vU;
  setZoomShift(zoom,shift);
  if (AnalyzerUtil.isAlmostInteger(vLowerViewBound)) {
    vLowerViewBound=Math.round(vLowerViewBound);
  }
  if (AnalyzerUtil.isAlmostInteger(vUpperViewBound)) {
    vUpperViewBound=Math.round(vUpperViewBound);
  }
  setViewBounds(vLowerViewBound,vUpperViewBound);
}
Program: 31776
Project: 31776
Buggy source:
void setMappingType(ScreenPhysicalMapping.Type _mapType,double lower_bound_ref){
  double vL=vMinInView();
  double vH=vMaxInView();
  if (_mapType == Type.LOG) {
    if (vLowerBound == 0)     vLowerBound=lower_bound_ref;
    if (vUpperBound == 0)     vUpperBound=lower_bound_ref;
  }
 else {
    if (vLowerBound == lower_bound_ref)     vLowerBound=0;
    if (vUpperBound == lower_bound_ref)     vUpperBound=0;
  }
  boolean bNeedUpdateZoomShift=mapType != _mapType;
  mapType=_mapType;
  if (!bNeedUpdateZoomShift || nCanvasPixel == 0 || vLowerBound == vUpperBound) {
    return;
  }
  if (_mapType == Type.LOG) {
    if (vL < 0 || vH < 0) {
      Log.e(TAG,"String_Node_Str");
      return;
    }
    if (vL < lower_bound_ref)     vL=lower_bound_ref;
    if (vH < lower_bound_ref)     vH=lower_bound_ref;
  }
 else {
    if (vL <= lower_bound_ref)     vL=0;
    if (vH <= lower_bound_ref)     vH=0;
  }
  setZoomShiftFromV(vL,vH);
}

Fixed version (ground truth):
void setMappingType(ScreenPhysicalMapping.Type _mapType,double lower_bound_ref){
  double vL=vMinInView();
  double vH=vMaxInView();
  if (_mapType == Type.LOG) {
    if (vLowerBound == 0)     vLowerBound=lower_bound_ref;
    if (vUpperBound == 0)     vUpperBound=lower_bound_ref;
  }
 else {
    if (vLowerBound == lower_bound_ref)     vLowerBound=0;
    if (vUpperBound == lower_bound_ref)     vUpperBound=0;
  }
  boolean bNeedUpdateZoomShift=mapType != _mapType;
  mapType=_mapType;
  if (!bNeedUpdateZoomShift || nCanvasPixel == 0 || vLowerBound == vUpperBound) {
    return;
  }
  if (_mapType == Type.LOG) {
    if (vL < 0 || vH < 0) {
      Log.e(TAG,"String_Node_Str");
      return;
    }
    if (vL < lower_bound_ref)     vL=lower_bound_ref;
    if (vH < lower_bound_ref)     vH=lower_bound_ref;
  }
 else {
    if (vL <= lower_bound_ref)     vL=0;
    if (vH <= lower_bound_ref)     vH=0;
  }
  setViewBounds(vL,vH);
}
Program: 31778
Project: 31778
Buggy source:
void updateAxis(ScreenPhysicalMapping _axisFreq){
  if (_axisFreq.mapType == ScreenPhysicalMapping.Type.LINEAR) {
    return;
  }
  if (logAxisMode == LogAxisPlotMode.REPLOT) {
synchronized (this) {
      if (bmpWidth != calBmpWidth(_axisFreq))       Log.i(TAG,"String_Node_Str" + bmpWidth + "String_Node_Str"+ calBmpWidth(_axisFreq));
      bmpWidth=calBmpWidth(_axisFreq);
      logBmp.init(logBmp.nFreq,logBmp.nTime,_axisFreq,bmpWidth);
    }
  }
 else {
synchronized (this) {
      logSegBmp.init(logSegBmp.nFreq,logSegBmp.nTime,_axisFreq);
    }
  }
  axisF=_axisFreq;
}

Fixed version (ground truth):
void updateAxis(ScreenPhysicalMapping _axisFreq){
  if (_axisFreq.mapType == ScreenPhysicalMapping.Type.LINEAR) {
    return;
  }
  if (logAxisMode == LogAxisPlotMode.REPLOT) {
synchronized (this) {
      int bmpWidthNew=calBmpWidth(_axisFreq);
      boolean needRebuild=bmpWidth != bmpWidthNew;
      bmpWidth=bmpWidthNew;
      logBmp.init(logBmp.nFreq,logBmp.nTime,_axisFreq,bmpWidth);
      if (needRebuild) {
        logBmp.rebuild(spectrumStore,_axisFreq);
      }
    }
  }
 else {
synchronized (this) {
      logSegBmp.init(logSegBmp.nFreq,logSegBmp.nTime,_axisFreq);
    }
  }
  axisF=_axisFreq;
}
Program: 31780
Project: 31780
Buggy source:
void setCanvas(int _canvasWidth,int _canvasHeight,RectF axisBounds){
  Log.i(TAG,"String_Node_Str" + _canvasWidth + "String_Node_Str"+ _canvasHeight);
  canvasWidth=_canvasWidth;
  canvasHeight=_canvasHeight;
  if (showFreqAlongX) {
    axisFreq.setNCanvasPixel(canvasWidth - labelBeginX);
    axisTime.setNCanvasPixel(labelBeginY);
  }
 else {
    axisTime.setNCanvasPixel(canvasWidth - labelBeginX);
    axisFreq.setNCanvasPixel(labelBeginY);
  }
  if (axisBounds != null) {
    if (showFreqAlongX) {
      axisFreq.setBounds(axisBounds.left,axisBounds.right);
      axisTime.setBounds(axisBounds.top,axisBounds.bottom);
    }
 else {
      axisTime.setBounds(axisBounds.left,axisBounds.right);
      axisFreq.setBounds(axisBounds.top,axisBounds.bottom);
    }
    if (showModeSpectrogram == TimeAxisMode.SHIFT) {
      float b1=axisTime.vLowerBound;
      float b2=axisTime.vUpperBound;
      axisTime.setBounds(b2,b1);
    }
  }
  fqGridLabel.setDensity(axisFreq.nCanvasPixel * gridDensity / DPRatio);
  tmGridLabel.setDensity(axisTime.nCanvasPixel * gridDensity / DPRatio);
  spectrogramBMP.updateAxis(axisFreq);
}

Fixed version (ground truth):
void setCanvas(int _canvasWidth,int _canvasHeight,RectF axisBounds){
  Log.i(TAG,"String_Node_Str" + _canvasWidth + "String_Node_Str"+ _canvasHeight);
  canvasWidth=_canvasWidth;
  canvasHeight=_canvasHeight;
  if (canvasHeight > 1 && canvasWidth > 1) {
    labelBeginX=getLabelBeginX();
    labelBeginY=getLabelBeginY();
    Log.i(TAG,"String_Node_Str" + "String_Node_Str" + (canvasWidth - labelBeginX) + "String_Node_Str"+ labelBeginY);
    if (showFreqAlongX) {
      axisFreq.setNCanvasPixel(canvasWidth - labelBeginX);
      axisTime.setNCanvasPixel(labelBeginY);
    }
 else {
      axisTime.setNCanvasPixel(canvasWidth - labelBeginX);
      axisFreq.setNCanvasPixel(labelBeginY);
    }
  }
  if (axisBounds != null) {
    if (showFreqAlongX) {
      axisFreq.setBounds(axisBounds.left,axisBounds.right);
      axisTime.setBounds(axisBounds.top,axisBounds.bottom);
    }
 else {
      axisTime.setBounds(axisBounds.left,axisBounds.right);
      axisFreq.setBounds(axisBounds.top,axisBounds.bottom);
    }
    if (showModeSpectrogram == TimeAxisMode.SHIFT) {
      float b1=axisTime.vLowerBound;
      float b2=axisTime.vUpperBound;
      axisTime.setBounds(b2,b1);
    }
  }
  fqGridLabel.setDensity(axisFreq.nCanvasPixel * gridDensity / DPRatio);
  tmGridLabel.setDensity(axisTime.nCanvasPixel * gridDensity / DPRatio);
  spectrogramBMP.updateAxis(axisFreq);
}
Program: 31781
Project: 31781
Buggy source:
void setFreqAxisMode(ScreenPhysicalMapping.Type mapType,float freq_lower_bound_for_log){
  axisFreq.setMappingType(mapType,freq_lower_bound_for_log);
  if (mapType == ScreenPhysicalMapping.Type.LOG) {
    fqGridLabel.setGridType(GridLabel.Type.FREQ_LOG);
  }
 else {
    fqGridLabel.setGridType(GridLabel.Type.FREQ);
  }
  spectrogramBMP.updateAxis(axisFreq);
}

Fixed version (ground truth):
void setFreqAxisMode(ScreenPhysicalMapping.Type mapType,float freq_lower_bound_for_log){
  Log.i(TAG,"String_Node_Str" + mapType);
  axisFreq.setMappingType(mapType,freq_lower_bound_for_log);
  if (mapType == ScreenPhysicalMapping.Type.LOG) {
    fqGridLabel.setGridType(GridLabel.Type.FREQ_LOG);
  }
 else {
    fqGridLabel.setGridType(GridLabel.Type.FREQ);
  }
  spectrogramBMP.updateAxis(axisFreq);
}
Program: 31782
Project: 31782
Buggy source:
double vFromPixel(double pixel){
  return vFromPixel(pixel,zoom,shift);
}

Fixed version (ground truth):
double vFromPixel(double pixel){
  if (nCanvasPixel == 0)   return vLowerViewBound;
  return vFromUnitPosition(pixel / nCanvasPixel,zoom,shift);
}
Program: 31783
Project: 31783
Buggy source:
double vMinInView(){
  return vFromPixel(0,zoom,shift);
}

Fixed version (ground truth):
double vMinInView(){
  return vLowerViewBound;
}
Program: 31784
Project: 31784
Buggy source:
void reverseBounds(){
  shift=1 - 1 / zoom - shift;
  setBounds(vUpperBound,vLowerBound);
}

Fixed version (ground truth):
void reverseBounds(){
  double oldVL=vLowerViewBound;
  double oldVU=vUpperViewBound;
  setBounds(vUpperBound,vLowerBound);
  setZoomShiftFromV(oldVU,oldVL);
}
Program: 31785
Project: 31785
Buggy source:
void setBounds(double _vLowerBound,double _vHigherBound){
  vLowerBound=_vLowerBound;
  vUpperBound=_vHigherBound;
}

Fixed version (ground truth):
void setBounds(double _vLowerBound,double _vHigherBound){
  vLowerBound=_vLowerBound;
  vUpperBound=_vHigherBound;
  vLowerViewBound=vLowerBound;
  vUpperViewBound=vUpperBound;
  zoom=1;
  shift=0;
}
Program: 31786
Project: 31786
Buggy source:
double vMaxInView(){
  return vFromPixel(nCanvasPixel,zoom,shift);
}

Fixed version (ground truth):
double vMaxInView(){
  return vUpperViewBound;
}
Program: 31787
Project: 31787
Buggy source:
ScreenPhysicalMapping(ScreenPhysicalMapping _axis){
  mapType=_axis.mapType;
  nCanvasPixel=_axis.nCanvasPixel;
  vLowerBound=_axis.vLowerBound;
  vUpperBound=_axis.vUpperBound;
  zoom=_axis.zoom;
  shift=_axis.shift;
}

Fixed version (ground truth):
ScreenPhysicalMapping(ScreenPhysicalMapping _axis){
  mapType=_axis.mapType;
  nCanvasPixel=_axis.nCanvasPixel;
  vLowerBound=_axis.vLowerBound;
  vUpperBound=_axis.vUpperBound;
  vLowerViewBound=_axis.vLowerViewBound;
  vUpperViewBound=_axis.vUpperViewBound;
  zoom=_axis.zoom;
  shift=_axis.shift;
}
Program: 31788
Project: 31788
Buggy source:
void setZoomShiftFromV(double vLower,double vHigher){
  if (vLower == vHigher) {
    return;
  }
  double nCanvasPixelSave=nCanvasPixel;
  nCanvasPixel=1;
  double p1=pixelNoZoomFromV(vLower);
  double p2=pixelNoZoomFromV(vHigher);
  zoom=nCanvasPixel / (p2 - p1);
  shift=p1 / nCanvasPixel;
  nCanvasPixel=nCanvasPixelSave;
}

Fixed version (ground truth):
void setZoomShiftFromV(double vL,double vU){
  if (vL == vU) {
    return;
  }
  double p1=UnitPositionFromV(vL,vLowerBound,vUpperBound);
  double p2=UnitPositionFromV(vU,vLowerBound,vUpperBound);
  zoom=1 / (p2 - p1);
  shift=p1;
  vLowerViewBound=vL;
  vUpperViewBound=vU;
}
Program: 31789
Project: 31789
Buggy source:
double pixelFromV(double v){
  return pixelFromV(v,zoom,shift);
}

Fixed version (ground truth):
double pixelFromV(double v){
  return UnitPositionFromV(v,vLowerViewBound,vUpperViewBound) * nCanvasPixel;
}
Program: 31790
Project: 31790
Buggy source:
double pixelNoZoomFromV(double v){
  return pixelFromV(v,1,0);
}

Fixed version (ground truth):
double pixelNoZoomFromV(double v){
  return UnitPositionFromV(v,vLowerBound,vUpperBound) * nCanvasPixel;
}
Program: 31791
Project: 31791
Buggy source:
void setZoomShift(double _zoom,double _shift){
  zoom=_zoom;
  shift=_shift;
}

Fixed version (ground truth):
void setZoomShift(double _zoom,double _shift){
  zoom=_zoom;
  shift=_shift;
  vLowerViewBound=vFromUnitPosition(0,zoom,shift);
  vUpperViewBound=vFromUnitPosition(1,zoom,shift);
}
Program: 31792
Project: 31792
Buggy source:
private void loadPreferenceForView(){
  SharedPreferences sharedPref=PreferenceManager.getDefaultSharedPreferences(this);
  analyzerParam.sampleRate=sharedPref.getInt("String_Node_Str",8000);
  analyzerParam.fftLen=sharedPref.getInt("String_Node_Str",1024);
  analyzerParam.nFFTAverage=sharedPref.getInt("String_Node_Str",1);
  analyzerParam.isAWeighting=sharedPref.getBoolean("String_Node_Str",false);
  if (analyzerParam.isAWeighting) {
    ((SelectorText)findViewById(R.id.dbA)).nextValue();
  }
  boolean isSpam=sharedPref.getBoolean("String_Node_Str",true);
  if (!isSpam) {
    ((SelectorText)findViewById(R.id.spectrum_spectrogram_mode)).nextValue();
  }
  String axisMode=sharedPref.getString("String_Node_Str","String_Node_Str");
  SelectorText st=(SelectorText)findViewById(R.id.freq_scaling_mode);
  if (!axisMode.equals(st.getText())) {
    st.nextValue();
  }
  Log.i(TAG,"String_Node_Str" + analyzerParam.sampleRate);
  Log.i(TAG,"String_Node_Str" + analyzerParam.fftLen);
  Log.i(TAG,"String_Node_Str" + analyzerParam.nFFTAverage);
  ((Button)findViewById(R.id.button_sample_rate)).setText(Integer.toString(analyzerParam.sampleRate));
  ((Button)findViewById(R.id.button_fftlen)).setText(Integer.toString(analyzerParam.fftLen));
  ((Button)findViewById(R.id.button_average)).setText(Integer.toString(analyzerParam.nFFTAverage));
}

Fixed version (ground truth):
private void loadPreferenceForView(){
  SharedPreferences sharedPref=PreferenceManager.getDefaultSharedPreferences(this);
  analyzerParam.sampleRate=sharedPref.getInt("String_Node_Str",8000);
  analyzerParam.fftLen=sharedPref.getInt("String_Node_Str",1024);
  analyzerParam.nFFTAverage=sharedPref.getInt("String_Node_Str",1);
  analyzerParam.isAWeighting=sharedPref.getBoolean("String_Node_Str",false);
  if (analyzerParam.isAWeighting) {
    ((SelectorText)findViewById(R.id.dbA)).nextValue();
  }
  boolean isSpam=sharedPref.getBoolean("String_Node_Str",true);
  if (!isSpam) {
    ((SelectorText)findViewById(R.id.spectrum_spectrogram_mode)).nextValue();
  }
  String axisMode=sharedPref.getString("String_Node_Str","String_Node_Str");
  SelectorText st=(SelectorText)findViewById(R.id.freq_scaling_mode);
  if (!axisMode.equals(st.getText())) {
    st.nextValue();
  }
  Log.i(TAG,"String_Node_Str" + "String_Node_Str" + analyzerParam.sampleRate + "String_Node_Str"+ analyzerParam.fftLen+ "String_Node_Str"+ analyzerParam.nFFTAverage);
  ((Button)findViewById(R.id.button_sample_rate)).setText(Integer.toString(analyzerParam.sampleRate));
  ((Button)findViewById(R.id.button_fftlen)).setText(Integer.toString(analyzerParam.fftLen));
  ((Button)findViewById(R.id.button_average)).setText(Integer.toString(analyzerParam.nFFTAverage));
}
Program: 31795
Project: 31795
Buggy source:
private void drawTimeAxis(Canvas c,float labelBeginX,float labelBeginY,boolean drawOnXAxis){
  if (showFreqAlongX) {
    drawAxis(c,labelBeginX,labelBeginY,drawOnXAxis,GridLabel.Type.TIME);
  }
 else {
    drawAxis(c,labelBeginX,labelBeginY,drawOnXAxis,GridLabel.Type.TIME);
  }
}

Fixed version (ground truth):
private void drawTimeAxis(Canvas c,float labelBeginX,float labelBeginY,boolean drawOnXAxis){
  if (drawOnXAxis) {
    AxisTickLabels.draw(c,axisTime,tmGridLabel,labelBeginX,labelBeginY,0,1,labelPaint,gridPaint,rulerBrightPaint);
  }
 else {
    AxisTickLabels.draw(c,axisTime,tmGridLabel,labelBeginX,0,1,-1,labelPaint,gridPaint,rulerBrightPaint);
  }
}
Program: 31796
Project: 31796
Buggy source:
private void drawFreqAxis(Canvas c,float labelBeginX,float labelBeginY,boolean drawOnXAxis){
  if (showFreqAlongX) {
    drawAxis(c,labelBeginX,labelBeginY,drawOnXAxis,GridLabel.Type.FREQ);
  }
 else {
    drawAxis(c,labelBeginX,labelBeginY,drawOnXAxis,GridLabel.Type.FREQ);
  }
}

Fixed version (ground truth):
private void drawFreqAxis(Canvas c,float labelBeginX,float labelBeginY,boolean drawOnXAxis){
  if (drawOnXAxis) {
    AxisTickLabels.draw(c,axisFreq,fqGridLabel,labelBeginX,labelBeginY,0,1,labelPaint,gridPaint,rulerBrightPaint);
  }
 else {
    AxisTickLabels.draw(c,axisFreq,fqGridLabel,labelBeginX,0,1,-1,labelPaint,gridPaint,rulerBrightPaint);
  }
}
Program: 31798
Project: 31798
Buggy source:
public void setTimeMultiplier(int nAve){
  timeMultiplier=nAve;
}

Fixed version (ground truth):
public void setTimeMultiplier(int nAve){
  spectrogramPlot.setTimeMultiplier(nAve);
}