nus-yam/ex-repair huggingface dataset:
Program: 44882
Project: 44882
Buggy source:
/** 
 * This method updates ActionKeymap with the modified shortcuts.
 */
public void updateActions(){
  Iterator iterator=state.getDirtyRowsIterator();
  while (iterator.hasNext()) {
    Integer row=(Integer)iterator.next();
    ActionKeymap.changeActionAccelerators(data.getActionId(row),data.getAccelerator(row),data.getAltAccelerator(row));
  }
  state.resetDirtyRows();
}

Fixed version (ground truth):
/** 
 * This method updates ActionKeymap with the modified shortcuts.
 */
public void updateActions(){
  Iterator iterator=state.getDirtyRowsIterator();
  while (iterator.hasNext()) {
    int row=((Integer)iterator.next()).intValue();
    ActionKeymap.changeActionAccelerators(data.getActionId(row),data.getAccelerator(row),data.getAltAccelerator(row));
  }
  state.resetDirtyRows();
}
Program: 44883
Project: 44883
Buggy source:
public int read(byte b[],int off,int len) throws IOException {
  if (leadingBytes == null)   return in.read(b,off,len);
  int nbBytes=Math.min(leadingBytes.length - leadingBytesOff,len);
  System.arraycopy(leadingBytes,leadingBytesOff,b,off,nbBytes);
  leadingBytesOff+=nbBytes;
  if (leadingBytesOff >= leadingBytes.length)   leadingBytes=null;
  return nbBytes;
}

Fixed version (ground truth):
public int read(byte b[],int off,int len) throws IOException {
  if (leadingBytes == null || leadingBytesOff >= leadingBytes.length)   return in.read(b,off,len);
  int nbBytes=Math.min(leadingBytes.length - leadingBytesOff,len);
  System.arraycopy(leadingBytes,leadingBytesOff,b,off,nbBytes);
  leadingBytesOff+=nbBytes;
  return nbBytes;
}
Program: 44884
Project: 44884
Buggy source:
/** 
 * Initialises this desktop. <p> This method is empty. See   {@link DesktopAdapter#init(boolean)} for information onhow to override it. </p>
 * @param install                        <code>true</code> if this is the application's first boot, <code>false</code> otherwise.
 * @throws DesktopInitialisationException if any error occurs.
 */
public void init(boolean install) throws DesktopInitialisationException {
  try {
    Integer value=((Integer)Toolkit.getDefaultToolkit().getDesktopProperty("String_Node_Str"));
    if (value == null)     multiClickInterval=DEFAULT_MULTICLICK_INTERVAL;
 else     multiClickInterval=value.intValue();
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + e);
    multiClickInterval=DEFAULT_MULTICLICK_INTERVAL;
  }
}

Fixed version (ground truth):
/** 
 * Initialises this desktop. <p> This method is empty. See   {@link DesktopAdapter#init(boolean)} for information onhow to override it. </p>
 * @param install                        <code>true</code> if this is the application's first boot, <code>false</code> otherwise.
 * @throws DesktopInitialisationException if any error occurs.
 */
public void init(boolean install) throws DesktopInitialisationException {
}
Program: 44885
Project: 44885
Buggy source:
private static Iterator predefinedThemeNames(){
  return getThemeNames(ResourceLoader.getResourceAsFile(RuntimeConstants.THEMES_PATH));
}

Fixed version (ground truth):
private static Iterator predefinedThemeNames(){
  try {
    return getThemeNames(ResourceLoader.getRootPackageAsFile(ThemeManager.class).getChild(PathUtils.removeLeadingSeparator(RuntimeConstants.THEMES_PATH,"String_Node_Str")));
  }
 catch (  IOException e) {
    return Collections.emptyList().iterator();
  }
}
Program: 44886
Project: 44886
Buggy source:
/** 
 * Updates the divider component's location to keep the current proportional divider location. 
 */
public void updateDividerLocation(){
  if (!window.isVisible())   return;
  lastDividerLocation=-1;
  setDividerLocation((int)(splitRatio * (getOrientation() == HORIZONTAL_SPLIT ? getWidth() : getHeight())));
}

Fixed version (ground truth):
/** 
 * Updates the divider component's location to keep the current proportional divider location. 
 */
public void updateDividerLocation(){
  if (!window.isVisible())   return;
  lastDividerLocation=-1;
  setDividerLocation(splitRatio);
}
Program: 44887
Project: 44887
Buggy source:
/** 
 * Sets the divider location when the ContentPane has been resized so that it stays at the same proportional (not absolute) location.
 */
public void componentResized(ComponentEvent e){
  Object source=e.getSource();
  if (source == window) {
    updateDividerLocation();
  }
}

Fixed version (ground truth):
/** 
 * Sets the divider location when the ContentPane has been resized so that it stays at the same proportional (not absolute) location.
 */
public void componentResized(ComponentEvent e){
  Object source=e.getSource();
  if (source == window) {
    windowWidth=window.getWidth();
    updateDividerLocation();
  }
}
Program: 44888
Project: 44888
Buggy source:
public void componentMoved(ComponentEvent e){
  if (e.getSource() == getDividerComponent()) {
    if (lastDividerLocation == -1) {
      lastDividerLocation=getDividerLocation();
      return;
    }
 else     if (lastDividerLocation == getDividerLocation())     return;
    lastDividerLocation=getDividerLocation();
    splitRatio=lastDividerLocation / (float)(getOrientation() == HORIZONTAL_SPLIT ? getWidth() : getHeight());
  }
}

Fixed version (ground truth):
public void componentMoved(ComponentEvent e){
  if (e.getSource() == getDividerComponent()) {
    if (lastDividerLocation == -1) {
      lastDividerLocation=getDividerLocation();
      return;
    }
 else     if (lastDividerLocation == getDividerLocation())     return;
    if (windowWidth != window.getWidth()) {
      windowWidth=window.getWidth();
      return;
    }
    lastDividerLocation=getDividerLocation();
    splitRatio=lastDividerLocation / (float)(getOrientation() == HORIZONTAL_SPLIT ? getWidth() : getHeight());
  }
}
Program: 44889
Project: 44889
Buggy source:
public Object clone() throws CloneNotSupportedException {
  return super.clone();
}

