nus-yam/ex-repair huggingface dataset:
Program: 44992
Project: 44992
Buggy source:
/** 
 * Sets the file that is to be viewed. This method will automatically be called after a file viewer is created and should not be called directly.
 */
public final void setCurrentFile(AbstractFile file){
  this.file=file;
}

Fixed version (ground truth):
/** 
 * Sets the file that is to be viewed. This method will automatically be called after a file viewer is created and should not be called directly.
 * @param file file that is to be viewed.
 */
public final void setCurrentFile(AbstractFile file){
  this.file=file;
}
Program: 44993
Project: 44993
Buggy source:
/** 
 * Registers a FileViewer.
 */
public static void registerFileViewer(ViewerFactory factory){
  viewerFactories.add(factory);
}

Fixed version (ground truth):
/** 
 * Registers a FileViewer.
 * @param factory file viewer factory to register.
 */
public static void registerFileViewer(ViewerFactory factory){
  viewerFactories.add(factory);
}
Program: 44994
Project: 44994
Buggy source:
/** 
 * Removes the specified VectorChangeListener from the list of registered listeners.
 * @param listener the VectorChangeListener to remove from the list of registered listeners.
 */
public void removeVectorChangeListener(VectorChangeListener listener){
  listeners.remove(listener);
}

Fixed version (ground truth):
/** 
 * Removes the specified VectorChangeListener from the list of registered listeners.
 * @param listener the VectorChangeListener to remove from the list of registered listeners.
 * @see #addVectorChangeListener(VectorChangeListener)
 */
public void removeVectorChangeListener(VectorChangeListener listener){
  listeners.remove(listener);
}
Program: 44995
Project: 44995
Buggy source:
/** 
 * Adds the specified VectorChangeListener to the list of registered listeners. <p>Listeners are stored as weak references so   {@link #removeVectorChangeListener(VectorChangeListener)}doesn't need to be called for listeners to be garbage collected when they're not used anymore.</p>
 * @param listener the VectorChangeListener to add to the list of registered listeners.
 */
public void addVectorChangeListener(VectorChangeListener listener){
  listeners.put(listener,null);
}

Fixed version (ground truth):
/** 
 * Adds the specified VectorChangeListener to the list of registered listeners. <p>Listeners are stored as weak references so   {@link #removeVectorChangeListener(VectorChangeListener)}doesn't need to be called for listeners to be garbage collected when they're not used anymore.</p>
 * @param listener the VectorChangeListener to add to the list of registered listeners.
 * @see #removeVectorChangeListener(VectorChangeListener)
 */
public void addVectorChangeListener(VectorChangeListener listener){
  listeners.put(listener,null);
}
Program: 44996
Project: 44996
Buggy source:
/** 
 * Forces CustomDateFormat to update the date format by looking it up in the preferences.
 */
public static void updateDateFormat(){
  dateFormat=createDateFormat();
}

Fixed version (ground truth):
/** 
 * Forces CustomDateFormat to update the date format by looking it up in the preferences.
 */
public static synchronized void updateDateFormat(){
  dateFormat=createDateFormat();
}
Program: 44997
Project: 44997
Buggy source:
/** 
 * Listens to some configuration variables.
 */
public void configurationChanged(ConfigurationEvent event){
  String var=event.getVariable();
  if (var.equals(MuConfiguration.TIME_FORMAT) || var.equals(MuConfiguration.DATE_FORMAT) || var.equals(MuConfiguration.DATE_SEPARATOR))   dateFormat=createDateFormat();
}

Fixed version (ground truth):
/** 
 * Listens to some configuration variables.
 */
public void configurationChanged(ConfigurationEvent event){
  String var=event.getVariable();
  if (var.equals(MuConfiguration.TIME_FORMAT) || var.equals(MuConfiguration.DATE_FORMAT) || var.equals(MuConfiguration.DATE_SEPARATOR))   updateDateFormat();
}
Program: 44999
Project: 44999
Buggy source:
/** 
 * Determines the current value by parsing the corresponding system property. This method is called automatically by this class the first time the current value is accessed. However, this method has been made public to allow to force the initialization if it needs to happen at a predictable time.
 */
public static void init(){
  if (currentValue == null) {
    currentValue=parseSystemProperty(getRawSystemProperty(),OsFamily.getCurrent());
    if (Debug.ON)     Debug.trace("String_Node_Str" + currentValue);
  }
}

Fixed version (ground truth):
/** 
 * Determines the current value by parsing the corresponding system property. This method is called automatically by this class the first time the current value is accessed. However, this method has been made public to allow to force the initialization if it needs to happen at a predictable time.
 */
public static void init(){
  if (currentValue == null) {
    currentValue=parseSystemProperty(getRawSystemProperty(),OsFamily.getRawSystemProperty(),OsFamily.getCurrent());
    if (Debug.ON)     Debug.trace("String_Node_Str" + currentValue);
  }
}
Program: 45000
Project: 45000
Buggy source:
/** 
 * Stops the current stress test.
 */
public static void stop(){
  stressThread=null;
}

Fixed version (ground truth):
/** 
 * Stops the current stress test.
 */
public void stop(){
  run=false;
}
Program: 45001
Project: 45001
Buggy source:
public void run(){
  Random random=new Random();
  MainFrame mainFrame=WindowManager.getCurrentMainFrame();
  while (stressThread != null) {
    if (random.nextInt(2) == 0)     ActionManager.performAction(com.mucommander.ui.action.SwitchActiveTableAction.class,mainFrame);
    FileTable fileTable=mainFrame.getActiveTable();
    AbstractFile currentFolder=fileTable.getCurrentFolder();
    try {
      AbstractFile parentFolder=currentFolder.getParent();
      AbstractFile children[]=currentFolder.ls();
      if (children.length == 0 || (random.nextInt(3) == 0 && parentFolder != null)) {
        fileTable.selectRow(0);
        ActionManager.performAction(com.mucommander.ui.action.OpenAction.class,mainFrame);
      }
 else {
        AbstractFile randomChild=children[random.nextInt(children.length)];
        if (!randomChild.isBrowsable())         continue;
        randomChild.ls();
        fileTable.selectFile(randomChild);
        ActionManager.performAction(com.mucommander.ui.action.OpenAction.class,mainFrame);
      }
    }
 catch (    Exception e) {
      if (com.mucommander.Debug.ON)       com.mucommander.Debug.trace("String_Node_Str" + e);
    }
    if (com.mucommander.Debug.ON)     com.mucommander.Debug.trace("String_Node_Str");
    try {
      stressThread.sleep(100 + random.nextInt(200));
    }
 catch (    InterruptedException e) {
      if (com.mucommander.Debug.ON)       com.mucommander.Debug.trace("String_Node_Str" + e);
    }
  }
}

