nus-yam/ex-repair huggingface dataset:
Program: 37690
Project: 37690
Buggy source:
private String loadCardData(){
  if (cardDeckFile == null) {
    if (DataOptions.readerPath.trim().length() > 0) {
      cardDeckFile=new File(DataOptions.readerPath);
    }
 else {
      return AssemblerOptions.objectPath;
    }
  }
  File objectFile=new File(AssemblerOptions.objectPath);
  String objectName=objectFile.getName();
  String cardDeckName=cardDeckFile.getName();
  String name1=new String(objectName);
  String name2=new String(cardDeckName);
  int index=name1.lastIndexOf("String_Node_Str");
  if (index != -1) {
    name1=name1.substring(0,index);
  }
  index=name2.lastIndexOf("String_Node_Str");
  if (index != -1) {
    name2=name2.substring(0,index);
  }
  String inputName=name1 + "String_Node_Str" + name2+ "String_Node_Str";
  File inputFile=new File(DataOptions.directoryPath,inputName);
  String inputPath=inputFile.getPath();
  try {
    BufferedReader objectReader=new BufferedReader(new FileReader(objectFile));
    BufferedReader cardDeckReader=new BufferedReader(new FileReader(cardDeckFile));
    PrintWriter inputWriter=new PrintWriter(new FileWriter(inputFile));
    String line;
    while ((line=objectReader.readLine()) != null) {
      inputWriter.println(line);
    }
    while ((line=cardDeckReader.readLine()) != null) {
      inputWriter.println(line);
    }
    objectReader.close();
    cardDeckReader.close();
    inputWriter.close();
  }
 catch (  Exception ex) {
    parent.writeMessage(ExecFrame.DARK_RED,"String_Node_Str" + ex.getMessage());
  }
  return inputPath;
}

Fixed version (ground truth):
private String loadCardData(){
  if (cardDeckFile == null) {
    if (DataOptions.readerPath.trim().length() > 0) {
      cardDeckFile=new File(DataOptions.readerPath);
    }
 else {
      return AssemblerOptions.objectPath;
    }
  }
  File objectFile=new File(AssemblerOptions.objectPath);
  String objectName=objectFile.getName();
  String cardDeckName=cardDeckFile.getName();
  String name1=new String(objectName);
  String name2=new String(cardDeckName);
  int index=name1.lastIndexOf("String_Node_Str");
  if (index != -1) {
    name1=name1.substring(0,index);
  }
  index=name2.lastIndexOf("String_Node_Str");
  if (index != -1) {
    name2=name2.substring(0,index);
  }
  String inputName=name1 + "String_Node_Str" + name2+ "String_Node_Str";
  File inputFile=new File(DataOptions.directoryPath,inputName);
  String inputPath=inputFile.getPath();
  try {
    BufferedReader objectReader=new BufferedReader(new FileReader(objectFile));
    BufferedReader cardDeckReader=new BufferedReader(new FileReader(cardDeckFile));
    PrintWriter inputWriter=new PrintWriter(new FileWriter(inputFile));
    String line;
    while ((line=objectReader.readLine()) != null) {
      inputWriter.println(line);
    }
    while ((line=cardDeckReader.readLine()) != null) {
      inputWriter.println(line);
    }
    objectReader.close();
    cardDeckReader.close();
    inputWriter.close();
  }
 catch (  IOException ex) {
    parent.writeMessage(ExecFrame.DARK_RED,"String_Node_Str" + ex.getMessage());
  }
  return inputPath;
}
Program: 37691
Project: 37691
Buggy source:
public Rope(){
  if (RopeHelper.isMac) {
    System.setProperty("String_Node_Str","String_Node_Str");
    System.setProperty("String_Node_Str","String_Node_Str");
    System.setProperty("String_Node_Str","String_Node_Str");
    setQuitStrategy(QuitStrategy.SYSTEM_EXIT_0);
  }
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  }
 catch (  Exception ex) {
  }
  Runtime.getRuntime().addShutdownHook(new Thread(){
    @Override public void run(){
      if (mainFrame != null && !mainFrame.closed()) {
        mainFrame.savePreferences();
      }
      Assembler.kill();
      Simulator.kill();
    }
  }
);
  mainFrame=new RopeFrame();
}

Fixed version (ground truth):
public Rope(){
  if (RopeHelper.isMac) {
    System.setProperty("String_Node_Str","String_Node_Str");
    System.setProperty("String_Node_Str","String_Node_Str");
    System.setProperty("String_Node_Str","String_Node_Str");
  }
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  }
 catch (  Exception ex) {
  }
  Runtime.getRuntime().addShutdownHook(new Thread(){
    @Override public void run(){
      if (mainFrame != null && !mainFrame.closed()) {
        mainFrame.savePreferences();
      }
      Assembler.kill();
      Simulator.kill();
    }
  }
);
  mainFrame=new RopeFrame();
}
Program: 37692
Project: 37692
Buggy source:
@Override public void windowOpened(WindowEvent e){
  loadPreferences();
  if (reopenLastSource) {
    File file=new File(userPrefs.get("String_Node_Str",null));
    if (editFrame.loadSourceFile(file)) {
      String sourceName=file.getName();
      int idx=sourceName.lastIndexOf("String_Node_Str");
      String baseName=idx == -1 ? sourceName.substring(0) : sourceName.substring(0,idx);
      showExecWindow(baseName);
    }
  }
  currentChildFrame=editFrame;
  desktop.getDesktopManager().activateFrame(editFrame);
}

Fixed version (ground truth):
@Override public void windowOpened(WindowEvent e){
  loadPreferences();
  if (reopenLastSource) {
    String filePath=userPrefs.get("String_Node_Str",null);
    if (filePath != null) {
      File file=new File(filePath);
      if (file.exists() && editFrame.loadSourceFile(file)) {
        String sourceName=file.getName();
        int idx=sourceName.lastIndexOf("String_Node_Str");
        String baseName=idx == -1 ? sourceName.substring(0) : sourceName.substring(0,idx);
        showExecWindow(baseName);
      }
    }
  }
  currentChildFrame=editFrame;
  desktop.getDesktopManager().activateFrame(editFrame);
}
Program: 37694
Project: 37694
Buggy source:
private void resetAction(){
  try {
    String message="String_Node_Str";
    int result=JOptionPane.showConfirmDialog(null,message,"String_Node_Str",JOptionPane.WARNING_MESSAGE,JOptionPane.OK_CANCEL_OPTION);
    if (result == JOptionPane.OK_OPTION) {
      Preferences userPrefs=Preferences.userRoot();
      userPrefs.clear();
      userPrefs.sync();
      userPrefs.flush();
      Assembler.kill();
      Simulator.kill();
      System.exit(0);
    }
  }
 catch (  BackingStoreException ex) {
    Logger.getLogger(RopeFrame.class.getName()).log(Level.SEVERE,null,ex);
  }
}