Fixed version (ground truth):
public Object clone() throws CloneNotSupportedException {
  PreviewLabel label;
  label=(PreviewLabel)super.clone();
  label.addPropertyChangeListener(label);
  return label;
}
Program: 44890
Project: 44890
Buggy source:
private void addMapping(Class actionClass,KeyStroke[] keyStrokes) throws IOException {
  XmlAttributes attributes=new XmlAttributes();
  attributes.add(CLASS_ATTRIBUTE,actionClass.getCanonicalName());
  if (Debug.ON)   Debug.trace("String_Node_Str" + actionClass.getSimpleName() + "String_Node_Str"+ keyStrokes[0]+ "String_Node_Str"+ keyStrokes[1]);
  if (keyStrokes[0] != null)   attributes.add(PRIMARY_KEYSTROKE_ATTRIBUTE,keyStrokes[0].toString());
  if (keyStrokes[1] != null)   attributes.add(ALTERNATE_KEYSTROKE_ATTRIBUTE,keyStrokes[1].toString());
  writer.writeStandAloneElement(ACTION_ELEMENT,attributes);
}

Fixed version (ground truth):
private void addMapping(Class actionClass,KeyStroke[] keyStrokes) throws IOException {
  XmlAttributes attributes=new XmlAttributes();
  attributes.add(CLASS_ATTRIBUTE,actionClass.getCanonicalName());
  if (Debug.ON)   Debug.trace("String_Node_Str" + actionClass.getSimpleName() + "String_Node_Str"+ keyStrokes[0]+ "String_Node_Str"+ keyStrokes[1]);
  if (keyStrokes[0] != null)   attributes.add(PRIMARY_KEYSTROKE_ATTRIBUTE,KeyStrokeUtils.getKeyStrokeRepresentation(keyStrokes[0]));
  if (keyStrokes[1] != null)   attributes.add(ALTERNATE_KEYSTROKE_ATTRIBUTE,KeyStrokeUtils.getKeyStrokeRepresentation(keyStrokes[1]));
  writer.writeStandAloneElement(ACTION_ELEMENT,attributes);
}
Program: 44891
Project: 44891
Buggy source:
/** 
 * Returns a String representation for the given KeyStroke for display, in the following format:<br> <code>modifier+modifier+...+key</code> <p>For example, <code>KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK|InputEvent.ALT_MASK)</code> will return <code>Ctrl+Alt+C</code>.</p>
 * @param ks the KeyStroke for which to return a String representation
 * @return a String representation of the given KeyStroke for display, in the <code>[modifier]+[modifier]+...+key</code> format
 */
public static String getKeyStrokeRepresentation(KeyStroke ks){
  String toString=ks.toString();
  return toString.replaceAll("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Returns a String representation for the given KeyStroke for display, in the following format:<br> <code>modifier+modifier+...+key</code> <p>For example, <code>KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK|InputEvent.ALT_MASK)</code> will return <code>Ctrl+Alt+C</code>.</p>
 * @param ks the KeyStroke for which to return a String representation
 * @return a String representation of the given KeyStroke for display, in the <code>[modifier]+[modifier]+...+key</code> format
 */
public static String getKeyStrokeRepresentation(KeyStroke ks){
  return ks.toString().replaceFirst("String_Node_Str","String_Node_Str");
}
Program: 44892
Project: 44892
Buggy source:
public void mouseClicked(MouseEvent e){
  if (DesktopManager.isRightMouseButton(e)) {
    JPopupMenu popupMenu=new JPopupMenu();
    popupMenu.add(ActionManager.getActionInstance(com.mucommander.ui.action.ToggleCommandBarAction.class,mainFrame));
    popupMenu.add(ActionManager.getActionInstance(com.mucommander.ui.action.CustomizeCommandBarAction.class,mainFrame));
    popupMenu.show(this,e.getX(),e.getY());
    popupMenu.setVisible(true);
  }
}

Fixed version (ground truth):
public void mouseClicked(MouseEvent e){
  if (DesktopManager.isRightMouseButton(e)) {
    JPopupMenu popupMenu=new JPopupMenu();
    popupMenu.add(ActionManager.getActionInstance(com.mucommander.ui.action.ToggleCommandBarAction.class,mainFrame));
    popupMenu.add(ActionManager.getActionInstance(com.mucommander.ui.action.CustomizeCommandBarAction.class,mainFrame));
    Point clickLocation=SwingUtilities.convertPoint(e.getComponent(),e.getPoint(),this);
    popupMenu.show(this,clickLocation.x,clickLocation.y);
    popupMenu.setVisible(true);
  }
}
Program: 44894
Project: 44894
Buggy source:
public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  JPanel panel=new JPanel(new FlowLayout(FlowLayout.CENTER));
  CommandBarButton button=(CommandBarButton)value;
  panel.add(button);
  panel.setToolTipText(button.getToolTipText());
  return panel;
}

Fixed version (ground truth):
public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  JPanel panel=new JPanel(new BorderLayout());
  CommandBarButton button=(CommandBarButton)value;
  panel.add(button,BorderLayout.CENTER);
  panel.setToolTipText(button.getToolTipText());
  return panel;
}
Program: 44895
Project: 44895
Buggy source:
public void performAction(){
  FileSet selectedFiles;
  selectedFiles=mainFrame.getActiveTable().getSelectedFiles();
  if (selectedFiles.size() == 0)   return;
  if (selectedFiles.getBaseFolder().getURL().getScheme().equals(FileProtocols.FILE) && (selectedFiles.getBaseFolder() instanceof LocalFile)) {
    try {
      ProcessRunner.execute(command.getTokens(selectedFiles),selectedFiles.getBaseFolder());
    }
 catch (    Exception e) {
      ErrorDialog.showErrorDialog(mainFrame);
      if (Debug.ON) {
        Debug.trace("String_Node_Str" + command.getCommand());
        Debug.trace(e);
      }
    }
  }
 else {
    ProgressDialog progressDialog=new ProgressDialog(mainFrame,Translator.get("String_Node_Str"));
    progressDialog.start(new TempOpenWithJob(new ProgressDialog(mainFrame,Translator.get("String_Node_Str")),mainFrame,selectedFiles,command));
  }
}