Fixed version (ground truth):
public void run(){
  Random random=new Random();
  MainFrame mainFrame=WindowManager.getCurrentMainFrame();
  while (run) {
    if (random.nextInt(2) == 0)     ActionManager.performAction(com.mucommander.ui.action.SwitchActiveTableAction.class,mainFrame);
    FileTable fileTable=mainFrame.getActiveTable();
    AbstractFile currentFolder=fileTable.getCurrentFolder();
    try {
      AbstractFile parentFolder=currentFolder.getParent();
      AbstractFile children[]=currentFolder.ls();
      if (children.length == 0 || (random.nextInt(3) == 0 && parentFolder != null)) {
        fileTable.selectRow(0);
        ActionManager.performAction(com.mucommander.ui.action.OpenAction.class,mainFrame);
      }
 else {
        AbstractFile randomChild=children[random.nextInt(children.length)];
        if (!randomChild.isBrowsable())         continue;
        randomChild.ls();
        fileTable.selectFile(randomChild);
        ActionManager.performAction(com.mucommander.ui.action.OpenAction.class,mainFrame);
      }
    }
 catch (    Exception e) {
      if (com.mucommander.Debug.ON)       com.mucommander.Debug.trace("String_Node_Str" + e);
    }
    if (com.mucommander.Debug.ON)     com.mucommander.Debug.trace("String_Node_Str");
    try {
      Thread.currentThread().sleep(100 + random.nextInt(200));
    }
 catch (    InterruptedException e) {
      if (com.mucommander.Debug.ON)       com.mucommander.Debug.trace("String_Node_Str" + e);
    }
  }
}
Program: 45002
Project: 45002
Buggy source:
/** 
 * Method used to start the stress tester.
 * @param args command line arguments.
 */
public static void main(String args[]){
  Launcher.main(args);
  StressTester instance=new StressTester();
  JDialog stopDialog=new JDialog();
  JButton stopButton=new JButton("String_Node_Str");
  stopButton.addActionListener(instance);
  stopDialog.getContentPane().add(stopButton);
  stopDialog.setSize(new Dimension(80,60));
  stopDialog.setVisible(true);
}

Fixed version (ground truth):
/** 
 * Method used to start the stress tester.
 * @param args command line arguments.
 */
public static void main(String args[]){
  Launcher.main(args);
  StressTester instance=new StressTester();
  JDialog stopDialog=new JDialog();
  JButton stopButton=new JButton("String_Node_Str");
  new Thread(instance).start();
  stopButton.addActionListener(instance);
  stopDialog.getContentPane().add(stopButton);
  stopDialog.setSize(new Dimension(80,60));
  stopDialog.setVisible(true);
}
Program: 45003
Project: 45003
Buggy source:
public StressTester(){
  (stressThread=new Thread(this)).start();
}

Fixed version (ground truth):
public StressTester(){
  run=true;
}
Program: 45004
Project: 45004
Buggy source:
/** 
 * Initialises the tabbed panel's UI.
 */
private void initUI(){
  Container contentPane;
  XBoxPanel buttonsPanel;
  JPanel tempPanel;
  prefPanels=new Vector();
  tabbedPane=new JTabbedPane(JTabbedPane.TOP);
  tabbedPane.addChangeListener(this);
  contentPane=getContentPane();
  contentPane.setLayout(new BorderLayout());
  contentPane.add(tabbedPane,BorderLayout.CENTER);
  buttonsPanel=new XBoxPanel();
  buttonsPanel.add(applyButton=new JButton(Translator.get("String_Node_Str")));
  buttonsPanel.addSpace(20);
  buttonsPanel.add(okButton=new JButton(Translator.get("String_Node_Str")));
  buttonsPanel.add(cancelButton=new JButton(Translator.get("String_Node_Str")));
  applyButton.addActionListener(this);
  okButton.addActionListener(this);
  cancelButton.addActionListener(this);
  tempPanel=new JPanel(new FlowLayout(FlowLayout.RIGHT));
  tempPanel.add(buttonsPanel);
  contentPane.add(tempPanel,BorderLayout.SOUTH);
  getRootPane().setDefaultButton(okButton);
}

Fixed version (ground truth):
/** 
 * Initialises the tabbed panel's UI.
 */
private void initUI(){
  Container contentPane;
  XBoxPanel buttonsPanel;
  JPanel tempPanel;
  prefPanels=new Vector();
  tabbedPane=new JTabbedPane(JTabbedPane.TOP);
  contentPane=getContentPane();
  contentPane.setLayout(new BorderLayout());
  contentPane.add(tabbedPane,BorderLayout.CENTER);
  buttonsPanel=new XBoxPanel();
  buttonsPanel.add(applyButton=new JButton(Translator.get("String_Node_Str")));
  buttonsPanel.addSpace(20);
  buttonsPanel.add(okButton=new JButton(Translator.get("String_Node_Str")));
  buttonsPanel.add(cancelButton=new JButton(Translator.get("String_Node_Str")));
  applyButton.addActionListener(this);
  okButton.addActionListener(this);
  cancelButton.addActionListener(this);
  tempPanel=new JPanel(new FlowLayout(FlowLayout.RIGHT));
  tempPanel.add(buttonsPanel);
  contentPane.add(tempPanel,BorderLayout.SOUTH);
  getRootPane().setDefaultButton(okButton);
}
Program: 45005
Project: 45005
Buggy source:
/** 
 * Commits the changes and writes the configuration file if necessary.
 */