Fixed version (ground truth):
private void resetAction(){
  try {
    String message="String_Node_Str";
    int result=JOptionPane.showConfirmDialog(null,message,"String_Node_Str",JOptionPane.OK_CANCEL_OPTION,JOptionPane.WARNING_MESSAGE);
    if (result == JOptionPane.OK_OPTION) {
      Preferences userPrefs=Preferences.userRoot();
      userPrefs.clear();
      userPrefs.sync();
      userPrefs.flush();
      Assembler.kill();
      Simulator.kill();
      System.exit(0);
    }
  }
 catch (  BackingStoreException ex) {
    Logger.getLogger(RopeFrame.class.getName()).log(Level.SEVERE,null,ex);
  }
}
Program: 37696
Project: 37696
Buggy source:
public boolean quitRope(){
  if (editFrame.sourcePath != null && editFrame.sourceChanged) {
    int result=JOptionPane.showConfirmDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.QUESTION_MESSAGE,JOptionPane.YES_NO_CANCEL_OPTION);
    if (result == JOptionPane.CANCEL_OPTION) {
      return false;
    }
 else     if (result == JOptionPane.YES_OPTION) {
      editFrame.saveAction();
    }
  }
  if (askConfirmationToQuit) {
    int result=JOptionPane.showConfirmDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.QUESTION_MESSAGE,JOptionPane.YES_NO_OPTION);
    if (result == JOptionPane.NO_OPTION) {
      return false;
    }
  }
  savePreferences();
  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  closed=true;
  return closed;
}