Fixed version (ground truth):
public void performAction(){
  FileSet selectedFiles;
  selectedFiles=mainFrame.getActiveTable().getSelectedFiles();
  if (selectedFiles.size() == 0)   return;
  if (selectedFiles.getBaseFolder().getURL().getScheme().equals(FileProtocols.FILE) && (selectedFiles.getBaseFolder().getTopAncestor() instanceof LocalFile)) {
    try {
      ProcessRunner.execute(command.getTokens(selectedFiles),selectedFiles.getBaseFolder());
    }
 catch (    Exception e) {
      ErrorDialog.showErrorDialog(mainFrame);
      if (Debug.ON) {
        Debug.trace("String_Node_Str" + command.getCommand());
        Debug.trace(e);
      }
    }
  }
 else {
    ProgressDialog progressDialog=new ProgressDialog(mainFrame,Translator.get("String_Node_Str"));
    progressDialog.start(new TempOpenWithJob(new ProgressDialog(mainFrame,Translator.get("String_Node_Str")),mainFrame,selectedFiles,command));
  }
}
Program: 44896
Project: 44896
Buggy source:
/** 
 * Writes the current command bar to the user's command bar file.
 * @throws IOException 
 * @throws IOException
 */
public static void saveCommandBar() throws IOException {
  if (isCommandBarChanged)   new CommandBarWriter();
 else   if (Debug.ON)   Debug.trace("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Writes the current command bar to the user's command bar file.
 * @throws IOException 
 * @throws IOException
 */
public static void saveCommandBar() throws IOException {
  if (commandBarWriter != null)   commandBarWriter.write();
 else   Debug.trace("String_Node_Str");
}
Program: 44897
Project: 44897
Buggy source:
/** 
 * Parses the XML file describing the command bar's buttons and associated actions. If the file doesn't exist yet, it is copied from the default resource file within the JAR. This method must be called before instantiating CommandBar for the first time.
 */
public static void loadCommandBar() throws Exception {
  AbstractFile commandBarFile=getDescriptionFile();
  if (commandBarFile.exists())   new CommandBarReader();
 else   if (com.mucommander.Debug.ON)   com.mucommander.Debug.trace(COMMAND_BAR_RESOURCE_PATH + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Parses the XML file describing the command bar's buttons and associated actions. If the file doesn't exist yet, it is copied from the default resource file within the JAR. This method must be called before instantiating CommandBar for the first time.
 */
public static void loadCommandBar() throws Exception {
  AbstractFile commandBarFile=getDescriptionFile();
  if (commandBarFile.exists())   new CommandBarReader();
 else   if (com.mucommander.Debug.ON)   com.mucommander.Debug.trace(COMMAND_BAR_RESOURCE_PATH + "String_Node_Str");
  commandBarWriter=CommandBarWriter.create();
}
Program: 44898
Project: 44898
Buggy source:
CommandBarWriter() throws IOException {
  Class[] commandBarActions=CommandBarAttributes.getActions();
  Class[] commandBarAlterativeActions=CommandBarAttributes.getAlternateActions();
  KeyStroke commandBarModifier=CommandBarAttributes.getModifier();
  BackupOutputStream bos=null;
  try {
    bos=new BackupOutputStream(getDescriptionFile());
    new Writer(bos).write(commandBarActions,commandBarAlterativeActions,commandBarModifier);
    isCommandBarChanged=false;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    bos.close();
  }
}

Fixed version (ground truth):
private CommandBarWriter(){
  CommandBarAttributes.addCommandBarAttributesListener(this);
}
Program: 44902
Project: 44902
Buggy source:
/** 
 * Returns the list of volumes to be displayed in the popup menu. <p>The raw list of volumes is fetched using   {@link com.mucommander.file.RootFolders#getRootFolders()} and thenfiltered using the regexp defined in the  {@link MuConfiguration#VOLUME_EXCLUDE_REGEXP} configuration variable(if defined).</p>
 * @return the list of volumes to be displayed in the popup menu
 */
public static AbstractFile[] getDisplayableVolumes(){
  AbstractFile[] volumes=RootFolders.getRootFolders();
  if (volumeFilter != null)   return volumeFilter.filter(volumes);
  return volumes;
}

Fixed version (ground truth):
/** 
 * Returns the list of volumes to be displayed in the popup menu. <p>The raw list of volumes is fetched using   {@link LocalFile#getVolumes()} and thenfiltered using the regexp defined in the  {@link MuConfiguration#VOLUME_EXCLUDE_REGEXP} configuration variable(if defined).</p>
 * @return the list of volumes to be displayed in the popup menu
 */
public static AbstractFile[] getDisplayableVolumes(){
  AbstractFile[] volumes=LocalFile.getVolumes();
  if (volumeFilter != null)   return volumeFilter.filter(volumes);
  return volumes;
}
Program: 44904
Project: 44904
Buggy source:
public void run(){
  popupMenu.pack();
}

Fixed version (ground truth):
public void run(){
  popupMenu.invalidate();
  popupMenu.pack();
}
Program: 44906
Project: 44906
Buggy source:
/** 
 * Skips exactly <code>n</code>bytes from the given InputStream. <p>This method calls the <code>skip()</code> method of the given stream until the requested number of bytes have been skipped, or throws an   {@link EOFException} if the end of file has been reached prematurely.</p>
 * @param in the InputStream to skip bytes from
 * @param n the number of bytes to skip
 * @throws java.io.EOFException if the EOF is reached before all bytes have been skipped
 * @throws java.io.IOException if an I/O error occurs
 */
public static void skipFully(InputStream in,long n) throws IOException {
  if (n <= 0)   return;
  do {
    long nbSkipped=in.skip(n);
    if (nbSkipped < 0)     throw new IOException();
    n-=nbSkipped;
  }
 while (n > 0);
}

Fixed version (ground truth):
/** 
 * Skips exactly <code>n</code>bytes from the given InputStream. <p>This method calls the <code>skip()</code> method of the given stream until the requested number of bytes have been skipped, or throws an   {@link EOFException} if the end of file has been reached prematurely.</p>
 * @param in the InputStream to skip bytes from
 * @param n the number of bytes to skip
 * @throws java.io.EOFException if the EOF is reached before all bytes have been skipped
 * @throws java.io.IOException if an I/O error occurs
 */
public static void skipFully(InputStream in,long n) throws IOException {
  if (n <= 0)   return;
  do {
    long nbSkipped=in.skip(n);
    if (nbSkipped < 0)     throw new EOFException();
    n-=nbSkipped;
  }
 while (n > 0);
}
Program: 44907
Project: 44907
Buggy source:
/** 
 * Performs tasks before shut down, such as writing the configuration file. This method can only be called once, any further call will be ignored (no-op).
 */
private synchronized static void performShutdownTasks(){
  if (shutdownTasksPerformed)   return;
  try {
    MuConfiguration.write();
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + e);
  }
  try {
    ShellHistoryManager.writeHistory();
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + e);
  }
  try {
    CredentialsManager.writeCredentials(false);
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + e);
  }
  try {
    BookmarkManager.writeBookmarks(false);
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + e);
  }
  try {
    ThemeManager.saveCurrentTheme();
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + e);
  }
  try {
    CommandManager.writeCommands();
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + e);
  }
  try {
    CommandManager.writeAssociations();
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + e);
  }
  shutdownTasksPerformed=true;
}