public void commit(){
  super.commit();
  try {
    MuConfiguration.write();
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
/** 
 * Commits the changes and writes the configuration file if necessary.
 */
public void commit(){
  super.commit();
  try {
    MuConfiguration.write();
  }
 catch (  Exception e) {
    JOptionPane.showMessageDialog(this,Translator.get("String_Node_Str"),Translator.get("String_Node_Str"),JOptionPane.ERROR_MESSAGE);
  }
}
Program: 45006
Project: 45006
Buggy source:
/** 
 * Releases the singleton.
 */
public void dispose(){
synchronized (singletonLock) {
    singleton=null;
  }
  super.dispose();
}

Fixed version (ground truth):
/** 
 * Releases the singleton.
 */
public void dispose(){
  releaseSingleton(getSelectedPanelIndex());
  super.dispose();
}
Program: 45007
Project: 45007
Buggy source:
/** 
 * Returns an instance of <code>GeneralPreferencesDialog</code>. <p> This will not necessarily create a new instance - if a dialog is already in use, it will be returned. This is an attempt to ensure that the preferences dialog is not opened more than once. </p>
 * @return an instance of <code>GeneralPreferencesDialog</code>.
 */
public static GeneralPreferencesDialog getDialog(){
synchronized (singletonLock) {
    if (singleton == null)     singleton=new GeneralPreferencesDialog();
    return singleton;
  }
}

Fixed version (ground truth):
/** 
 * Returns an instance of <code>GeneralPreferencesDialog</code>. <p> This will not necessarily create a new instance - if a dialog is already in use, it will be returned. This is an attempt to ensure that the preferences dialog is not opened more than once. </p>
 * @return an instance of <code>GeneralPreferencesDialog</code>.
 */
public static synchronized GeneralPreferencesDialog getDialog(){
  if (singleton == null)   singleton=new GeneralPreferencesDialog();
  return singleton;
}
Program: 45008
Project: 45008
Buggy source:
protected RuntimeProperty getCurrentValue(){
  return currentValue;
}

Fixed version (ground truth):
protected RuntimeProperty getCurrentValue(){
  return getCurrent();
}
Program: 45009
Project: 45009
Buggy source:
protected RuntimeProperty getCurrentValue(){
  return currentValue;
}

Fixed version (ground truth):
protected RuntimeProperty getCurrentValue(){
  return getCurrent();
}
Program: 45010
Project: 45010
Buggy source:
/** 
 * Returns <code>true</code> if the specified class must be used.
 * @return <code>true</code> if the specified class must be used, <code>false</code> otherwise.
 */
public boolean accept(Class c);

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if the specified class must be used.
 * @param c class that must be evaluated.
 * @return   <code>true</code> if the specified class must be used, <code>false</code> otherwise.
 */
public boolean accept(Class c);
Program: 45011
Project: 45011
Buggy source:
/** 
 * Explores the content of the specified file and looks for classes that match the specified class filter, <p> This is a convenience method and is strictly equivalent to calling   {@link #find(AbstractFile,ClassFilter,ClassLoader)}with a class loader argument initialised with the following code: <pre> AbstractFileClassLoader loader; loader = new AbstractFileClassLoader(); loader.addFile(browsable); </pre> </p>
 * @param browsable   file in which to look for classes.
 * @param classFilter how to decide which classes should be kept.
 * @return             a vector containing the names of all the classes that were found and matched <code>classFilter</code>.
 * @throws IOException if an error occurs while exploring <code>browsable</code>.
 */
public Vector find(AbstractFile browsable,ClassFilter classFilter) throws IOException {
  AbstractFileClassLoader classLoader;
  classLoader=new AbstractFileClassLoader();
  classLoader.addFile(browsable);
  return find(browsable,classFilter,classLoader);
}

Fixed version (ground truth):
/** 
 * Explores the content of the specified file and looks for classes that match the specified class filter. <p> This is a convenience method and is strictly equivalent to calling   {@link #find(AbstractFile,ClassFilter,ClassLoader)}with a class loader argument initialised with the following code: <pre> AbstractFileClassLoader loader; loader = new AbstractFileClassLoader(); loader.addFile(browsable); </pre> </p>
 * @param browsable   file in which to look for classes.
 * @param classFilter how to decide which classes should be kept.
 * @return             a vector containing the names of all the classes that were found and matched <code>classFilter</code>.
 * @throws IOException if an error occurs while exploring <code>browsable</code>.
 */
public Vector find(AbstractFile browsable,ClassFilter classFilter) throws IOException {
  AbstractFileClassLoader classLoader;
  classLoader=new AbstractFileClassLoader();
  classLoader.addFile(browsable);
  return find(browsable,classFilter,classLoader);
}
Program: 45012
Project: 45012
Buggy source:
/** 
 * Returns <code>true</code> if the specified file is either in the extension or system classpath. <p> This is a convenience method and is equivalent to calling: <code>  {@link #isInClasspath(AbstractFile) isInClasspath}(file) ||   {@link #isInExtensionsPath(AbstractFile) isInExtensionsPath}(file)</code>. </p>
 * @param file file whose availability will be checked.
 */
public static boolean isAvailable(AbstractFile file){
  return isInClasspath(file) || isInExtensionsPath(file);
}

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if the specified file is either in the extension or system classpath. <p> This is a convenience method and is equivalent to calling: <code>  {@link #isInClasspath(AbstractFile) isInClasspath}(file) ||   {@link #isInExtensionsPath(AbstractFile) isInExtensionsPath}(file)</code>. </p>
 * @param file file whose availability will be checked.
 * @return <code>true</code> if the specified file is either in the extension or system classpath, <code>false</code> otherwise.
 */
public static boolean isAvailable(AbstractFile file){
  return isInClasspath(file) || isInExtensionsPath(file);
}
Program: 45013
Project: 45013
Buggy source:
/** 
 * Returns the folder in which all extensions are stored.
 * @return             the folder in which all extensions are stored.
 * @throws IOException if an error occured while locating the default extensions folder.
 */
public static AbstractFile getExtensionsFolder() throws IOException {
  if (extensionsFolder != null)   return extensionsFolder;
  return getDefaultExtensionsFolder();
}

Fixed version (ground truth):
/** 
 * Returns the folder in which all extensions are stored.
 * @return             the folder in which all extensions are stored.
 * @throws IOException if an error occured while locating the default extensions folder.
 * @see #setExtensionsFolder(AbstractFile)
 */
public static AbstractFile getExtensionsFolder() throws IOException {
  if (extensionsFolder != null)   return extensionsFolder;
  return getDefaultExtensionsFolder();
}
Program: 45014
Project: 45014
Buggy source:
public static boolean importLibrary(AbstractFile file,boolean force) throws IOException {
  AbstractFile dest;
  if (isAvailable(file))   return true;
  dest=getExtensionsFolder().getDirectChild(file.getName());
  if (dest.exists()) {
    if (!force)     return false;
    dest.delete();
  }
  file.copyTo(dest);
  addToClassPath(dest);
  return true;
}

Fixed version (ground truth):
/** 
 * Imports the specified file in muCommander's libraries.
 * @param file  path to the library to import.
 * @param force       wether to overwrite eventual existing libraries of the same name.
 * @return             <code>true</code> if the operation was a success,<code>false</code> if a library of the same name already exists and <code>force</code> is set to <code>false</code>.
 * @throws IOException if an I/O error occurs.
 */
public static boolean importLibrary(AbstractFile file,boolean force) throws IOException {
  AbstractFile dest;
  if (isAvailable(file))   return true;
  dest=getExtensionsFolder().getDirectChild(file.getName());
  if (dest.exists()) {
    if (!force)     return false;
    dest.delete();
  }
  file.copyTo(dest);
  addToClassPath(dest);
  return true;
}
Program: 45015
Project: 45015
Buggy source:
/** 
 * Returns <code>true</code> if this process only uses one output stream. <p> Some processes will use a single stream for their standard error and standard output streams. Such processes should return <code>true</code> here to prevent both streams from being monitored.<br/> Note that if a process uses merged streams,   {@link #getInputStream()} will be monitored.</p>
 * @return <code>true</code> if this process merges his output streams, <code>false</code> otherwise.
 */
public abstract boolean usesMergedStreams();

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if this process only uses one output stream. <p> Some processes will use a single stream for their standard error and standard output streams. Such processes should return <code>true</code> here to prevent both streams from being monitored.<br> Note that if a process uses merged streams,   {@link #getInputStream()} will be monitored.</p>
 * @return <code>true</code> if this process merges his output streams, <code>false</code> otherwise.
 */
public abstract boolean usesMergedStreams();
Program: 45016
Project: 45016
Buggy source:
/** 
 * Loads the shell history.
 */
public static void loadHistory() throws Exception {
  BackupInputStream in;
  in=null;
  try {
    ShellHistoryReader.read(in=new BackupInputStream(getHistoryFile()));
  }
  finally {
    if (in != null) {
      try {
        in.close();
      }
 catch (      Exception e2) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Loads the shell history.
 * @throws Exception if an error occurs.
 */
public static void loadHistory() throws Exception {
  BackupInputStream in;
  in=null;
  try {
    ShellHistoryReader.read(in=new BackupInputStream(getHistoryFile()));
  }
  finally {
    if (in != null) {
      try {
        in.close();
      }
 catch (      Exception e2) {
      }
    }
  }
}
Program: 45017
Project: 45017
Buggy source:
/** 
 * Returns a <b>non thread-safe</code> iterator on the history.
 * @return an iterator on the history.
 */
public static Iterator getHistoryIterator(){
  return new HistoryIterator();
}

Fixed version (ground truth):
/** 
 * Returns a <b>non thread-safe</b> iterator on the history.
 * @return an iterator on the history.
 */
public static Iterator getHistoryIterator(){
  return new HistoryIterator();
}
Program: 45018
Project: 45018
Buggy source:
/** 
 * Returns the path to the shell history file. <p> This method cannot guarantee the file's existence, and it's up to the caller to deal with the fact that the user might not actually have created a history file yet. </p> <p> This method's return value can be modified through   {@link #setHistoryFile(String)}. If this wasn't called, the default path will be used:   {@link #DEFAULT_HISTORY_FILE_NAME}in the   {@link com.mucommander.PlatformManager#getPreferencesFolder() preferences} folder.</p>
 * @return             the path to the shell history file.
 * @throws IOException if an error occured while locating the default shell history file.
 */
public static AbstractFile getHistoryFile() throws IOException {
  if (historyFile == null)   return PlatformManager.getPreferencesFolder().getChild(DEFAULT_HISTORY_FILE_NAME);
  return historyFile;
}

Fixed version (ground truth):
/** 
 * Returns the path to the shell history file. <p> This method cannot guarantee the file's existence, and it's up to the caller to deal with the fact that the user might not actually have created a history file yet. </p> <p> This method's return value can be modified through   {@link #setHistoryFile(String)}. If this wasn't called, the default path will be used:   {@link #DEFAULT_HISTORY_FILE_NAME}in the   {@link com.mucommander.PlatformManager#getPreferencesFolder() preferences} folder.</p>
 * @return             the path to the shell history file.
 * @throws IOException if an error occured while locating the default shell history file.
 * @see #setHistoryFile(File)
 * @see #setHistoryFile(String)
 * @see #setHistoryFile(AbstractFile)
 */
public static AbstractFile getHistoryFile() throws IOException {
  if (historyFile == null)   return PlatformManager.getPreferencesFolder().getChild(DEFAULT_HISTORY_FILE_NAME);
  return historyFile;
}
Program: 45019
Project: 45019
Buggy source:
/** 
 * Sets the path of the shell history file.
 * @param file                  where to load the shell history from.
 * @exception FileNotFoundException if <code>path</code> is not accessible.
 */
public static void setHistoryFile(AbstractFile file) throws FileNotFoundException {
  if (file.isBrowsable())   throw new FileNotFoundException("String_Node_Str" + file.getAbsolutePath());
  historyFile=file;
}

Fixed version (ground truth):
/** 
 * Sets the path of the shell history file.
 * @param file                  where to load the shell history from.
 * @exception FileNotFoundException if <code>path</code> is not accessible.
 * @see #getHistoryFile()
 * @see #setHistoryFile(File)
 * @see #setHistoryFile(String)
 */
public static void setHistoryFile(AbstractFile file) throws FileNotFoundException {
  if (file.isBrowsable())   throw new FileNotFoundException("String_Node_Str" + file.getAbsolutePath());
  historyFile=file;
}
Program: 45020
Project: 45020
Buggy source:
public void actionPerformed(ActionEvent e){
  Object source=e.getSource();
  if (source == okButton || source == applyButton) {
    if (!checkCommit())     return;
    commit();
  }
  if (source == okButton || source == cancelButton)   dispose();
}

Fixed version (ground truth):
/** 
 * Reacts to buttons being pushed.
 */
public void actionPerformed(ActionEvent e){
  Object source=e.getSource();
  if (source == okButton || source == applyButton) {
    if (!checkCommit())     return;
    commit();
  }
  if (source == okButton || source == cancelButton)   dispose();
}
Program: 45021
Project: 45021
Buggy source:
public boolean checkCommit(){
  int nbPanels=prefPanels.size();
  for (int i=0; i < nbPanels; i++)   if (!((PreferencesPanel)prefPanels.elementAt(i)).checkCommit())   return false;
  return true;
}

Fixed version (ground truth):
/** 
 * Notifies all panels that changes are about to be commited. <p> This gives preference panels a chance to display warning or errors before changes are commited. </p>
 * @return <code>true</code> if all preference panels are ok with commiting the changes, <code>false</code> otherwise.
 */
public boolean checkCommit(){
  int nbPanels=prefPanels.size();
  for (int i=0; i < nbPanels; i++)   if (!((PreferencesPanel)prefPanels.elementAt(i)).checkCommit())   return false;
  return true;
}
Program: 45022
Project: 45022
Buggy source:
public PreferencesDialog(Dialog parent,String title){
  super(parent,title,parent);
  initUI();
}

Fixed version (ground truth):
/** 
 * Creates a new preferences dialog.
 * @param parent parent of the dialog.
 * @param title  title of the dialg.
 */
public PreferencesDialog(Dialog parent,String title){
  super(parent,title,parent);
  initUI();
}
Program: 45023
Project: 45023
Buggy source:
public void tabSelectionChanged(int newIndex){
}

Fixed version (ground truth):
/** 
 * Ignored.
 * @param newIndex ignored.
 */
public void tabSelectionChanged(int newIndex){
}
Program: 45024
Project: 45024
Buggy source:
public void addPreferencesPanel(PreferencesPanel prefPanel){
  addPreferencesPanel(prefPanel,true);
}

Fixed version (ground truth):
/** 
 * Adds the specified preferences panel to this dialog.
 * @param prefPanel panel to add.
 */
public void addPreferencesPanel(PreferencesPanel prefPanel){
  addPreferencesPanel(prefPanel,true);
}
Program: 45025
Project: 45025
Buggy source:
/** 
 * Sets the currently active tab.
 */
public void setActiveTab(int index){
  tabbedPane.setSelectedIndex(index);
}

Fixed version (ground truth):
/** 
 * Sets the currently active tab.
 * @param index index of the tab to select.
 */
public void setActiveTab(int index){
  tabbedPane.setSelectedIndex(index);
}
Program: 45026
Project: 45026
Buggy source:
public void stateChanged(ChangeEvent e){
  if (e.getSource() == tabbedPane)   tabSelectionChanged(tabbedPane.getSelectedIndex());
}

Fixed version (ground truth):
/** 
 * Reacts to changes in the panel selection.
 */
public void stateChanged(ChangeEvent e){
  if (e.getSource() == tabbedPane)   tabSelectionChanged(tabbedPane.getSelectedIndex());
}
Program: 45027
Project: 45027
Buggy source:
public String getTitle(){
  return title;
}

Fixed version (ground truth):
/** 
 * Returns the panel's title.
 * @return the panel's title.
 */
public String getTitle(){
  return title;
}
Program: 45028
Project: 45028
Buggy source:
protected boolean checkCommit(){
  return true;
}

Fixed version (ground truth):
/** 
 * Checks whether this panel's data can be commited or whether it contains an error.
 * @return <code>true</code> if the panel's data can be commited, <code>false</code> otherwise.
 */
protected boolean checkCommit(){
  return true;
}
Program: 45029
Project: 45029
Buggy source:
public PreferencesPanel(PreferencesDialog parent,String title){
  this.title=title;
  this.parent=parent;
}

Fixed version (ground truth):
/** 
 * Creates a new preferences panel.
 * @param parent dialog that contains this panel.
 * @param title  panel's title.
 */
public PreferencesPanel(PreferencesDialog parent,String title){
  this.title=title;
  this.parent=parent;
}
Program: 45030
Project: 45030
Buggy source:
public boolean editTheme(){
  showDialog();
  return wasThemeModified;
}

Fixed version (ground truth):
/** 
 * Edits the theme specified at creation time and returns <code>true</code> if it was modified.
 * @return <code>true</code> if the theme was modified by the user, <code>false</code> otherwise.
 */
public boolean editTheme(){
  showDialog();
  return wasThemeModified;
}
Program: 45031
Project: 45031
Buggy source:
public ThemeEditorDialog(Frame parent,Theme theme){
  super(parent,createTitle(theme));
  initUI(theme);
}

Fixed version (ground truth):
/** 
 * Creates a new theme editor dialog.
 * @param parent parent of the dialog.
 * @param theme  theme to edit.
 */
public ThemeEditorDialog(Frame parent,Theme theme){
  super(parent,createTitle(theme));
  initUI(theme);
}
Program: 45032
Project: 45032
Buggy source:
/** 
 * Removes any archive format that might have been registered to the specified extension.
 */
public static void unregisterArchiveFileFormat(ArchiveFormatMapping mapping){
  int index=archiveFormatMappingsV.indexOf(mapping);
  if (index != -1) {
    archiveFormatMappingsV.removeElementAt(index);
    updateArchiveFormatMappingsArray();
  }
}

Fixed version (ground truth):
/** 
 * Removes any archive format that might have been registered to the specified extension.
 * @param mapping archive format mapping to unregister.
 */
public static void unregisterArchiveFileFormat(ArchiveFormatMapping mapping){
  int index=archiveFormatMappingsV.indexOf(mapping);
  if (index != -1) {
    archiveFormatMappingsV.removeElementAt(index);
    updateArchiveFormatMappingsArray();
  }
}
Program: 45033
Project: 45033
Buggy source:
public static void registerArchiveFormat(ArchiveFormatProvider provider,FilenameFilter filter){
  registerArchiveFormat(new ArchiveFormatMapping(provider,filter));
}

Fixed version (ground truth):
/** 
 * Registers a new archive format.
 * @param provider class used to create instances of the new archive format.
 * @param filter   filter that files must match to be considered of the new format.
 */
public static void registerArchiveFormat(ArchiveFormatProvider provider,FilenameFilter filter){
  registerArchiveFormat(new ArchiveFormatMapping(provider,filter));
}
Program: 45034
Project: 45034
Buggy source:
/** 
 * Returns true if the given filename's extension matches one of the registered archive formats.
 * @param filename the filename to test
 */
public static boolean isArchiveFilename(String filename){
  return getArchiveFormatProvider(filename) != null;
}

Fixed version (ground truth):
/** 
 * Returns true if the given filename's extension matches one of the registered archive formats.
 * @param filename the filename to test
 * @return <code>true</code> if the specified filename is a known archive file name, <code>false</code> otherwise.
 */
public static boolean isArchiveFilename(String filename){
  return getArchiveFormatProvider(filename) != null;
}
Program: 45036
Project: 45036
Buggy source:
/** 
 * Sets the protocol part of this FileURL. The specified protocol must not be null.
 */
public void setProtocol(String protocol){
  this.protocol=protocol;
}

Fixed version (ground truth):
/** 
 * Sets the protocol part of this FileURL. The specified protocol must not be null.
 * @param protocol new protocol part for this <code>FileURL</code>.
 * @see #getProtocol()
 */
public void setProtocol(String protocol){
  this.protocol=protocol;
}
Program: 45037
Project: 45037
Buggy source:
/** 
 * Returns the credentials (login and password) contained in this FileURL, wrapped in an   {@link Credentials} object.Returns null if this FileURL doesn't contain any login or password.
 */
public Credentials getCredentials(){
  return credentials;
}

Fixed version (ground truth):
/** 
 * Returns the credentials (login and password) contained in this FileURL, wrapped in an   {@link Credentials} object.Returns null if this FileURL doesn't contain any login or password.
 * @return the credentials contained by this <code>FileURL</code>, <code>null</code> if none.
 * @see #setCredentials(Credentials)
 */
public Credentials getCredentials(){
  return credentials;
}
Program: 45039
Project: 45039
Buggy source:
/** 
 * Sets a custom port, -1 for no custom port (use the protocol's defaut port).
 */
public void setPort(int port){
  this.port=port;
}

Fixed version (ground truth):
/** 
 * Sets a custom port, -1 for no custom port (use the protocol's defaut port).
 * @param port new port for this <code>FileURL</code>.
 * @see #getPort()
 */
public void setPort(int port){
  this.port=port;
}
Program: 45040
Project: 45040
Buggy source:
/** 
 * Copies the properties of the given FileURL into this FileURL.
 */
public void copyProperties(FileURL url){
  Enumeration propertyKeys=url.getPropertyKeys();
  if (propertyKeys != null) {
    String key;
    while (propertyKeys.hasMoreElements()) {
      key=(String)propertyKeys.nextElement();
      setProperty(key,url.getProperty(key));
    }
  }
}

Fixed version (ground truth):
/** 
 * Copies the properties of the given FileURL into this FileURL.
 * @param url url whose properties should be copied.
 */
public void copyProperties(FileURL url){
  Enumeration propertyKeys=url.getPropertyKeys();
  if (propertyKeys != null) {
    String key;
    while (propertyKeys.hasMoreElements()) {
      key=(String)propertyKeys.nextElement();
      setProperty(key,url.getProperty(key));
    }
  }
}
Program: 45041
Project: 45041
Buggy source:
/** 
 * Sets the credentials (login and password) contained by this FileURL. Any credentials contained by this FileURL will be discarded. Null can be passed to discard existing credentials.
 * @param credentials the new credentials to use, replacing any existing credentials. If null is passed, existingcredentials will be discarded. 
 */
public void setCredentials(Credentials credentials){
  if (credentials == null || credentials.isEmpty())   this.credentials=null;
 else   this.credentials=credentials;
}

Fixed version (ground truth):
/** 
 * Sets the credentials (login and password) contained by this FileURL. Any credentials contained by this FileURL will be discarded. Null can be passed to discard existing credentials.
 * @param credentials the new credentials to use, replacing any existing credentials. If null is passed, existingcredentials will be discarded. 
 * @see #getCredentials()
 */
public void setCredentials(Credentials credentials){
  if (credentials == null || credentials.isEmpty())   this.credentials=null;
 else   this.credentials=credentials;
}
Program: 45042
Project: 45042
Buggy source:
/** 
 * Returns true if this FileURL contains credentials. If true is returned,   {@link #getCredentials()}will return a non-null value.
 */
public boolean containsCredentials(){
  return credentials != null;
}

Fixed version (ground truth):
/** 
 * Returns true if this FileURL contains credentials. If true is returned,   {@link #getCredentials()}will return a non-null value.
 * @return <code>true</code> if this <code>FileURL</code> contains credentials, <code>false</code> otherwise.
 */
public boolean containsCredentials(){
  return credentials != null;
}
Program: 45043
Project: 45043
Buggy source:
/** 
 * Returns the path part of this FileURL (e.g. /webstart/mucommander.jnlp for http://mucommander.com/webstart/mucommander.jnlp).
 */
public String getPath(){
  return path;
}

Fixed version (ground truth):
/** 
 * Returns the path part of this FileURL (e.g. /webstart/mucommander.jnlp for http://mucommander.com/webstart/mucommander.jnlp).
 * @return the path part of this <code>FileURL</code>.
 * @see #setPath(String)
 */
public String getPath(){
  return path;
}
Program: 45044
Project: 45044
Buggy source:
/** 
 * Sets the query part of this FileURL, <code>null</code> for no query part.
 */
public void setQuery(String query){
  this.query=query;
}

Fixed version (ground truth):
/** 
 * Sets the query part of this FileURL, <code>null</code> for no query part.
 * @param query new query part for this <code>FileURL</code>.
 * @see #getQuery()
 */
public void setQuery(String query){
  this.query=query;
}
Program: 45045
Project: 45045
Buggy source:
/** 
 * Returns the host part of this FileURL (e.g. google.com), <code>null</code> if this FileURL doesn't contain any host.
 */
public String getHost(){
  return host;
}

Fixed version (ground truth):
/** 
 * Returns the host part of this FileURL (e.g. google.com), <code>null</code> if this FileURL doesn't contain any host.
 * @return the host part of this <code>FileURL</code>.
 * @see #setHost(String)
 */
public String getHost(){
  return host;
}
Program: 45046
Project: 45046
Buggy source:
/** 
 * Returns the query part of this FileURL if there is one (e.g. ?dummy=1&void=1 for http://mucommander.com/useless.php?dummy=1&void=1), <code>null</code> otherwise.
 */
public String getQuery(){
  return query;
}

Fixed version (ground truth):
/** 
 * Returns the query part of this FileURL if there is one (e.g. ?dummy=1&void=1 for http://mucommander.com/useless.php?dummy=1&void=1), <code>null</code> otherwise.
 * @return the query part of this <code>FileURL</code> if present, <code>null</code> otherwise.
 * @see #setQuery(String)
 */
public String getQuery(){
  return query;
}
Program: 45047
Project: 45047
Buggy source:
/** 
 * Sets the host part of this FileURL, <code>null</code> for no host.
 */
public void setHost(String host){
  this.host=host;
}

Fixed version (ground truth):
/** 
 * Sets the host part of this FileURL, <code>null</code> for no host.
 * @param host new host part for this <code>FileURL</code>.
 * @see #getHost()
 */
public void setHost(String host){
  this.host=host;
}
Program: 45048
Project: 45048
Buggy source:
/** 
 * Returns this FileURL's parent, or null if this FileURL has no parent (path is "/"). The returned parent will have the same protocol, host, port, credentials and properties as this FileURL. The filename and query parts of this FileURL (if any) will not be set in the returned parent, both will be null. <p>Note: this method returns a new FileURL instance everytime it is called, and all mutable fields of this FileURL are cloned. Therefore the returned parent can be safely modified without risking to modify other FileURL instances.</p>
 */
public FileURL getParent(){
  if (!(path.equals("String_Node_Str") || path.equals("String_Node_Str"))) {
    String separator=getPathSeparator();
    String parentPath=path.endsWith(separator) ? path.substring(0,path.length() - separator.length()) : path;
    int lastSeparatorPos=parentPath.lastIndexOf(separator);
    if (lastSeparatorPos != -1) {
      FileURL parentURL=new FileURL();
      parentURL.protocol=protocol;
      parentURL.host=host;
      parentURL.port=port;
      parentURL.path=parentPath.substring(0,lastSeparatorPos + 1);
      parentURL.filename=getFilenameFromPath(parentURL.path,separator);
      parentURL.credentials=credentials;
      if (properties != null)       parentURL.properties=new Hashtable(properties);
      return parentURL;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns this FileURL's parent, or null if this FileURL has no parent (path is "/"). The returned parent will have the same protocol, host, port, credentials and properties as this FileURL. The filename and query parts of this FileURL (if any) will not be set in the returned parent, both will be null. <p>Note: this method returns a new FileURL instance everytime it is called, and all mutable fields of this FileURL are cloned. Therefore the returned parent can be safely modified without risking to modify other FileURL instances.</p>
 * @return this <code>FileURL</code>'s parent, <code>null</code> if it doesn't have one.
 */
public FileURL getParent(){
  if (!(path.equals("String_Node_Str") || path.equals("String_Node_Str"))) {
    String separator=getPathSeparator();
    String parentPath=path.endsWith(separator) ? path.substring(0,path.length() - separator.length()) : path;
    int lastSeparatorPos=parentPath.lastIndexOf(separator);
    if (lastSeparatorPos != -1) {
      FileURL parentURL=new FileURL();
      parentURL.protocol=protocol;
      parentURL.host=host;
      parentURL.port=port;
      parentURL.path=parentPath.substring(0,lastSeparatorPos + 1);
      parentURL.filename=getFilenameFromPath(parentURL.path,separator);
      parentURL.credentials=credentials;
      if (properties != null)       parentURL.properties=new Hashtable(properties);
      return parentURL;
    }
  }
  return null;
}
Program: 45049
Project: 45049
Buggy source:
/** 
 * Returns the value corresponding to the given property's name, null if the property doesn't exist (has no value).
 */
public String getProperty(String name){
  return properties == null ? null : (String)properties.get(name);
}

Fixed version (ground truth):
/** 
 * Returns the value corresponding to the given property's name, null if the property doesn't exist (has no value).
 * @param name name of the property whose value should be retrieved.
 * @return      the value associated with the specified <code>name</code>, <code>null</code> if not found.
 * @see #setProperty(String,String)
 */
public String getProperty(String name){
  return properties == null ? null : (String)properties.get(name);
}
Program: 45050
Project: 45050
Buggy source:
/** 
 * Sets the path part of this FileURL. The specified path must not be <code>null</code>.
 */
public void setPath(String path){
  this.path=path;
  this.filename=getFilenameFromPath(path,getPathSeparator());
}

Fixed version (ground truth):
/** 
 * Sets the path part of this FileURL. The specified path must not be <code>null</code>.
 * @param path new path part for this <code>FileURL</code>.
 * @see #getPath()
 */
public void setPath(String path){
  this.path=path;
  this.filename=getFilenameFromPath(path,getPathSeparator());
}
Program: 45051
Project: 45051
Buggy source:
/** 
 * Returns the protocol part of this FileURL (e.g. smb). The returned protocol may never be <code>null</code>.
 */
public String getProtocol(){
  return protocol;
}

Fixed version (ground truth):
/** 
 * Returns the protocol part of this FileURL (e.g. smb). The returned protocol may never be <code>null</code>.
 * @return the protocol part of this <code>FileURL</code>.
 * @see #setProtocol(String)
 */
public String getProtocol(){
  return protocol;
}
Program: 45052
Project: 45052
Buggy source:
/** 
 * Returns the login specified in this FileURL (e.g. maxence for ftp://maxence@mucommander.com), <code>null</code> otherwise.
 */
public String getLogin(){
  return credentials == null ? null : credentials.getLogin();
}

Fixed version (ground truth):
/** 
 * Returns the login specified in this FileURL (e.g. maxence for ftp://maxence@mucommander.com), <code>null</code> otherwise.
 * @return the login specified in this <code>FileURL</code>.
 */
public String getLogin(){
  return credentials == null ? null : credentials.getLogin();
}
Program: 45054
Project: 45054
Buggy source:
/** 
 * Returns the password specified in this FileURL (e.g. blah for ftp://maxence:blah@mucommander.com), <code>null</code> otherwise.
 */
public String getPassword(){
  return credentials == null ? null : credentials.getPassword();
}

Fixed version (ground truth):
/** 
 * Returns the password specified in this FileURL (e.g. blah for ftp://maxence:blah@mucommander.com), <code>null</code> otherwise.
 * @return the password specified in this <code>FileURL</code>.
 */
public String getPassword(){
  return credentials == null ? null : credentials.getPassword();
}
Program: 45055
Project: 45055
Buggy source:
/** 
 * Returns the port specified in this FileURL (e.g. 8080) if there is one, -1 otherwise. (-1 means the protocol's default port).
 */
public int getPort(){
  return port;
}

Fixed version (ground truth):
/** 
 * Returns the port specified in this FileURL (e.g. 8080) if there is one, -1 otherwise. (-1 means the protocol's default port).
 * @return the port specified in this <code>FileURL</code>.
 * @see #setPort(int)
 */
public int getPort(){
  return port;
}
Program: 45056
Project: 45056
Buggy source:
/** 
 * Returns the filename part of this FileURL, and if specified, decodes URL-encoded characters (e.g. %5D%35)
 */
public String getFilename(boolean urlDecode){
  try {
    if (urlDecode && filename != null)     return URLDecoder.decode(filename,URL_CHARSET);
  }
 catch (  UnsupportedEncodingException e) {
  }
  return filename;
}

Fixed version (ground truth):
/** 
 * Returns the filename part of this FileURL, and if specified, decodes URL-encoded characters (e.g. %5D%35)
 * @param urlDecode whether to URL-decode the filename.
 * @return the filename part of this <code>FileURL</code>, URL-decoded if necessary.
 * @see #setPath(String)
 * @see #getFilename()
 */
public String getFilename(boolean urlDecode){
  try {
    if (urlDecode && filename != null)     return URLDecoder.decode(filename,URL_CHARSET);
  }
 catch (  UnsupportedEncodingException e) {
  }
  return filename;
}
Program: 45057
Project: 45057
Buggy source:
/** 
 * Sets the given properties (name/value pair) to this FileURL. Properties can be used as a way to pass parameters to AbstractFile constructors.
 */
public void setProperty(String name,String value){
  if (properties == null)   properties=new Hashtable();
  properties.put(name,value);
}

Fixed version (ground truth):
/** 
 * Sets the given properties (name/value pair) to this FileURL. Properties can be used as a way to pass parameters to AbstractFile constructors.
 * @param name  name of the property to set.
 * @param value value for the property.
 * @see #getProperty(String)
 */
public void setProperty(String name,String value){
  if (properties == null)   properties=new Hashtable();
  properties.put(name,value);
}
Program: 45058
Project: 45058
Buggy source:
/** 
 * Tests FileURL instances for equality: <ul <li>credentials (login and password) are not taken into account when testing equality <li>case is ignored <li>there can be a trailing slash or backslash difference in the path of 2 otherwise identical URLs, true will still be returned </ul>
 * @return true if both FileURL instances are equal.
 */
public boolean equals(Object o){
  if (o == null || !(o instanceof FileURL))   return false;
  String url1=toString(false).toLowerCase();
  String url2=((FileURL)o).toString(false).toLowerCase();
  if (url1.equals(url2))   return true;
  int len1=url1.length();
  int len2=url2.length();
  if (Math.abs(len1 - len2) == 1 && (len1 > len2 ? url1.startsWith(url2) : url2.startsWith(url1))) {
    char cdiff=len1 > len2 ? url1.charAt(len1 - 1) : url2.charAt(len2 - 1);
    if (cdiff == '/' || cdiff == '\\')     return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Tests FileURL instances for equality. <p> Two <code>FileURL</code> instances are said to be equal if: <ul> <li>credentials (login and password) are not taken into account when testing equality <li>case is ignored <li>there can be a trailing slash or backslash difference in the path of 2 otherwise identical URLs, true will still be returned </ul> </p>
 * @param o object against which to compare this <code>FileURL</code>.
 * @return   true if both FileURL instances are equal.
 */
public boolean equals(Object o){
  if (o == null || !(o instanceof FileURL))   return false;
  String url1=toString(false).toLowerCase();
  String url2=((FileURL)o).toString(false).toLowerCase();
  if (url1.equals(url2))   return true;
  int len1=url1.length();
  int len2=url2.length();
  if (Math.abs(len1 - len2) == 1 && (len1 > len2 ? url1.startsWith(url2) : url2.startsWith(url1))) {
    char cdiff=len1 > len2 ? url1.charAt(len1 - 1) : url2.charAt(len2 - 1);
    if (cdiff == '/' || cdiff == '\\')     return true;
  }
  return false;
}