Fixed version (ground truth):
public boolean quitRope(){
  if (editFrame.sourcePath != null && editFrame.sourceChanged) {
    int result=JOptionPane.showConfirmDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE);
    if (result == JOptionPane.CANCEL_OPTION) {
      return false;
    }
 else     if (result == JOptionPane.YES_OPTION) {
      editFrame.saveAction();
    }
  }
  if (askConfirmationToQuit) {
    int result=JOptionPane.showConfirmDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
    if (result == JOptionPane.NO_OPTION) {
      return false;
    }
  }
  savePreferences();
  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  closed=true;
  return closed;
}
Program: 37698
Project: 37698
Buggy source:
@Override public void actionPerformed(ActionEvent event){
  Object source=event.getSource();
  if (source == assemblerBrowseBtn) {
    Vector<RopeFileFilter> filters=null;
    if (RopeHelper.isWindows) {
      filters=new Vector<RopeFileFilter>();
      filters.add(new RopeFileFilter(new String[]{"String_Node_Str"},"String_Node_Str"));
    }
    browseAction("String_Node_Str",AssemblerOptions.assemblerPath,assemblerPath,filters,false,false);
  }
 else   if (source == simulatorBrowseBtn) {
    Vector<RopeFileFilter> filters=null;
    if (RopeHelper.isWindows) {
      filters=new Vector<RopeFileFilter>();
      filters.add(new RopeFileFilter(new String[]{"String_Node_Str"},"String_Node_Str"));
    }
    browseAction("String_Node_Str",SimulatorOptions.simulatorPath,simulatorPath,filters,false,false);
  }
 else   if (source == confirmBtn) {
    confirmAction();
  }
 else   if (source == cancelBtn) {
    cancelAction();
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent event){
  Object source=event.getSource();
  if (source == assemblerBrowseBtn) {
    Vector<RopeFileFilter> filters=null;
    if (RopeHelper.isWindows) {
      filters=new Vector<RopeFileFilter>();
      filters.add(new RopeFileFilter(new String[]{"String_Node_Str"},"String_Node_Str"));
    }
    browseAction("String_Node_Str",AssemblerOptions.assemblerPath,assemblerPath,filters,false,false);
  }
 else   if (source == simulatorBrowseBtn) {
    Vector<RopeFileFilter> filters=null;
    if (RopeHelper.isWindows) {
      filters=new Vector<RopeFileFilter>();
      filters.add(new RopeFileFilter(new String[]{"String_Node_Str"},"String_Node_Str"));
    }
    browseAction("String_Node_Str",SimulatorOptions.simulatorPath,simulatorPath,filters,false,false);
  }
 else   if (source == confirmBtn) {
    confirmAction();
  }
 else   if (source == cancelBtn) {
    cancelAction();
  }
 else   if (source == resetBtn) {
    resetAction();
  }
}
Program: 37699
Project: 37699
Buggy source:
PreferencesDialog(Frame owner,String title){
  super(owner,title,Dialog.ModalityType.DOCUMENT_MODAL);
  setMinimumSize(new Dimension(400,210));
  this.setResizable(false);
  try {
    jbInit();
    pack();
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
  assemblerBrowseBtn.addActionListener(this);
  simulatorBrowseBtn.addActionListener(this);
  confirmBtn.addActionListener(this);
  cancelBtn.addActionListener(this);
  assemblerPath.setText(AssemblerOptions.assemblerPath);
  simulatorPath.setText(SimulatorOptions.simulatorPath);
  saveBeforeAssemblyChk.setSelected(AssemblerOptions.saveBeforeAssembly);
  useOldConversionChk.setSelected(SimulatorOptions.useOldConversion);
}

Fixed version (ground truth):
PreferencesDialog(Frame owner,String title){
  super(owner,title,Dialog.ModalityType.DOCUMENT_MODAL);
  setMinimumSize(new Dimension(400,210));
  this.setResizable(false);
  try {
    jbInit();
    pack();
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
  assemblerBrowseBtn.addActionListener(this);
  simulatorBrowseBtn.addActionListener(this);
  confirmBtn.addActionListener(this);
  cancelBtn.addActionListener(this);
  resetBtn.addActionListener(this);
  assemblerPath.setText(AssemblerOptions.assemblerPath);
  simulatorPath.setText(SimulatorOptions.simulatorPath);
  saveBeforeAssemblyChk.setSelected(AssemblerOptions.saveBeforeAssembly);
  useOldConversionChk.setSelected(SimulatorOptions.useOldConversion);
}
Program: 37701
Project: 37701
Buggy source:
void showPrintoutWindow(String baseName){
  desktop.getDesktopManager().deiconifyFrame(printoutFrame);
  printoutFrame.setTitle("String_Node_Str" + baseName);
  printoutFrame.setVisible(true);
  printoutFrame.initialize();
  printoutFrame.toBack();
  commandWindows.addElement(printoutFrame);
  try {
    execFrame.setSelected(true);
  }
 catch (  PropertyVetoException ignore) {
  }
}

Fixed version (ground truth):
void showPrintoutWindow(String baseName){
  desktop.getDesktopManager().deiconifyFrame(printoutFrame);
  printoutFrame.setTitle("String_Node_Str" + baseName);
  printoutFrame.setVisible(true);
  printoutFrame.initialize();
  printoutFrame.toFront();
  commandWindows.addElement(printoutFrame);
  try {
    execFrame.toFront();
    execFrame.setSelected(true);
  }
 catch (  PropertyVetoException ignore) {
  }
}
Program: 37702
Project: 37702
Buggy source:
void createMemoryFrame(){
  if (memoryFrame == null) {
    Dimension ropeFrameSize=this.getContentPane().getSize();
    memoryFrame=new MemoryFrame(this);
    Dimension frameSize=memoryFrame.getSize();
    Point frameLocation=new Point((int)(ropeFrameSize.getWidth() - frameSize.getWidth()) / 2,(int)(ropeFrameSize.getHeight() - frameSize.getHeight()) / 2);
    frameLocation=RopeHelper.parsePoint(userPrefs.get("String_Node_Str",frameLocation.toString()));
    frameSize=RopeHelper.parseDimension(userPrefs.get("String_Node_Str",frameSize.toString()));
    memoryFrame.setLocation(frameLocation);
    memoryFrame.setSize(frameSize);
    memoryFrame.setVisible(true);
    desktop.add(memoryFrame);
    commandWindows.addElement(memoryFrame);
    try {
      memoryFrame.setSelected(true);
    }
 catch (    PropertyVetoException ignore) {
    }
  }
 else {
    desktop.getDesktopManager().deiconifyFrame(memoryFrame);
    desktop.getDesktopManager().activateFrame(memoryFrame);
  }
}

Fixed version (ground truth):
void createMemoryFrame(){
  if (memoryFrame == null) {
    Dimension ropeFrameSize=this.getContentPane().getSize();
    memoryFrame=new MemoryFrame(this);
    Dimension frameSize=memoryFrame.getSize();
    Point frameLocation=new Point((int)(ropeFrameSize.getWidth() - frameSize.getWidth()) / 2,(int)(ropeFrameSize.getHeight() - frameSize.getHeight()) / 2);
    frameLocation=RopeHelper.parsePoint(userPrefs.get("String_Node_Str",frameLocation.toString()));
    frameSize=RopeHelper.parseDimension(userPrefs.get("String_Node_Str",frameSize.toString()));
    verifyFrameLocation(frameLocation);
    verifyFrameSize(frameSize);
    memoryFrame.setLocation(frameLocation);
    memoryFrame.setSize(frameSize);
    memoryFrame.setVisible(true);
    desktop.add(memoryFrame);
    commandWindows.addElement(memoryFrame);
    try {
      memoryFrame.setSelected(true);
    }
 catch (    PropertyVetoException ignore) {
    }
  }
 else {
    desktop.getDesktopManager().deiconifyFrame(memoryFrame);
    desktop.getDesktopManager().activateFrame(memoryFrame);
  }
}
Program: 37703
Project: 37703
Buggy source:
void showExecWindow(String baseName){
  desktop.getDesktopManager().deiconifyFrame(execFrame);
  execFrame.setTitle("String_Node_Str" + baseName);
  execFrame.setVisible(true);
  execFrame.initialize(baseName,DataOptions.outputPath);
  if (haveAssemblyErrors()) {
    try {
      editFrame.setSelected(true);
    }
 catch (    PropertyVetoException ignore) {
    }
  }
}

Fixed version (ground truth):
void showExecWindow(String baseName){
  desktop.getDesktopManager().deiconifyFrame(execFrame);
  execFrame.setTitle("String_Node_Str" + baseName);
  execFrame.setVisible(true);
  execFrame.initialize(baseName,DataOptions.outputPath);
  execFrame.toFront();
}
Program: 37704
Project: 37704
Buggy source:
private void assembleAction(){
  String line;
  messages=new Vector();
  mainFrame.resetExecWindow();
  saveAction();
  assembleFailed=false;
  haveAssemblyErrors=false;
  if (Assembler.version()) {
    while ((line=Assembler.output()) != null) {
      messages.addElement(line);
    }
    Assembler.setPaths(baseName,sourcePath);
    if (Assembler.assemble()) {
      while ((line=Assembler.output()) != null) {
        messages.addElement(line);
        haveAssemblyErrors=true;
      }
      messageList.setListData(messages);
      messageList.ensureIndexIsVisible(0);
      mainFrame.showExecWindow(baseName);
    }
 else {
      assembleFailed=true;
    }
  }
 else {
    assembleFailed=true;
  }
  if (assembleFailed) {
    String message=String.format("String_Node_Str",AssemblerOptions.assemblerPath);
    System.out.println(message);
    JOptionPane.showMessageDialog(this,message);
  }
}

Fixed version (ground truth):
private void assembleAction(){
  String line;
  messages=new Vector();
  mainFrame.resetExecWindow();
  saveAction();
  assembleFailed=false;
  haveAssemblyErrors=false;
  if (Assembler.version()) {
    while ((line=Assembler.output()) != null) {
      messages.addElement(line);
    }
    Assembler.setPaths(baseName,sourcePath);
    if (Assembler.assemble()) {
      while ((line=Assembler.output()) != null) {
        System.out.println(line);
        messages.addElement(line);
        if (line.startsWith("String_Node_Str")) {
          haveAssemblyErrors=true;
        }
      }
      messageList.setListData(messages);
      messageList.ensureIndexIsVisible(0);
      mainFrame.showExecWindow(baseName);
    }
 else {
      assembleFailed=true;
    }
  }
 else {
    assembleFailed=true;
  }
  if (assembleFailed) {
    String message=String.format("String_Node_Str",AssemblerOptions.assemblerPath);
    System.out.println(message);
    JOptionPane.showMessageDialog(this,message);
  }
}
Program: 37705
Project: 37705
Buggy source:
private void browseAction(String title,String filePath,JTextField textField,Vector<RopeFileFilter> filters,boolean directories,boolean multiple){
  RopeFileChooser chooser=new RopeFileChooser(DataOptions.directoryPath,filePath,filters,directories,multiple);
  chooser.setDialogTitle(title);
  chooser.setFileFilter(filters.firstElement());
  chooser.choose(textField,this,multiple);
}

Fixed version (ground truth):
private void browseAction(String title,String filePath,JTextField textField,Vector<RopeFileFilter> filters,boolean directories,boolean multiple){
  RopeFileChooser chooser=new RopeFileChooser(DataOptions.directoryPath,filePath,filters,directories,multiple);
  chooser.setDialogTitle(title);
  if (filters != null) {
    chooser.setFileFilter(filters.firstElement());
  }
  chooser.choose(textField,this,multiple);
}
Program: 37706
Project: 37706
Buggy source:
private void confirmAction(){
  AssemblerOptions.saveBeforeAssembly=saveBeforeAssemblyChk.isSelected();
  SimulatorOptions.useOldConversion=useOldConversionChk.isSelected();
  AssemblerOptions.assemblerPath=assemblerPath.getText();
  SimulatorOptions.simulatorPath=simulatorPath.getText();
  try {
    Preferences userPrefs=Preferences.userRoot();
    userPrefs.put("String_Node_Str",AssemblerOptions.assemblerPath);
    userPrefs.put("String_Node_Str",SimulatorOptions.simulatorPath);
    userPrefs.putBoolean("String_Node_Str",AssemblerOptions.saveBeforeAssembly);
    userPrefs.putBoolean("String_Node_Str",SimulatorOptions.useOldConversion);
    userPrefs.sync();
    userPrefs.flush();
  }
 catch (  BackingStoreException ex) {
    Logger.getLogger(RopeFrame.class.getName()).log(Level.SEVERE,null,ex);
  }
  dispose();
}

Fixed version (ground truth):
private void confirmAction(){
  File file=new File(assemblerPath.getText());
  if (!file.exists() || file.isDirectory()) {
    String message=String.format("String_Node_Str",assemblerPath.getText());
    if (JOptionPane.showConfirmDialog(null,message,"String_Node_Str",JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) {
      return;
    }
  }
  file=new File(simulatorPath.getText());
  if (!file.exists() || file.isDirectory()) {
    String message=String.format("String_Node_Str",simulatorPath.getText());
    if (JOptionPane.showConfirmDialog(null,message,"String_Node_Str",JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) {
      return;
    }
  }
  AssemblerOptions.saveBeforeAssembly=saveBeforeAssemblyChk.isSelected();
  SimulatorOptions.useOldConversion=useOldConversionChk.isSelected();
  AssemblerOptions.assemblerPath=assemblerPath.getText();
  SimulatorOptions.simulatorPath=simulatorPath.getText();
  try {
    Preferences userPrefs=Preferences.userRoot();
    userPrefs.put("String_Node_Str",AssemblerOptions.assemblerPath);
    userPrefs.put("String_Node_Str",SimulatorOptions.simulatorPath);
    userPrefs.putBoolean("String_Node_Str",AssemblerOptions.saveBeforeAssembly);
    userPrefs.putBoolean("String_Node_Str",SimulatorOptions.useOldConversion);
    userPrefs.sync();
    userPrefs.flush();
  }
 catch (  BackingStoreException ex) {
    Logger.getLogger(RopeFrame.class.getName()).log(Level.SEVERE,null,ex);
  }
  dispose();
}
Program: 37707
Project: 37707
Buggy source:
static boolean assemble(){
  try {
    Simulator.kill();
    process=Runtime.getRuntime().exec(AssemblerOptions.command);
    stdout=new BufferedReader(new InputStreamReader(process.getInputStream()));
    process=null;
    return true;
  }
 catch (  IOException ex) {
    ex.printStackTrace();
    return false;
  }
}

Fixed version (ground truth):
static boolean assemble(){
  try {
    Simulator.kill();
    String[] args=AssemblerOptions.command.toArray(new String[0]);
    process=Runtime.getRuntime().exec(args);
    stdout=new BufferedReader(new InputStreamReader(process.getInputStream()));
    process=null;
    return true;
  }
 catch (  IOException ex) {
    ex.printStackTrace();
    return false;
  }
}
Program: 37708
Project: 37708
Buggy source:
static boolean version(){
  String command=AssemblerOptions.assemblerPath + "String_Node_Str";
  try {
    process=Runtime.getRuntime().exec(command);
    stdout=new BufferedReader(new InputStreamReader(process.getInputStream()));
    process=null;
    return true;
  }
 catch (  IOException ex) {
    ex.printStackTrace();
    return false;
  }
}

Fixed version (ground truth):
static boolean version(){
  String[] args=new String[2];
  args[0]=AssemblerOptions.assemblerPath;
  args[1]="String_Node_Str";
  try {
    process=Runtime.getRuntime().exec(args);
    stdout=new BufferedReader(new InputStreamReader(process.getInputStream()));
    process=null;
    return true;
  }
 catch (  IOException ex) {
    ex.printStackTrace();
    return false;
  }
}
Program: 37709
Project: 37709
Buggy source:
/** 
 * Get pet's owner from database-
 * @param petId Pet id
 * @return pet's owner
 */
private Owner findPetsOwner(Integer petId){
  Owner owner=null;
  DBCollection dbOwner=database.getCollection(OWNER_COLLECTION);
  DBCursor cursor=dbOwner.find();
  Owner tempOwner;
  while (cursor.hasNext() && (owner == null)) {
    tempOwner=mapToOwner(cursor.next());
    for (    Pet pet : tempOwner.getPets()) {
      if (pet.getId() == petId) {
        owner=tempOwner;
        break;
      }
    }
  }
  return owner;
}

Fixed version (ground truth):
/** 
 * Get pet's owner from database-
 * @param petId Pet id
 * @return pet's owner
 */
private Owner findPetsOwner(Integer petId){
  Owner owner=null;
  DBCollection dbOwner=database.getCollection(OWNER_COLLECTION);
  DBCursor cursor=dbOwner.find();
  Owner tempOwner;
  while (cursor.hasNext() && (owner == null)) {
    tempOwner=mapToOwner(cursor.next());
    for (    Pet pet : tempOwner.getPets()) {
      if (pet.getId().equals(petId)) {
        owner=tempOwner;
        break;
      }
    }
  }
  return owner;
}
Program: 37710
Project: 37710
Buggy source:
/** 
 * Store pet information into database.
 * @param pet pet to be stored
 * @throws DataAccessException
 */
public void storePet(Pet pet) throws DataAccessException {
  DBCollection collOwner=database.getCollection(OWNER_COLLECTION);
  BasicDBObject ownerQuery=new BasicDBObject(_ID_FIELD,pet.getOwner().getId());
  Owner owner=mapToOwner(collOwner.findOne(ownerQuery));
  if (pet.getId() == null) {
    pet.setId(getNextIdValue(PET_SEQUENCE));
    owner.addPet(pet);
  }
 else {
    List<Pet> pets=owner.getPets();
    List<Pet> newPetsList=new ArrayList<Pet>();
    for (    Pet pet1 : pets) {
      if (pet1.getId() == pet.getId()) {
        newPetsList.add(pet);
      }
 else {
        newPetsList.add(pet1);
      }
    }
    owner.setPets(newPetsList);
  }
  DBObject newDbOwner=mapOwnerToDBObject(owner,owner.getId());
  collOwner.update(ownerQuery,newDbOwner);
}

Fixed version (ground truth):
/** 
 * Store pet information into database.
 * @param pet pet to be stored
 * @throws DataAccessException
 */
public void storePet(Pet pet) throws DataAccessException {
  DBCollection collOwner=database.getCollection(OWNER_COLLECTION);
  BasicDBObject ownerQuery=new BasicDBObject(_ID_FIELD,pet.getOwner().getId());
  Owner owner=mapToOwner(collOwner.findOne(ownerQuery));
  if (pet.getId() == null) {
    pet.setId(getNextIdValue(PET_SEQUENCE));
    owner.addPet(pet);
  }
 else {
    List<Pet> pets=owner.getPets();
    List<Pet> newPetsList=new ArrayList<Pet>();
    for (    Pet pet1 : pets) {
      if (pet1.getId().equals(pet.getId())) {
        newPetsList.add(pet);
      }
 else {
        newPetsList.add(pet1);
      }
    }
    owner.setPets(newPetsList);
  }
  DBObject newDbOwner=mapOwnerToDBObject(owner,owner.getId());
  collOwner.update(ownerQuery,newDbOwner);
}
Program: 37711
Project: 37711
Buggy source:
/** 
 * Get pet's owner from database-
 * @param petId Pet id
 * @return pet's owner
 */
private Owner findPetsOwner(Integer petId){
  Owner owner=null;
  DBCollection dbOwner=database.getCollection(OWNER_COLLECTION);
  DBCursor cursor=dbOwner.find();
  Owner tempOwner;
  while (cursor.hasNext() && (owner == null)) {
    tempOwner=mapToOwner(cursor.next());
    for (    Pet pet : tempOwner.getPets()) {
      if (pet.getId() == petId) {
        owner=tempOwner;
        break;
      }
    }
  }
  return owner;
}

Fixed version (ground truth):
/** 
 * Get pet's owner from database-
 * @param petId Pet id
 * @return pet's owner
 */
private Owner findPetsOwner(Integer petId){
  Owner owner=null;
  DBCollection dbOwner=database.getCollection(OWNER_COLLECTION);
  DBCursor cursor=dbOwner.find();
  Owner tempOwner;
  while (cursor.hasNext() && (owner == null)) {
    tempOwner=mapToOwner(cursor.next());
    for (    Pet pet : tempOwner.getPets()) {
      if (pet.getId().equals(petId)) {
        owner=tempOwner;
        break;
      }
    }
  }
  return owner;
}
Program: 37712
Project: 37712
Buggy source:
public void validate(Owner owner,Errors errors){
  if (!StringUtils.hasLength(owner.getFirstName())) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
  if (!StringUtils.hasLength(owner.getLastName())) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
  if (!StringUtils.hasLength(owner.getAddress())) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
  if (!StringUtils.hasLength(owner.getCity())) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
  String telephone=owner.getTelephone();
  if (!StringUtils.hasLength(telephone)) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else {
    for (int i=0; i < telephone.length(); ++i) {
      if (!Character.isDigit(telephone.charAt(i))) {
        errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
        break;
      }
    }
  }
}

Fixed version (ground truth):
public void validate(Owner owner,Errors errors){
  if (!StringUtils.hasLength(owner.getFirstName())) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
  if (!StringUtils.hasLength(owner.getLastName())) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
  if (!StringUtils.hasLength(owner.getAddress())) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
  if (!StringUtils.hasLength(owner.getCity())) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
  String telephone=owner.getTelephone();
  if (StringUtils.hasLength(telephone)) {
    for (int i=0; i < telephone.length(); ++i) {
      if (!Character.isDigit(telephone.charAt(i))) {
        errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
        break;
      }
    }
  }
 else {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 37713
Project: 37713
Buggy source:
public void validate(Owner owner,Errors errors){
  if (!StringUtils.hasLength(owner.getFirstName())) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
  if (!StringUtils.hasLength(owner.getLastName())) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
  if (!StringUtils.hasLength(owner.getAddress())) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
  if (!StringUtils.hasLength(owner.getCity())) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
  String telephone=owner.getTelephone();
  if (!StringUtils.hasLength(telephone)) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else {
    for (int i=0; i < telephone.length(); ++i) {
      if ((Character.isDigit(telephone.charAt(i))) == false) {
        errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
        break;
      }
    }
  }
}

Fixed version (ground truth):
public void validate(Owner owner,Errors errors){
  if (!StringUtils.hasLength(owner.getFirstName())) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
  if (!StringUtils.hasLength(owner.getLastName())) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
  if (!StringUtils.hasLength(owner.getAddress())) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
  if (!StringUtils.hasLength(owner.getCity())) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
  String telephone=owner.getTelephone();
  if (!StringUtils.hasLength(telephone)) {
    errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else {
    for (int i=0; i < telephone.length(); ++i) {
      if (!Character.isDigit(telephone.charAt(i))) {
        errors.rejectValue("String_Node_Str","String_Node_Str","String_Node_Str");
        break;
      }
    }
  }
}
Program: 37716
Project: 37716
Buggy source:
/** 
 * @param start
 * @param end
 * @return confidence that observation at position start and end are on different segments (the confidence that there is a change point at some position between them)
 */
public ConfidenceResult calculateConfidence(int start,int end){
  double log_probility=Util.logSum(likelihoods.subList(start,end)) - log_q_suffix[0];
  double log_odds=Math.exp(0 - log_probility) - 1 <= 0 ? Double.POSITIVE_INFINITY : log_probility - Util.logSubtract(0,log_probility);
  return new ConfidenceResult(log_probility,log_odds);
}

Fixed version (ground truth):
public ConfidenceResult calculateConfidence(int p){
  double log_probility=likelihoods.get(p) - log_q_suffix[0];
  double log_odds=Math.exp(0 - log_probility) - 1 <= 0 ? Double.POSITIVE_INFINITY : log_probility - Util.logSubtract(0,log_probility);
  return new ConfidenceResult(log_probility,log_odds);
}
Program: 37726
Project: 37726
Buggy source:
public static void countSpliceIsoforms(File assembly_gtf) throws FileNotFoundException {
  TranscriptIterator ti=new TranscriptIterator(assembly_gtf);
  StrandedGenomicIntervalTree<Map<String,Object>> exon_5p=new StrandedGenomicIntervalTree<Map<String,Object>>();
  StrandedGenomicIntervalTree<Map<String,Object>> exon_3p=new StrandedGenomicIntervalTree<Map<String,Object>>();
  StrandedGenomicIntervalTree<Map<String,Object>> sj5p=new StrandedGenomicIntervalTree<Map<String,Object>>();
  for (  AnnotatedRegion r : ti) {
    if (r.annotation.equals("String_Node_Str")) {
      if (r.getAttribute("String_Node_Str").equals("String_Node_Str")) {
        exon_5p.add(r.chr,r.start,r.end,r.strand,r.attributes);
      }
 else {
        exon_3p.add(r.chr,r.start,r.end,r.strand,r.attributes);
      }
    }
    if (r.annotation.equals("String_Node_Str")) {
      Map<String,Object> attributes=r.attributes;
      attributes.put("String_Node_Str",r.get3Prime());
      sj5p.add(r.chr,r.get5Prime(),r.get5Prime(),r.strand,attributes);
    }
  }
  for (  AnnotatedRegion r : exon_5p) {
    int n=countPaths(r,exon_3p,sj5p);
    System.out.printf("String_Node_Str",r,n);
  }
}

Fixed version (ground truth):
public static void countSpliceIsoforms(File assembly_gtf) throws FileNotFoundException {
  TranscriptIterator ti=new TranscriptIterator(assembly_gtf);
  StrandedGenomicIntervalTree<Map<String,Object>> exon_5p=new StrandedGenomicIntervalTree<Map<String,Object>>();
  StrandedGenomicIntervalTree<Map<String,Object>> exon_3p=new StrandedGenomicIntervalTree<Map<String,Object>>();
  StrandedGenomicIntervalTree<Map<String,Object>> sj5p=new StrandedGenomicIntervalTree<Map<String,Object>>();
  for (  AnnotatedRegion r : ti) {
    if (r.annotation.equals("String_Node_Str")) {
      if (r.getAttribute("String_Node_Str").equals("String_Node_Str")) {
        exon_5p.add(r.chr,r.start,r.end,r.strand,r.attributes);
      }
 else {
        exon_3p.add(r.chr,r.start,r.end,r.strand,r.attributes);
      }
    }
    if (r.annotation.equals("String_Node_Str")) {
      Map<String,Object> attributes=r.attributes;
      attributes.put("String_Node_Str",r.get3Prime());
      sj5p.add(r.chr,r.get5Prime(),r.get5Prime(),r.strand,attributes);
    }
  }
  for (  AnnotatedRegion r : exon_5p) {
    int n=countPaths(r,exon_3p,sj5p).intValue();
    System.out.printf("String_Node_Str",r,n);
  }
}
Program: 37727
Project: 37727
Buggy source:
public static Integer countPaths(AnnotatedRegion r,StrandedGenomicIntervalTree<Map<String,Object>> exon_3p,StrandedGenomicIntervalTree<Map<String,Object>> sj5p){
  String path_att="String_Node_Str";
  Integer nPaths=(Integer)r.getAttribute(path_att);
  if (nPaths == null) {
    List<AnnotatedRegion> children=listChildren(r,exon_3p,sj5p);
    if (children.size() == 0) {
      nPaths=1;
    }
 else {
      nPaths=0;
      for (      AnnotatedRegion c : children) {
        nPaths+=countPaths(c,exon_3p,sj5p);
      }
    }
    r.addAttribute(path_att,nPaths);
  }
  return nPaths;
}

Fixed version (ground truth):
public static BigInteger countPaths(AnnotatedRegion r,StrandedGenomicIntervalTree<Map<String,Object>> exon_3p,StrandedGenomicIntervalTree<Map<String,Object>> sj5p){
  String path_att="String_Node_Str";
  BigInteger nPaths=(BigInteger)r.getAttribute(path_att);
  if (nPaths == null) {
    List<AnnotatedRegion> children=listChildren(r,exon_3p,sj5p);
    if (children.size() == 0) {
      nPaths=new BigInteger("String_Node_Str");
    }
 else {
      nPaths=new BigInteger("String_Node_Str");
      for (      AnnotatedRegion c : children) {
        nPaths=nPaths.add(countPaths(c,exon_3p,sj5p));
      }
    }
    r.addAttribute(path_att,nPaths);
  }
  return nPaths;
}
Program: 37731
Project: 37731
Buggy source:
@Override public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
  WeChat.handleLoadPackage(lpparam);
  QuickSettings.handleLoadPackage(lpparam);
  XSystemUI.handleLoadPackage(lpparam);
}

Fixed version (ground truth):
@Override public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
  WeChat.handleLoadPackage(lpparam);
  QuickSettings.handleLoadPackage(lpparam);
  XPhoneStatusBar.handleLoadPackage(lpparam);
}
Program: 37732
Project: 37732
Buggy source:
@SuppressWarnings("String_Node_Str") @Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.preference);
  prefs=getPreferenceScreen().getSharedPreferences();
  updateX2oolsPrefs();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.preference);
  prefs=getPreferenceScreen().getSharedPreferences();
  initX2oolsPrefs();
}
Program: 37733
Project: 37733
Buggy source:
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,String key){
  if (key.equals(KEY_WECHAT_SCAN)) {
    Intent intent=new Intent(ACTION_WECHAT_SCAN_CHANGED);
    intent.putExtra(KEY_WECHAT_SCAN,sharedPreferences.getBoolean(KEY_WECHAT_SCAN,false));
    sendBroadcast(intent);
  }
 else   if (key.equals(KEY_CONTEXT_SETTINGS)) {
    boolean enable=sharedPreferences.getBoolean(KEY_CONTEXT_SETTINGS,true);
    Intent intent=new Intent(ContextSettingsService.ACTION_CONTEXT_SETTINGS);
    intent.putExtra(ContextSettingsService.KEY_ENABLE,enable);
    sendBroadcast(intent);
    Log.d(TAG,"String_Node_Str" + enable);
  }
 else   if (key.equals(KEY_STATUS_COLOR)) {
    int color=sharedPreferences.getInt(KEY_STATUS_COLOR,Color.TRANSPARENT);
    if (color == Color.TRANSPARENT) {
      color=getResources().getColor(R.color.default_dark_actionbar);
    }
    Intent statusbarIntent=new Intent(XSystemUI.ACTION_CHANGE_STATUS_BAR);
    statusbarIntent.putExtra("String_Node_Str",color);
    sendBroadcast(statusbarIntent);
  }
  updateX2oolsPrefs();
}

Fixed version (ground truth):
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,String key){
  if (key.equals(KEY_WECHAT_SCAN)) {
    Intent intent=new Intent(ACTION_WECHAT_SCAN_CHANGED);
    intent.putExtra(KEY_WECHAT_SCAN,sharedPreferences.getBoolean(KEY_WECHAT_SCAN,false));
    sendBroadcast(intent);
  }
 else   if (key.equals(KEY_CONTEXT_SETTINGS)) {
    boolean enable=sharedPreferences.getBoolean(KEY_CONTEXT_SETTINGS,true);
    Intent intent=new Intent(ContextSettingsService.ACTION_CONTEXT_SETTINGS);
    intent.putExtra(ContextSettingsService.KEY_ENABLE,enable);
    sendBroadcast(intent);
    Log.d(TAG,"String_Node_Str" + enable);
  }
 else   if (key.equals(KEY_STATUS_COLOR)) {
    int color=sharedPreferences.getInt(KEY_STATUS_COLOR,Color.TRANSPARENT);
    if (color == Color.TRANSPARENT) {
      color=getResources().getColor(R.color.default_dark_actionbar);
    }
    Intent statusbarIntent=new Intent(XPhoneStatusBar.ACTION_CHANGE_STATUS_BAR);
    statusbarIntent.putExtra("String_Node_Str",color);
    sendBroadcast(statusbarIntent);
  }
  updateX2oolsPrefs();
}
Program: 37734
Project: 37734
Buggy source:
@Override public void onCreate(){
  Mocks.sModuleMap.put("String_Node_Str",ViewDebugMocker.class);
  startService(new Intent(this,ContextSettingsService.class));
  super.onCreate();
}

Fixed version (ground truth):
@Override public void onCreate(){
  initX2oolsDir();
  Mocks.sModuleMap.put("String_Node_Str",ViewDebugMocker.class);
  startService(new Intent(this,ContextSettingsService.class));
  super.onCreate();
}
Program: 37735
Project: 37735
Buggy source:
private void loadFromDiskLocked(){
  if (mLoaded) {
    return;
  }
  try {
    File jsonFile=new File(Environment.getExternalStorageDirectory() + "String_Node_Str");
    if (jsonFile.exists()) {
      InputStreamReader isr=new InputStreamReader(new FileInputStream(jsonFile));
      BufferedReader bufferedReader=new BufferedReader(isr);
      String receiveString="String_Node_Str";
      StringBuilder stringBuilder=new StringBuilder();
      while ((receiveString=bufferedReader.readLine()) != null) {
        stringBuilder.append(receiveString);
      }
      json=new JSONObject(stringBuilder.toString());
      bufferedReader.close();
    }
 else {
      json=new JSONObject();
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  JSONException e) {
    e.printStackTrace();
  }
  mLoaded=true;
  notifyAll();
}

Fixed version (ground truth):
private void loadFromDiskLocked(){
  if (mLoaded) {
    return;
  }
  try {
    if (mFile.exists()) {
      InputStreamReader isr=new InputStreamReader(new FileInputStream(mFile));
      BufferedReader bufferedReader=new BufferedReader(isr);
      String receiveString="String_Node_Str";
      StringBuilder stringBuilder=new StringBuilder();
      while ((receiveString=bufferedReader.readLine()) != null) {
        stringBuilder.append(receiveString);
      }
      json=new JSONObject(stringBuilder.toString());
      bufferedReader.close();
    }
 else {
      json=new JSONObject();
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  JSONException e) {
    e.printStackTrace();
  }
  mLoaded=true;
  notifyAll();
}
Program: 37736
Project: 37736
Buggy source:
public X2oolsSharedPreferences(){
  mFile=new File(Environment.getExternalStorageDirectory(),"String_Node_Str" + "String_Node_Str");
  startLoadFromDisk();
}

Fixed version (ground truth):
public X2oolsSharedPreferences(){
  mFile=new File(X2oolsApplication.X2OOLS_PREFS);
  startLoadFromDisk();
}
Program: 37737
Project: 37737
Buggy source:
public static void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
  if (!lpparam.packageName.equals(PACKAGE_NAME))   return;
  x2ools_prefs=new X2oolsSharedPreferences();
  Class<?> quickSettingsClass=XposedHelpers.findClass(CLASS_QUICK_SETTINGS,lpparam.classLoader);
  Class<?> phoneStatusBarClass=XposedHelpers.findClass(CLASS_PHONE_STATUSBAR,lpparam.classLoader);
  Class<?> panelBarClass=XposedHelpers.findClass(CLASS_PANEL_BAR,lpparam.classLoader);
  XposedBridge.hookAllConstructors(quickSettingsClass,quickSettingsConstructHook);
  XposedHelpers.findAndHookMethod(quickSettingsClass,"String_Node_Str",panelBarClass,quickSettingsSetBarHook);
  XposedHelpers.findAndHookMethod(quickSettingsClass,"String_Node_Str",phoneStatusBarClass,quickSettingsSetServiceHook);
  XposedHelpers.findAndHookMethod(quickSettingsClass,"String_Node_Str",ViewGroup.class,LayoutInflater.class,quickSettingsAddSystemTilesHook);
}

Fixed version (ground truth):
public static void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
  if (!lpparam.packageName.equals(PACKAGE_NAME))   return;
  x2ools_prefs=new X2oolsSharedPreferences();
  Class<?> quickSettingsClass=null;
  Class<?> phoneStatusBarClass=null;
  Class<?> panelBarClass=null;
  try {
    quickSettingsClass=XposedHelpers.findClass(CLASS_QUICK_SETTINGS,lpparam.classLoader);
    phoneStatusBarClass=XposedHelpers.findClass(CLASS_PHONE_STATUSBAR,lpparam.classLoader);
    panelBarClass=XposedHelpers.findClass(CLASS_PANEL_BAR,lpparam.classLoader);
  }
 catch (  Throwable t) {
    XposedBridge.log(t);
  }
  try {
    XposedBridge.hookAllConstructors(quickSettingsClass,quickSettingsConstructHook);
  }
 catch (  Throwable t) {
    XposedBridge.log(t);
  }
  try {
    XposedHelpers.findAndHookMethod(quickSettingsClass,"String_Node_Str",panelBarClass,quickSettingsSetBarHook);
  }
 catch (  Throwable t) {
    XposedBridge.log(t);
  }
  try {
    XposedHelpers.findAndHookMethod(quickSettingsClass,"String_Node_Str",phoneStatusBarClass,quickSettingsSetServiceHook);
  }
 catch (  Throwable t) {
    XposedBridge.log(t);
  }
  try {
    XposedHelpers.findAndHookMethod(quickSettingsClass,"String_Node_Str",ViewGroup.class,LayoutInflater.class,quickSettingsAddSystemTilesHook);
  }
 catch (  Throwable t) {
    XposedBridge.log(t);
  }
}
Program: 37738
Project: 37738
Buggy source:
public static void initZygote(StartupParam startupParam) throws Throwable {
  Class<?> ActionBarContainerClass=XposedHelpers.findClass("String_Node_Str",null);
  XposedHelpers.findAndHookMethod(ActionBarContainerClass,"String_Node_Str",Drawable.class,new XC_MethodHook(){
    @Override protected void afterHookedMethod(    MethodHookParam param) throws Throwable {
      X2oolsSharedPreferences prefs=new X2oolsSharedPreferences();
      int tintColor=prefs.getInt(X2oolsActivity.KEY_STATUS_COLOR,Color.TRANSPARENT);
      if (tintColor == Color.TRANSPARENT) {
        Activity activity=(Activity)((View)param.thisObject).getContext();
        XSystemUI.changeColorAuto(activity,true);
      }
    }
  }
);
}

Fixed version (ground truth):
public static void initZygote(StartupParam startupParam) throws Throwable {
  Class<?> ActionBarContainerClass=XposedHelpers.findClass("String_Node_Str",null);
  try {
    XposedHelpers.findAndHookMethod(ActionBarContainerClass,"String_Node_Str",Drawable.class,setPrimaryBackgroundHook);
  }
 catch (  Throwable t) {
    XposedBridge.log(t);
  }
}
Program: 37739
Project: 37739
Buggy source:
@Override protected void afterHookedMethod(MethodHookParam param) throws Throwable {
  X2oolsSharedPreferences prefs=new X2oolsSharedPreferences();
  int tintColor=prefs.getInt(X2oolsActivity.KEY_STATUS_COLOR,Color.TRANSPARENT);
  if (tintColor == Color.TRANSPARENT) {
    Activity activity=(Activity)((View)param.thisObject).getContext();
    XSystemUI.changeColorAuto(activity,true);
  }
}

Fixed version (ground truth):
@Override protected void afterHookedMethod(MethodHookParam param) throws Throwable {
  X2oolsSharedPreferences prefs=new X2oolsSharedPreferences();
  int tintColor=prefs.getInt(X2oolsActivity.KEY_STATUS_COLOR,Color.TRANSPARENT);
  if (tintColor == Color.TRANSPARENT) {
    Activity activity=(Activity)((View)param.thisObject).getContext();
    XPhoneStatusBar.changeColorAuto(activity,true);
  }
}
Program: 37740
Project: 37740
Buggy source:
@Override protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
  mContext=(Context)XposedHelpers.getObjectField(param.thisObject,"String_Node_Str");
  X2oolsSharedPreferences prefs=new X2oolsSharedPreferences();
  boolean t9_search=prefs.getBoolean(X2oolsActivity.KEY_T9_SEARCH,true);
  if (t9_search) {
    Intent intent=new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.setClassName("String_Node_Str","String_Node_Str");
    mContext.startActivity(intent);
  }
 else {
    XposedBridge.invokeOriginalMethod(param.method,param.thisObject,param.args);
  }
  return null;
}