Fixed version (ground truth):
/** 
 * Performs tasks before shut down, such as writing the configuration file. This method can only be called once, any further call will be ignored (no-op).
 */
private synchronized static void performShutdownTasks(){
  if (shutdownTasksPerformed)   return;
  TreeIOThreadManager.getInstance().interrupt();
  try {
    MuConfiguration.write();
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + e);
  }
  try {
    ShellHistoryManager.writeHistory();
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + e);
  }
  try {
    CredentialsManager.writeCredentials(false);
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + e);
  }
  try {
    BookmarkManager.writeBookmarks(false);
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + e);
  }
  try {
    ThemeManager.saveCurrentTheme();
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + e);
  }
  try {
    CommandManager.writeCommands();
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + e);
  }
  try {
    CommandManager.writeAssociations();
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + e);
  }
  shutdownTasksPerformed=true;
}
Program: 44908
Project: 44908
Buggy source:
/** 
 * Gets children of current directory. Files are filtered and then sorted. This method is executed in caching thread.
 */
private void lsAsync(){
  if (getCachedIcon() == null) {
    setCachedIcon(FileIcons.getFileIcon(getProxiedFile()));
  }
  AbstractFile[] children=null;
  try {
    children=file.ls(cache.getFilter());
  }
 catch (  Exception e) {
    e.printStackTrace();
    children=new AbstractFile[0];
    cachedIcon=IconManager.getIcon(IconManager.FILE_ICON_SET,CustomFileIconProvider.NOT_ACCESSIBLE_FILE);
  }
  Arrays.sort(children,cache.getSort());
  Icon icons[]=new Icon[children.length];
  for (int i=0; i < children.length; i++) {
    icons[i]=FileIcons.getFileIcon(children[i]);
  }
synchronized (cache) {
    for (int i=0; i < children.length; i++) {
      CachedDirectory cachedChild=cache.getOrAdd(children[i]);
      cachedChild.setCachedIcon(icons[i]);
    }
  }
  final AbstractFile[] children2=children;
  try {
    SwingUtilities.invokeAndWait(new Runnable(){
      public void run(){
        setLsCache(children2,file.getDate());
      }
    }
);
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
catch (  InvocationTargetException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Gets children of current directory. Files are filtered and then sorted. This method is executed in caching thread.
 */
private void lsAsync(){
  if (getCachedIcon() == null || getCachedIcon() == NOT_ACCESSIBLE_ICON) {
    setCachedIcon(FileIcons.getFileIcon(getProxiedFile()));
  }
  AbstractFile[] children=null;
  try {
    children=file.ls(cache.getFilter());
  }
 catch (  Exception e) {
    e.printStackTrace();
    children=new AbstractFile[0];
    setCachedIcon(NOT_ACCESSIBLE_ICON);
  }
  Arrays.sort(children,cache.getSort());
  Icon icons[]=new Icon[children.length];
  for (int i=0; i < children.length; i++) {
    icons[i]=FileIcons.getFileIcon(children[i]);
  }
synchronized (cache) {
    for (int i=0; i < children.length; i++) {
      CachedDirectory cachedChild=cache.getOrAdd(children[i]);
      cachedChild.setCachedIcon(icons[i]);
    }
  }
  final AbstractFile[] children2=children;
  try {
    SwingUtilities.invokeAndWait(new Runnable(){
      public void run(){
        setLsCache(children2,file.getDate());
      }
    }
);
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
catch (  InvocationTargetException e) {
    e.printStackTrace();
  }
}
Program: 44909
Project: 44909
Buggy source:
/** 
 * Checks if this directory is already cached. If it isn't cached then a new cache thread is started.
 * @return true if directory is cached, false otherwise
 */
public synchronized boolean isCached(){
  if (isReadingChildren()) {
    return false;
  }
  if (lsTimeStamp != file.getDate()) {
    setReadingChildren(true);
    Thread lsThread=new Thread("String_Node_Str"){
      public void run(){
        lsAsync();
      }
    }
;
    lsThread.start();
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks if this directory is already cached. If it isn't cached then a new cache thread is started.
 * @return true if directory is cached, false otherwise
 */
public synchronized boolean isCached(){
  if (isReadingChildren()) {
    return false;
  }
  if (lsTimeStamp != file.getDate()) {
    setReadingChildren(true);
    TreeIOThreadManager.getInstance().addTask(new Runnable(){
      public void run(){
        lsAsync();
      }
    }
);
    return false;
  }
  return true;
}
Program: 44912
Project: 44912
Buggy source:
public boolean hasChanged(){
  return !String.valueOf(ICON_SCALE_FACTORS[getSelectedIndex()]).equals(MuConfiguration.getVariable(MuConfiguration.TOOLBAR_ICON_SCALE));
}

Fixed version (ground truth):
public boolean hasChanged(){
  return !String.valueOf(ICON_SCALE_FACTORS[getSelectedIndex()]).equals(MuConfiguration.getVariable(confVar));
}
Program: 44913
Project: 44913
Buggy source:
/** 
 * Creates a combo box that allows to choose a size for a certain type of icon. The returned combo box is filled with allowed choices, and the current configuration value is selected.
 * @param confVar the name of the configuration variable that contains the icon scale factor
 * @param defaultValue the default value for the icon scale factor if the configuration variable has no value
 * @return a combo box that allows to choose a size for a certain type of icon
 */
private PrefComboBox createIconSizeCombo(String confVar,float defaultValue){
  PrefComboBox iconSizeCombo=new PrefComboBox(){
    public boolean hasChanged(){
      return !String.valueOf(ICON_SCALE_FACTORS[getSelectedIndex()]).equals(MuConfiguration.getVariable(MuConfiguration.TOOLBAR_ICON_SCALE));
    }
  }
;
  for (int i=0; i < ICON_SIZES.length; i++)   iconSizeCombo.addItem(ICON_SIZES[i]);
  float scaleFactor=MuConfiguration.getVariable(confVar,defaultValue);
  int index=0;
  for (int i=0; i < ICON_SCALE_FACTORS.length; i++) {
    if (scaleFactor == ICON_SCALE_FACTORS[i]) {
      index=i;
      break;
    }
  }
  iconSizeCombo.setSelectedIndex(index);
  return iconSizeCombo;
}

Fixed version (ground truth):
/** 
 * Creates a combo box that allows to choose a size for a certain type of icon. The returned combo box is filled with allowed choices, and the current configuration value is selected.
 * @param confVar the name of the configuration variable that contains the icon scale factor
 * @param defaultValue the default value for the icon scale factor if the configuration variable has no value
 * @return a combo box that allows to choose a size for a certain type of icon
 */
private PrefComboBox createIconSizeCombo(final String confVar,float defaultValue){
  PrefComboBox iconSizeCombo=new PrefComboBox(){
    public boolean hasChanged(){
      return !String.valueOf(ICON_SCALE_FACTORS[getSelectedIndex()]).equals(MuConfiguration.getVariable(confVar));
    }
  }
;
  for (int i=0; i < ICON_SIZES.length; i++)   iconSizeCombo.addItem(ICON_SIZES[i]);
  float scaleFactor=MuConfiguration.getVariable(confVar,defaultValue);
  int index=0;
  for (int i=0; i < ICON_SCALE_FACTORS.length; i++) {
    if (scaleFactor == ICON_SCALE_FACTORS[i]) {
      index=i;
      break;
    }
  }
  iconSizeCombo.setSelectedIndex(index);
  return iconSizeCombo;
}
Program: 44914
Project: 44914
Buggy source:
public void windowDeactivated(WindowEvent e){
  Object source=e.getSource();
  if (!(source instanceof MainFrame))   return;
  ((MainFrame)e.getSource()).setForegroundActive(false);
}

Fixed version (ground truth):
public void windowDeactivated(WindowEvent e){
  Object source=e.getSource();
  MenuSelectionManager.defaultManager().clearSelectedPath();
  if (!(source instanceof MainFrame))   return;
  ((MainFrame)e.getSource()).setForegroundActive(false);
}
Program: 44915
Project: 44915
Buggy source:
public synchronized int read(byte b[],int off,int len) throws IOException {
  if (len > getRemainingBytes())   throw outOfBoundException;
  int nbRead=in.read(b,off,len);
  if (nbRead > 0)   totalRead+=nbRead;
  return nbRead;
}

Fixed version (ground truth):
public synchronized int read(byte b[],int off,int len) throws IOException {
  int canRead=(int)Math.min(getRemainingBytes(),len);
  if (canRead == 0)   throw outOfBoundException;
  int nbRead=in.read(b,off,canRead);
  if (nbRead > 0)   totalRead+=nbRead;
  return nbRead;
}
Program: 44917
Project: 44917
Buggy source:
public RarFile(AbstractFile file) throws IOException {
  this.file=file;
  RarDebug.trace("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str");
  archive=new Archive(file.getInputStream());
}

Fixed version (ground truth):
public RarFile(AbstractFile file) throws IOException {
  this.file=file;
  RarDebug.trace("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str");
  InputStream fileIn=file.getInputStream();
  try {
    archive=new Archive(fileIn);
  }
  finally {
    fileIn.close();
  }
}
Program: 44918
Project: 44918
Buggy source:
public InputStream getEntryInputStream(String path) throws IOException {
  final FileHeader header=archive.getFileHeader(path);
  if (header.isSplitAfter())   throw new RarException(RarExceptionType.mvNotImplemented);
  final PipedInputStream in=new PipedInputStream();
  final PipedOutputStream out=new PipedOutputStream(in);
  threadPool.execute(new Runnable(){
    public void run(){
      BufferedOutputStream bufferStream=null;
      try {
        bufferStream=new BufferedOutputStream(out);
        boolean isSolid=header.isSolid();
        archive.extractEntry(isSolid,header,file.getInputStream(),bufferStream,isSolid ? file.getInputStream() : null);
        bufferStream.flush();
      }
 catch (      Exception ex) {
        RarDebug.trace("String_Node_Str" + header.getFileNameString() + "String_Node_Str"+ ex.getMessage());
        close(in);
        if (ex.getCause() != null && !ex.getCause().getLocalizedMessage().equals("String_Node_Str"))         throw new RuntimeException(ex);
      }
 finally {
        close(bufferStream);
      }
    }
  }
);
  return in;
}

Fixed version (ground truth):
public InputStream getEntryInputStream(String path) throws IOException {
  final FileHeader header=archive.getFileHeader(path);
  if (header.isSplitAfter())   throw new RarException(RarExceptionType.mvNotImplemented);
  final FailSafePipedInputStream in=new FailSafePipedInputStream();
  final PipedOutputStream out=new PipedOutputStream(in);
  threadPool.execute(new Runnable(){
    public void run(){
      BufferedOutputStream bufferStream=null;
      InputStream fileIn1=null;
      InputStream fileIn2=null;
      try {
        bufferStream=new BufferedOutputStream(out);
        boolean isSolid=header.isSolid();
        fileIn1=file.getInputStream();
        fileIn2=isSolid ? file.getInputStream() : null;
        archive.extractEntry(isSolid,header,fileIn1,bufferStream,fileIn2);
        bufferStream.flush();
      }
 catch (      Exception ex) {
        RarDebug.trace("String_Node_Str" + header.getFileNameString() + "String_Node_Str"+ ex.getMessage());
        in.setExternalFailure(ex instanceof IOException ? (IOException)ex : new IOException(ex.getMessage()));
        if (ex.getCause() != null && !ex.getCause().getLocalizedMessage().equals("String_Node_Str"))         throw new RuntimeException(ex);
      }
 finally {
        close(bufferStream);
        close(fileIn1);
        close(fileIn2);
      }
    }
  }
);
  return in;
}
Program: 44919
Project: 44919
Buggy source:
public void run(){
  BufferedOutputStream bufferStream=null;
  try {
    bufferStream=new BufferedOutputStream(out);
    boolean isSolid=header.isSolid();
    archive.extractEntry(isSolid,header,file.getInputStream(),bufferStream,isSolid ? file.getInputStream() : null);
    bufferStream.flush();
  }
 catch (  Exception ex) {
    RarDebug.trace("String_Node_Str" + header.getFileNameString() + "String_Node_Str"+ ex.getMessage());
    close(in);
    if (ex.getCause() != null && !ex.getCause().getLocalizedMessage().equals("String_Node_Str"))     throw new RuntimeException(ex);
  }
 finally {
    close(bufferStream);
  }
}

Fixed version (ground truth):
public void run(){
  BufferedOutputStream bufferStream=null;
  InputStream fileIn1=null;
  InputStream fileIn2=null;
  try {
    bufferStream=new BufferedOutputStream(out);
    boolean isSolid=header.isSolid();
    fileIn1=file.getInputStream();
    fileIn2=isSolid ? file.getInputStream() : null;
    archive.extractEntry(isSolid,header,fileIn1,bufferStream,fileIn2);
    bufferStream.flush();
  }
 catch (  Exception ex) {
    RarDebug.trace("String_Node_Str" + header.getFileNameString() + "String_Node_Str"+ ex.getMessage());
    in.setExternalFailure(ex instanceof IOException ? (IOException)ex : new IOException(ex.getMessage()));
    if (ex.getCause() != null && !ex.getCause().getLocalizedMessage().equals("String_Node_Str"))     throw new RuntimeException(ex);
  }
 finally {
    close(bufferStream);
    close(fileIn1);
    close(fileIn2);
  }
}
Program: 44920
Project: 44920
Buggy source:
public void run(){
  setLsCache(children,file.getDate());
}

Fixed version (ground truth):
public void run(){
  setLsCache(children2,file.getDate());
}
Program: 44921
Project: 44921
Buggy source:
/** 
 * Gets children of current directory. Files are filtered and then sorted. This method is executed in caching thread.
 */
private void lsAsync(){
  try {
    final AbstractFile[] children=file.ls(cache.getFilter());
    Arrays.sort(children,cache.getSort());
    if (getCachedIcon() == null) {
      setCachedIcon(FileIcons.getFileIcon(getProxiedFile()));
    }
    Icon icons[]=new Icon[children.length];
    for (int i=0; i < children.length; i++) {
      icons[i]=FileIcons.getFileIcon(children[i]);
    }
synchronized (cache) {
      for (int i=0; i < children.length; i++) {
        CachedDirectory cachedChild=cache.getOrAdd(children[i]);
        cachedChild.setCachedIcon(icons[i]);
      }
    }
    try {
      SwingUtilities.invokeAndWait(new Runnable(){
        public void run(){
          setLsCache(children,file.getDate());
        }
      }
);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
catch (    InvocationTargetException e) {
      e.printStackTrace();
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Gets children of current directory. Files are filtered and then sorted. This method is executed in caching thread.
 */
private void lsAsync(){
  if (getCachedIcon() == null) {
    setCachedIcon(FileIcons.getFileIcon(getProxiedFile()));
  }
  AbstractFile[] children=null;
  try {
    children=file.ls(cache.getFilter());
  }
 catch (  Exception e) {
    e.printStackTrace();
    children=new AbstractFile[0];
    cachedIcon=IconManager.getIcon(IconManager.FILE_ICON_SET,CustomFileIconProvider.NOT_ACCESSIBLE_FILE);
  }
  Arrays.sort(children,cache.getSort());
  Icon icons[]=new Icon[children.length];
  for (int i=0; i < children.length; i++) {
    icons[i]=FileIcons.getFileIcon(children[i]);
  }
synchronized (cache) {
    for (int i=0; i < children.length; i++) {
      CachedDirectory cachedChild=cache.getOrAdd(children[i]);
      cachedChild.setCachedIcon(icons[i]);
    }
  }
  final AbstractFile[] children2=children;
  try {
    SwingUtilities.invokeAndWait(new Runnable(){
      public void run(){
        setLsCache(children2,file.getDate());
      }
    }
);
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
catch (  InvocationTargetException e) {
    e.printStackTrace();
  }
}
Program: 44922
Project: 44922
Buggy source:
/** 
 * Refreshes folder after a change (e.g. mkdir).
 * @param folder
 */
public void refreshFolder(AbstractFile folder){
  if (!isVisible())   return;
  model.fireTreeStructureChanged(tree,new TreePath(model.getPathToRoot(folder)));
}

Fixed version (ground truth):
/** 
 * Refreshes folder after a change (e.g. mkdir).
 * @param folder a folder to refresh on the tree
 */
public void refreshFolder(AbstractFile folder){
  if (!isVisible())   return;
  model.fireTreeStructureChanged(tree,new TreePath(model.getPathToRoot(folder)));
}
Program: 44923
Project: 44923
Buggy source:
/** 
 * Updates selection in a tree to the current folder. When necessary updates the current root of a tree.
 */
private void updateSelectedFolder(){
  final AbstractFile currentFolder=folderPanel.getCurrentFolder();
  AbstractFile tempFolder=currentFolder;
  AbstractFile tempParent;
  while (!tempFolder.isDirectory()) {
    tempParent=currentFolder.getParentSilently();
    if (tempParent == null)     break;
    tempFolder=tempParent;
  }
  final AbstractFile selectedFolder=tempFolder;
  TreePath selectionPath=tree.getSelectionPath();
  if (selectionPath != null) {
    if (selectionPath.getLastPathComponent() == currentFolder)     return;
  }
  try {
    final AbstractFile currentRoot=selectedFolder.getRoot();
    if (!currentRoot.equals(model.getRoot())) {
      model.setRoot(currentRoot);
    }
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        try {
          TreePath path=new TreePath(model.getPathToRoot(selectedFolder));
          tree.expandPath(path);
          tree.setSelectionPath(path);
          tree.scrollPathToVisible(path);
        }
 catch (        Exception e) {
          e.printStackTrace();
        }
      }
    }
);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Updates selection in a tree to the current folder. When necessary updates the current root of a tree. Invoked when location on folder pane has changed or  when a tree has been updated (when directories have been loaded).
 */
private void updateSelectedFolder(){
  final AbstractFile currentFolder=folderPanel.getCurrentFolder();
  AbstractFile tempFolder=currentFolder;
  AbstractFile tempParent;
  while (!tempFolder.isDirectory()) {
    tempParent=currentFolder.getParentSilently();
    if (tempParent == null)     break;
    tempFolder=tempParent;
  }
  final AbstractFile selectedFolder=tempFolder;
  TreePath selectionPath=tree.getSelectionPath();
  if (selectionPath != null) {
    if (selectionPath.getLastPathComponent() == currentFolder)     return;
  }
  try {
    final AbstractFile currentRoot=selectedFolder.getRoot();
    if (!currentRoot.equals(model.getRoot())) {
      model.setRoot(currentRoot);
    }
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        try {
          TreePath path=new TreePath(model.getPathToRoot(selectedFolder));
          tree.expandPath(path);
          tree.setSelectionPath(path);
          tree.scrollPathToVisible(path);
        }
 catch (        Exception e) {
          e.printStackTrace();
        }
      }
    }
);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 44924
Project: 44924
Buggy source:
public InputStream getEntryInputStream(String path) throws IOException {
  final FileHeader header=archive.getFileHeader(path);
  final PipedInputStream in=new PipedInputStream();
  final PipedOutputStream out=new PipedOutputStream(in);
  threadPool.execute(new Runnable(){
    public void run(){
      BufferedOutputStream bufferStream=null;
      try {
        bufferStream=new BufferedOutputStream(out);
        boolean isSolid=header.isSolid();
        archive.extractEntry(isSolid,header,file.getInputStream(),bufferStream,isSolid ? file.getInputStream() : null);
        bufferStream.flush();
      }
 catch (      Exception ex) {
        RarDebug.trace("String_Node_Str" + header.getFileNameString() + "String_Node_Str"+ ex.getMessage());
        close(in);
        if (ex.getCause() != null && !ex.getCause().getLocalizedMessage().equals("String_Node_Str"))         throw new RuntimeException(ex);
      }
 finally {
        close(bufferStream);
      }
    }
  }
);
  return in;
}

Fixed version (ground truth):
public InputStream getEntryInputStream(String path) throws IOException {
  final FileHeader header=archive.getFileHeader(path);
  if (header.isSplitAfter())   throw new RarException(RarExceptionType.mvNotImplemented);
  final PipedInputStream in=new PipedInputStream();
  final PipedOutputStream out=new PipedOutputStream(in);
  threadPool.execute(new Runnable(){
    public void run(){
      BufferedOutputStream bufferStream=null;
      try {
        bufferStream=new BufferedOutputStream(out);
        boolean isSolid=header.isSolid();
        archive.extractEntry(isSolid,header,file.getInputStream(),bufferStream,isSolid ? file.getInputStream() : null);
        bufferStream.flush();
      }
 catch (      Exception ex) {
        RarDebug.trace("String_Node_Str" + header.getFileNameString() + "String_Node_Str"+ ex.getMessage());
        close(in);
        if (ex.getCause() != null && !ex.getCause().getLocalizedMessage().equals("String_Node_Str"))         throw new RuntimeException(ex);
      }
 finally {
        close(bufferStream);
      }
    }
  }
);
  return in;
}
Program: 44926
Project: 44926
Buggy source:
public static boolean mergeArchive(Archive archive,ComprDataIO dataIO) throws IOException {
  return true;
}

Fixed version (ground truth):
public static boolean mergeArchive(Archive archive,ComprDataIO dataIO) throws IOException {
  throw new RarException(RarExceptionType.mvNotImplemented);
}
Program: 44928
Project: 44928
Buggy source:
public static String decode(String name,byte[] encName){
  UnsignedByte flags=null;
  int flagsBits=0;
  int flagsPos=0;
  int destSize=0;
  int encPos=0, decPos=0;
  UnsignedByte highByte=new UnsignedByte(encName[encPos++]);
  String nameW="String_Node_Str";
  while (encPos < encName.length) {
    if (flagsBits == 0) {
      flags=new UnsignedByte(encName[encPos++]);
      flagsBits=8;
    }
switch (flags.getValue() >> 6) {
case 0:
      nameW+=byteToChar(encName[encPos++]);
    decPos++;
  break;
case 1:
{
  UnsignedByte ubyte=new UnsignedByte(encName[encPos++]);
  ubyte.add((short)(highByte.getValue() << 8));
  nameW+=ubyte.toChar();
  decPos++;
}
break;
case 2:
nameW+=(char)((encName[encPos] + (encName[encPos + 1] << 8)) & 0xff);
decPos++;
encPos+=2;
break;
case 3:
{
int length=encName[encPos++];
if ((length & 0x80) != 0) {
byte correction=encName[encPos++];
for (length=(length & 0x7f) + 2; length > 0; length--, decPos++) nameW+=((name.charAt(decPos) + correction));
}
 else for (length+=2; length > 0; length--, decPos++) nameW+=name.charAt(decPos);
}
break;
}
flags=new UnsignedByte((byte)(flags.getValue() << 2));
flagsBits-=2;
}
return nameW;
}

Fixed version (ground truth):
public static String decode(byte[] name,int encPos){
  int decPos=0;
  int flags=0;
  int flagBits=0;
  int low=0;
  int high=0;
  int highByte=getChar(name,encPos++);
  StringBuffer buf=new StringBuffer();
  while (encPos < name.length) {
    if (flagBits == 0) {
      flags=getChar(name,encPos++);
      flagBits=8;
    }
switch (flags >> 6) {
case 0:
      buf.append((char)(getChar(name,encPos++)));
    ++decPos;
  break;
case 1:
buf.append((char)(getChar(name,encPos++) + (highByte << 8)));
++decPos;
break;
case 2:
low=getChar(name,encPos);
high=getChar(name,encPos + 1);
buf.append((char)((high << 8) + low));
++decPos;
encPos+=2;
break;
case 3:
int length=getChar(name,encPos++);
if ((length & 0x80) != 0) {
int correction=getChar(name,encPos++);
for (length=(length & 0x7f) + 2; length > 0 && decPos < name.length; length--, decPos++) {
low=(getChar(name,decPos) + correction) & 0xff;
buf.append((char)((highByte << 8) + low));
}
}
 else {
for (length+=2; length > 0 && decPos < name.length; length--, decPos++) {
buf.append((char)(getChar(name,decPos)));
}
}
break;
}
flags=(flags << 2) & 0xff;
flagBits-=2;
}
return buf.toString();
}
Program: 44929
Project: 44929
Buggy source:
/** 
 * Creates a new CommandBar instance associated with the given MainFrame.
 */
public CommandBar(MainFrame mainFrame){
  super(new GridLayout(0,actions.length));
  this.mainFrame=mainFrame;
  mainFrame.getLeftPanel().getFileTable().addKeyListener(this);
  mainFrame.getRightPanel().getFileTable().addKeyListener(this);
  addMouseListener(this);
  MuConfiguration.addConfigurationListener(this);
  int nbButtons=actions.length;
  buttons=new JButton[nbButtons];
  for (int i=0; i < nbButtons; i++) {
    MuAction action=ActionManager.getActionInstance(actions[i],mainFrame);
    JButton button=new NonFocusableButton();
    if (OsFamilies.MAC_OS_X.isCurrent() && OsVersions.MAC_OS_X_10_5.isCurrentOrHigher() && JavaVersions.JAVA_1_5.isCurrentOrHigher()) {
      button.setMargin(new Insets(6,8,6,8));
      button.putClientProperty("String_Node_Str","String_Node_Str");
      button.putClientProperty("String_Node_Str","String_Node_Str");
    }
 else {
      button.setMargin(new Insets(3,4,3,4));
    }
    setButtonAction(button,action);
    button.setMinimumSize(new Dimension(40,(int)button.getPreferredSize().getHeight()));
    button.addMouseListener(this);
    add(button);
    buttons[i]=button;
  }
}

Fixed version (ground truth):
/** 
 * Creates a new CommandBar instance associated with the given MainFrame.
 */
public CommandBar(MainFrame mainFrame){
  super(new GridLayout(0,actions.length));
  this.mainFrame=mainFrame;
  mainFrame.getLeftPanel().getFileTable().addKeyListener(this);
  mainFrame.getRightPanel().getFileTable().addKeyListener(this);
  addMouseListener(this);
  MuConfiguration.addConfigurationListener(this);
  int nbButtons=actions.length;
  buttons=new JButton[nbButtons];
  for (int i=0; i < nbButtons; i++) {
    MuAction action=ActionManager.getActionInstance(actions[i],mainFrame);
    JButton button=new NonFocusableButton();
    if (OsFamilies.MAC_OS_X.isCurrent() && OsVersions.MAC_OS_X_10_5.isCurrentOrHigher() && JavaVersions.JAVA_1_5.isCurrentOrHigher()) {
      button.putClientProperty("String_Node_Str","String_Node_Str");
      button.putClientProperty("String_Node_Str","String_Node_Str");
    }
 else {
      button.setMargin(new Insets(3,4,3,4));
    }
    setButtonAction(button,action);
    button.setMinimumSize(new Dimension(40,(int)button.getPreferredSize().getHeight()));
    button.addMouseListener(this);
    add(button);
    buttons[i]=button;
  }
}
Program: 44931
Project: 44931
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);
  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")));
  okButton.setEnabled(false);
  applyButton.setEnabled(false);
  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: 44932
Project: 44932
Buggy source:
/** 
 * Calls   {@link PreferencesPanel#commit()} on all registered preference panels.
 */
public void commit(){
  int nbPanels=prefPanels.size();
  for (int i=0; i < nbPanels; i++)   ((PreferencesPanel)prefPanels.elementAt(i)).commit();
}

Fixed version (ground truth):
/** 
 * Calls   {@link PreferencesPanel#commit()} on all registered preference panels.
 */
public void commit(){
  int nbPanels=prefPanels.size();
  for (int i=0; i < nbPanels; i++)   ((PreferencesPanel)prefPanels.elementAt(i)).commit();
  setCommitButtonsEnabled(false);
}