Fixed version (ground truth):
@Override protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
  mContext=(Context)XposedHelpers.getObjectField(param.thisObject,"String_Node_Str");
  X2oolsSharedPreferences prefs=new X2oolsSharedPreferences();
  boolean t9_search=prefs.getBoolean(X2oolsActivity.KEY_T9_SEARCH,true);
  if (t9_search) {
    ActivityManager am=(ActivityManager)mContext.getSystemService(Context.ACTIVITY_SERVICE);
    if (am.getRunningTasks(1).get(0).topActivity.getClassName().equals("String_Node_Str"))     return null;
    Intent intent=new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.setClassName("String_Node_Str","String_Node_Str");
    mContext.startActivity(intent);
  }
 else {
    XposedBridge.invokeOriginalMethod(param.method,param.thisObject,param.args);
  }
  return null;
}
Program: 37741
Project: 37741
Buggy source:
public AppsGridView(Context context,AttributeSet attrs){
  super(context,attrs);
  mContext=context;
  mPackageManager=context.getPackageManager();
  mActivityManager=(ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
  mLayoutInflater=LayoutInflater.from(context);
  setApplicationsData();
  new Thread(new Runnable(){
    @Override public void run(){
      sT9Search=new T9Search(mContext);
    }
  }
).start();
}

Fixed version (ground truth):
public AppsGridView(Context context,AttributeSet attrs){
  super(context,attrs);
  mContext=context;
  mPackageManager=context.getPackageManager();
  mActivityManager=(ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
  mLayoutInflater=LayoutInflater.from(context);
  setApplicationsData();
  new Thread(new Runnable(){
    @Override public void run(){
      sT9Search=new T9Search(mContext);
      mHandler.sendEmptyMessage(MSG_SEARCH_INITED);
    }
  }
).start();
}
Program: 37742
Project: 37742
Buggy source:
@Override public void run(){
  sT9Search=new T9Search(mContext);
}

Fixed version (ground truth):
@Override public void run(){
  sT9Search=new T9Search(mContext);
  mHandler.sendEmptyMessage(MSG_SEARCH_INITED);
}