nus-yam/ex-repair huggingface dataset:
Program: 44817
Project: 44817
Buggy source:
public Object getValue(String name){
  Map valueMap=getValueMap();
  Object ret=valueMap.get(name);
  if (ret == null) {
    try {
      int columnIndex=Integer.parseInt(name);
      ret=result.getValue(getRowIndex(),columnIndex);
      if (SGELog.isLoggable(Level.FINE)) {
        SGELog.fine("String_Node_Str" + getRowIndex() + "String_Node_Str"+ name+ "String_Node_Str"+ ret);
      }
      valueMap.put(name,ret);
    }
 catch (    NumberFormatException ex) {
      throw new IllegalStateException(name + "String_Node_Str");
    }
  }
  return ret;
}

Fixed version (ground truth):
public Object getValue(String name){
  Map valueMap=getValueMap();
  SGELog.info("String_Node_Str",name);
  Object ret=valueMap.get(name);
  if (ret == null) {
    try {
      int columnIndex=Integer.parseInt(name);
      ret=result.getValue(getRowIndex(),columnIndex);
      if (SGELog.isLoggable(Level.FINE)) {
        SGELog.fine("String_Node_Str" + getRowIndex() + "String_Node_Str"+ name+ "String_Node_Str"+ ret);
      }
      valueMap.put(name,ret);
    }
 catch (    NumberFormatException ex) {
      throw new IllegalStateException(name + "String_Node_Str");
    }
  }
  return ret;
}
Program: 44818
Project: 44818
Buggy source:
private void writeSFCJavascript(PrintWriter pw,boolean enabled){
  if (enabled) {
    pw.print("String_Node_Str" + CHILD_VIEW_SFR_RADIO_BUTTON + "String_Node_Str");
    pw.print("String_Node_Str" + CHILD_VIEW_SERIES_TYPE_FIELD + "String_Node_Str"+ ArcoConstants.CHART_SERIES_FROM_COL+ "String_Node_Str");
  }
 else {
    pw.print("String_Node_Str" + CHILD_VIEW_SFC_RADIO_BUTTON + "String_Node_Str");
    pw.print("String_Node_Str" + CHILD_VIEW_SERIES_TYPE_FIELD + "String_Node_Str"+ ArcoConstants.CHART_SERIES_FROM_ROW+ "String_Node_Str");
  }
  pw.print("String_Node_Str" + CHILD_VIEW_LABEL_DROP_DOWN + "String_Node_Str"+ enabled+ "String_Node_Str");
  pw.print("String_Node_Str" + CHILD_VIEW_VALUE_DROP_DOWN + "String_Node_Str"+ enabled+ "String_Node_Str");
}

Fixed version (ground truth):
private void writeSFCJavascript(PrintWriter pw,boolean enabled){
  if (enabled) {
    pw.print("String_Node_Str" + CHILD_VIEW_SFR_RADIO_BUTTON + "String_Node_Str");
    pw.print("String_Node_Str" + CHILD_VIEW_SERIES_TYPE_FIELD + "String_Node_Str"+ ArcoConstants.CHART_SERIES_FROM_COL+ "String_Node_Str");
  }
 else {
    pw.print("String_Node_Str" + CHILD_VIEW_SFC_RADIO_BUTTON + "String_Node_Str");
    pw.print("String_Node_Str" + CHILD_VIEW_SERIES_TYPE_FIELD + "String_Node_Str"+ ArcoConstants.CHART_SERIES_FROM_ROW+ "String_Node_Str");
  }
  writeEnabledDisabled(pw,enabled);
}
Program: 44820
Project: 44820
Buggy source:
private void writeButtonProperty(PrintWriter pw,String name,String resourceName){
  pw.println("String_Node_Str" + name + "String_Node_Str");
  pw.println("String_Node_Str" + resourceName + "String_Node_Str");
  pw.println("String_Node_Str");
  pw.println("String_Node_Str");
}

Fixed version (ground truth):
private void writeButtonProperty(PrintWriter pw,String name,String resourceName){
  pw.println("String_Node_Str" + name + "String_Node_Str");
  pw.println("String_Node_Str" + resourceName + "String_Node_Str");
  pw.println("String_Node_Str");
  pw.println("String_Node_Str");
  pw.println("String_Node_Str");
}
Program: 44822
Project: 44822
Buggy source:
/** 
 * Returns a user-defined list of preferred encodings.
 * @return a user-defined list of preferred encodings.
 */
public static Vector<String> getPreferredEncodings(){
  Vector<String> vector=MuConfiguration.getListVariable(MuConfiguration.PREFERRED_ENCODINGS,"String_Node_Str");
  if (vector == null) {
    vector=getDefaultPreferredEncodings();
    MuConfiguration.setVariable(MuConfiguration.PREFERRED_ENCODINGS,vector,"String_Node_Str");
  }
  return vector;
}

Fixed version (ground truth):
/** 
 * Returns a user-defined list of preferred encodings.
 * @return a user-defined list of preferred encodings.
 */
public static List<String> getPreferredEncodings(){
  List<String> vector=MuConfiguration.getListVariable(MuConfiguration.PREFERRED_ENCODINGS,"String_Node_Str");
  if (vector == null) {
    vector=getDefaultPreferredEncodings();
    MuConfiguration.setVariable(MuConfiguration.PREFERRED_ENCODINGS,vector,"String_Node_Str");
  }
  return vector;
}
Program: 44823
Project: 44823
Buggy source:
/** 
 * Adds a checkbox menu item for each of the preferred encodings, and a special item that invokes a dialog that allows the list of preferred encodings to be customized.
 * @param selectEncoding the encoding that will be selected, <code>null</code> for the first one
 */
protected void populateComboBox(String selectEncoding){
  Vector<String> encodings=EncodingPreferences.getPreferredEncodings();
  if (selectEncoding != null && !encodings.contains(selectEncoding))   selectEncoding=null;
  int nbEncodings=encodings.size();
  for (int i=0; i < nbEncodings; i++)   comboBox.addItem(encodings.elementAt(i));
  if (selectEncoding != null) {
    comboBox.setSelectedItem(selectEncoding);
    currentEncoding=selectEncoding;
  }
 else   if (nbEncodings > 0) {
    comboBox.setSelectedItem(encodings.elementAt(0));
    currentEncoding=selectEncoding;
  }
}

Fixed version (ground truth):
/** 
 * Adds a checkbox menu item for each of the preferred encodings, and a special item that invokes a dialog that allows the list of preferred encodings to be customized.
 * @param selectEncoding the encoding that will be selected, <code>null</code> for the first one
 */
protected void populateComboBox(String selectEncoding){
  java.util.List<String> encodings=EncodingPreferences.getPreferredEncodings();
  if (selectEncoding != null && !encodings.contains(selectEncoding))   selectEncoding=null;
  int nbEncodings=encodings.size();
  for (  String encoding : encodings)   comboBox.addItem(encoding);
  if (selectEncoding != null) {
    comboBox.setSelectedItem(selectEncoding);
    currentEncoding=selectEncoding;
  }
 else   if (nbEncodings > 0) {
    comboBox.setSelectedItem(encodings.get(0));
    currentEncoding=selectEncoding;
  }
}
Program: 44824
Project: 44824
Buggy source:
/** 
 * Selects all the checkboxes which correspond to an encoding that is present in the given vector.
 * @param selectedEncodings list of encodings to select
 */
protected void selectCheckboxes(Vector<String> selectedEncodings){
  JCheckBox checkbox;
  int nbCheckboxes=checkboxes.size();
  for (int i=0; i < nbCheckboxes; i++) {
    checkbox=checkboxes.elementAt(i);
    checkbox.setSelected(selectedEncodings.contains(checkbox.getText()));
  }
}

Fixed version (ground truth):
/** 
 * Selects all the checkboxes which correspond to an encoding that is present in the given vector.
 * @param selectedEncodings list of encodings to select
 */
protected void selectCheckboxes(java.util.List<String> selectedEncodings){
  JCheckBox checkbox;
  int nbCheckboxes=checkboxes.size();
  for (int i=0; i < nbCheckboxes; i++) {
    checkbox=checkboxes.elementAt(i);
    checkbox.setSelected(selectedEncodings.contains(checkbox.getText()));
  }
}
Program: 44825
Project: 44825
Buggy source:
public FilePresenter(){
  super(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
}

Fixed version (ground truth):
public FilePresenter(){
  super(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  addFocusListener(new FocusListener(){
    @Override public void focusLost(    FocusEvent e){
    }
    @Override public void focusGained(    FocusEvent e){
      Component component=FilePresenter.this.getViewport().getComponent(0);
      if (component != null)       component.requestFocus();
    }
  }
);
}
Program: 44826
Project: 44826
Buggy source:
public ImageViewer(){
  imageViewerImpl=new ImageViewerImpl();
  addComponentToPresent(imageViewerImpl);
  MnemonicHelper menuMnemonicHelper=new MnemonicHelper();
  controlsMenu=MenuToolkit.addMenu(Translator.get("String_Node_Str"),menuMnemonicHelper,null);
  zoomInItem=MenuToolkit.addMenuItem(controlsMenu,Translator.get("String_Node_Str"),menuMnemonicHelper,KeyStroke.getKeyStroke(KeyEvent.VK_ADD,0),this);
  zoomOutItem=MenuToolkit.addMenuItem(controlsMenu,Translator.get("String_Node_Str"),menuMnemonicHelper,KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT,0),this);
}

Fixed version (ground truth):
public ImageViewer(){
  imageViewerImpl=new ImageViewerImpl();
  setComponentToPresent(imageViewerImpl);
  MnemonicHelper menuMnemonicHelper=new MnemonicHelper();
  controlsMenu=MenuToolkit.addMenu(Translator.get("String_Node_Str"),menuMnemonicHelper,null);
  zoomInItem=MenuToolkit.addMenuItem(controlsMenu,Translator.get("String_Node_Str"),menuMnemonicHelper,KeyStroke.getKeyStroke(KeyEvent.VK_ADD,0),this);
  zoomOutItem=MenuToolkit.addMenuItem(controlsMenu,Translator.get("String_Node_Str"),menuMnemonicHelper,KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT,0),this);
}
Program: 44828
Project: 44828
Buggy source:
TextViewer(TextEditorImpl textEditorImpl){
  this.textEditorImpl=textEditorImpl;
  addComponentToPresent(textEditorImpl.getTextArea());
  showLineNumbers(MuConfiguration.getVariable(MuConfiguration.LINE_NUMBERS,MuConfiguration.DEFAULT_LINE_NUMBERS));
  textEditorImpl.wrap(MuConfiguration.getVariable(MuConfiguration.WORD_WRAP,MuConfiguration.DEFAULT_WORD_WRAP));
  initMenuBarItems();
}

Fixed version (ground truth):
TextViewer(TextEditorImpl textEditorImpl){
  this.textEditorImpl=textEditorImpl;
  setComponentToPresent(textEditorImpl.getTextArea());
  showLineNumbers(MuConfiguration.getVariable(MuConfiguration.LINE_NUMBERS,MuConfiguration.DEFAULT_LINE_NUMBERS));
  textEditorImpl.wrap(MuConfiguration.getVariable(MuConfiguration.WORD_WRAP,MuConfiguration.DEFAULT_WORD_WRAP));
  initMenuBarItems();
}
Program: 44829
Project: 44829
Buggy source:
/** 
 * @return
 * @throws IOException
 */
public Collection getEntries(){
  return archive.getFileHeaders();
}

Fixed version (ground truth):
public Collection getEntries(){
  return archive.getFileHeaders();
}
Program: 44830
Project: 44830
Buggy source:
/** 
 * create a new archive object using the given file
 * @param file the file to extract
 * @throws RarException
 */
public Archive(InputStream in) throws RarException, IOException {
  parseHeaders(in);
  dataIO=new ComprDataIO(this);
}

Fixed version (ground truth):
/** 
 * create a new archive object using the given stream
 * @param in the stream to extract
 * @throws RarException
 */
public Archive(InputStream in) throws RarException, IOException {
  parseHeaders(in);
  dataIO=new ComprDataIO(this);
}
Program: 44831
Project: 44831
Buggy source:
/** 
 * Extract the file specified by the given header and write it to the supplied output stream.
 * @param isHeaderSolid - true if the given header represent a solid entry.
 * @param header - given FileHeader.
 * @param in1 - input stream to the archive file.
 * @param os 
 * @param in2 - if isSolid==true, is an input stream to the archive file. null otherwise.
 * @throws Exception.
 */
public void extractEntry(boolean isHeaderSolid,FileHeader header,InputStream in1,OutputStream os,InputStream in2) throws Exception {
  if (isHeaderSolid) {
    int headerIndex=((Integer)indexMap.get(header.getFileNameString())).intValue();
    FileHeader entry=null;
    for (int i=headerIndex - 1; i >= 0; --i)     if (!(entry=(FileHeader)entries.get(i)).isSolid())     break;
    extractSolidEntry(entry,header,os,in1,in2);
  }
 else {
    extractNotSolidEntry(header,os,in1);
  }
}

Fixed version (ground truth):
/** 
 * Extract the file specified by the given header and write it to the supplied output stream.
 * @param isHeaderSolid - true if the given header represent a solid entry.
 * @param header - given FileHeader.
 * @param in1 - input stream to the archive file.
 * @param os 
 * @param in2 - if isSolid==true, is an input stream to thearchive file. null otherwise.
 * @throws Exception
 */
public void extractEntry(boolean isHeaderSolid,FileHeader header,InputStream in1,OutputStream os,InputStream in2) throws Exception {
  if (isHeaderSolid) {
    int headerIndex=((Integer)indexMap.get(header.getFileNameString())).intValue();
    FileHeader entry=null;
    for (int i=headerIndex - 1; i >= 0; --i)     if (!(entry=(FileHeader)entries.get(i)).isSolid())     break;
    extractSolidEntry(entry,header,os,in1,in2);
  }
 else {
    extractNotSolidEntry(header,os,in1);
  }
}
Program: 44832
Project: 44832
Buggy source:
/** 
 * @param pos the position in the file
 * @return success ? true : false 
 */
public void setPosition(long pos) throws IOException ;

Fixed version (ground truth):
/** 
 * @param pos the position in the file
 */
public void setPosition(long pos) throws IOException ;
Program: 44833
Project: 44833
Buggy source:
/** 
 * the filename is also present in unicode
 * @return
 */
public boolean isUnicode(){
  return (flags & LHD_UNICODE) != 0;
}

Fixed version (ground truth):
/** 
 * the filename is also present in unicode
 */
public boolean isUnicode(){
  return (flags & LHD_UNICODE) != 0;
}
Program: 44834
Project: 44834
Buggy source:
/** 
 * the file will be continued in the next archive part
 * @return
 */
public boolean isSplitAfter(){
  return (this.flags & BlockHeader.LHD_SPLIT_AFTER) != 0;
}

Fixed version (ground truth):
/** 
 * the file will be continued in the next archive part
 */
public boolean isSplitAfter(){
  return (this.flags & BlockHeader.LHD_SPLIT_AFTER) != 0;
}
Program: 44835
Project: 44835
Buggy source:
/** 
 * this file is compressed as solid (all files handeled as one)
 * @return
 */
public boolean isSolid(){
  return (this.flags & LHD_SOLID) != 0;
}

Fixed version (ground truth):
/** 
 * this file is compressed as solid (all files handeled as one)
 */
public boolean isSolid(){
  return (this.flags & LHD_SOLID) != 0;
}
Program: 44836
Project: 44836
Buggy source:
/** 
 * the file is continued in this archive
 * @return
 */
public boolean isSplitBefore(){
  return (this.flags & LHD_SPLIT_BEFORE) != 0;
}

Fixed version (ground truth):
/** 
 * the file is continued in this archive
 */
public boolean isSplitBefore(){
  return (this.flags & LHD_SPLIT_BEFORE) != 0;
}
Program: 44837
Project: 44837
Buggy source:
/** 
 * the file is encrypted
 * @return
 */
public boolean isEncrypted(){
  return (this.flags & BlockHeader.LHD_PASSWORD) != 0;
}

Fixed version (ground truth):
/** 
 * the file is encrypted
 */
public boolean isEncrypted(){
  return (this.flags & BlockHeader.LHD_PASSWORD) != 0;
}
Program: 44838
Project: 44838
Buggy source:
/** 
 * whether this fileheader represents a directory
 * @return
 */
public boolean isDirectory(){
  return (flags & LHD_WINDOWMASK) == LHD_DIRECTORY;
}

Fixed version (ground truth):
/** 
 * whether this fileheader represents a directory
 */
public boolean isDirectory(){
  return (flags & LHD_WINDOWMASK) == LHD_DIRECTORY;
}
Program: 44839
Project: 44839
Buggy source:
/** 
 * return whether the archive is a multivolume archive
 * @return
 */
public boolean isMultiVolume(){
  return (this.flags & BaseBlock.MHD_VOLUME) != 0;
}

Fixed version (ground truth):
/** 
 * return whether the archive is a multivolume archive
 */
public boolean isMultiVolume(){
  return (this.flags & BaseBlock.MHD_VOLUME) != 0;
}
Program: 44840
Project: 44840
Buggy source:
/** 
 * the version the the encryption 
 * @return
 */
public byte getEncryptVersion(){
  return encryptVersion;
}

Fixed version (ground truth):
/** 
 * the version the the encryption 
 */
public byte getEncryptVersion(){
  return encryptVersion;
}
Program: 44841
Project: 44841
Buggy source:
/** 
 * returns whether this archive is solid. in this case you can only extract all file at once
 * @return
 */
public boolean isSolid(){
  return (this.flags & MHD_SOLID) != 0;
}

Fixed version (ground truth):
/** 
 * returns whether this archive is solid. in this case you can only extract all file at once
 */
public boolean isSolid(){
  return (this.flags & MHD_SOLID) != 0;
}
Program: 44842
Project: 44842
Buggy source:
/** 
 * if the archive is a multivolume archive this method returns whether this instance is the first part of the multivolume archive
 * @return
 */
public boolean isFirstVolume(){
  return (this.flags & BaseBlock.MHD_FIRSTVOLUME) != 0;
}

Fixed version (ground truth):
/** 
 * if the archive is a multivolume archive this method returns whether this instance is the first part of the multivolume archive
 */
public boolean isFirstVolume(){
  return (this.flags & BaseBlock.MHD_FIRSTVOLUME) != 0;
}
Program: 44843
Project: 44843
Buggy source:
/** 
 * returns whether the archive is encrypted 
 * @return
 */
public boolean isEncrypted(){
  return (this.flags & BaseBlock.MHD_PASSWORD) != 0;
}

Fixed version (ground truth):
/** 
 * returns whether the archive is encrypted 
 */
public boolean isEncrypted(){
  return (this.flags & BaseBlock.MHD_PASSWORD) != 0;
}
Program: 44844
Project: 44844
Buggy source:
/** 
 * the numbering format a multivolume archive
 * @return
 */
public boolean isNewNumbering(){
  return (this.flags & MHD_NEWNUMBERING) != 0;
}

Fixed version (ground truth):
/** 
 * the numbering format a multivolume archive
 */
public boolean isNewNumbering(){
  return (this.flags & MHD_NEWNUMBERING) != 0;
}
Program: 44845
Project: 44845
Buggy source:
/** 
 * @return
 */
public byte getLevel(){
  return level;
}

Fixed version (ground truth):
public byte getLevel(){
  return level;
}
Program: 44846
Project: 44846
Buggy source:
/** 
 * @return
 */
public SubBlockHeaderType getSubType(){
  return SubBlockHeaderType.findSubblockHeaderType(subType);
}

Fixed version (ground truth):
public SubBlockHeaderType getSubType(){
  return SubBlockHeaderType.findSubblockHeaderType(subType);
}
Program: 44847
Project: 44847
Buggy source:
/** 
 * find the header type for the given short value
 * @param SubType the short value
 * @return the correspo nding enum or null
 */
public static SubBlockHeaderType findSubblockHeaderType(short type){
  return types[type - 0x100];
}

Fixed version (ground truth):
/** 
 * find the header type for the given short value
 * @param type the short value
 * @return the correspo nding enum or null
 */
public static SubBlockHeaderType findSubblockHeaderType(short type){
  return types[type - 0x100];
}
Program: 44848
Project: 44848
Buggy source:
/** 
 * needs to set the fields of this object to the values in the byte[]  at the given position. be aware of the byte order
 * @param pos the position this object should point to
 * @return true if the address could be set
 */
public void setAddress(int pos){
  if (mem == null)   System.err.println("String_Node_Str");
  if (!((pos >= 0) && (pos < mem.length)))   System.err.println("String_Node_Str" + pos + "String_Node_Str");
  this.pos=pos;
}

Fixed version (ground truth):
/** 
 * needs to set the fields of this object to the values in the byte[]  at the given position. be aware of the byte order
 * @param pos the position this object should point to
 */
public void setAddress(int pos){
  if (mem == null)   System.err.println("String_Node_Str");
  if (!((pos >= 0) && (pos < mem.length)))   System.err.println("String_Node_Str" + pos + "String_Node_Str");
  this.pos=pos;
}
Program: 44850
Project: 44850
Buggy source:
/** 
 * Listens to certain configuration variables.
 */
public void configurationChanged(ConfigurationEvent event){
  String var=event.getVariable();
  if (var.equals(MuConfiguration.DISPLAY_COMPACT_FILE_SIZE) || var.equals(MuConfiguration.DATE_FORMAT) || var.equals(MuConfiguration.DATE_SEPARATOR)|| var.equals(MuConfiguration.TIME_FORMAT)) {
    CustomDateFormat.updateDateFormat();
    tableModel.fillCellCache();
    resizeAndRepaint();
  }
 else   if (var.equals(MuConfiguration.TABLE_ICON_SCALE)) {
    setRowHeight();
  }
 else   if (var.equals(MuConfiguration.USE_SYSTEM_FILE_ICONS))   repaint();
}

Fixed version (ground truth):
/** 
 * Listens to certain configuration variables.
 */
public void configurationChanged(ConfigurationEvent event){
  String var=event.getVariable();
  if (var.equals(MuConfiguration.DISPLAY_COMPACT_FILE_SIZE)) {
    FileTableModel.setSizeFormat(event.getBooleanValue());
    tableModel.fillCellCache();
    resizeAndRepaint();
  }
 else   if (var.equals(MuConfiguration.DATE_FORMAT) || var.equals(MuConfiguration.DATE_SEPARATOR) || var.equals(MuConfiguration.TIME_FORMAT)) {
    CustomDateFormat.updateDateFormat();
    tableModel.fillCellCache();
    resizeAndRepaint();
  }
 else   if (var.equals(MuConfiguration.TABLE_ICON_SCALE)) {
    setRowHeight();
  }
 else   if (var.equals(MuConfiguration.USE_SYSTEM_FILE_ICONS))   repaint();
}
Program: 44851
Project: 44851
Buggy source:
/** 
 * Sets the SizeFormat format used to create the size column's string.
 * @param compactSize true to use a compact size format, false for full size in bytes 
 */
private static void setSizeFormat(boolean compactSize){
  if (compactSize)   sizeFormat=SizeFormat.DIGITS_MEDIUM | SizeFormat.UNIT_SHORT | SizeFormat.ROUND_TO_KB;
 else   sizeFormat=SizeFormat.DIGITS_FULL | SizeFormat.UNIT_NONE;
  sizeFormat|=SizeFormat.INCLUDE_SPACE;
}

Fixed version (ground truth):
/** 
 * Sets the SizeFormat format used to create the size column's string.
 * @param compactSize true to use a compact size format, false for full size in bytes 
 */
static void setSizeFormat(boolean compactSize){
  if (compactSize)   sizeFormat=SizeFormat.DIGITS_MEDIUM | SizeFormat.UNIT_SHORT | SizeFormat.ROUND_TO_KB;
 else   sizeFormat=SizeFormat.DIGITS_FULL | SizeFormat.UNIT_NONE;
  sizeFormat|=SizeFormat.INCLUDE_SPACE;
}
Program: 44852
Project: 44852
Buggy source:
@Override public void renameTo(AbstractFile destFile) throws IOException, UnsupportedFileOperationException {
  checkRenamePrerequisites(destFile,true,false);
  destFile=destFile.getTopAncestor();
  File destJavaIoFile=((LocalFile)destFile).file;
  if (IS_WINDOWS) {
    if (!getRoot().equals(destFile.getRoot()))     throw new IOException();
    if (OsVersions.WINDOWS_ME.isCurrentOrLower()) {
      if (destFile.exists())       if (!destJavaIoFile.delete())       throw new IOException();
    }
 else     if (Kernel32.isAvailable()) {
      if (!Kernel32.getInstance().MoveFileEx(absPath,destFile.getAbsolutePath(),Kernel32API.MOVEFILE_REPLACE_EXISTING | Kernel32API.MOVEFILE_WRITE_THROUGH))       throw new IOException();
    }
  }
  if (!file.renameTo(destJavaIoFile))   throw new IOException();
}

Fixed version (ground truth):
@Override public void renameTo(AbstractFile destFile) throws IOException, UnsupportedFileOperationException {
  checkRenamePrerequisites(destFile,true,false);
  destFile=destFile.getTopAncestor();
  File destJavaIoFile=((LocalFile)destFile).file;
  if (IS_WINDOWS) {
    if (!getRoot().equals(destFile.getRoot()))     throw new IOException();
    if (OsVersions.WINDOWS_ME.isCurrentOrLower()) {
      if (destFile.exists())       if (!destJavaIoFile.delete())       throw new IOException();
    }
 else     if (Kernel32.isAvailable()) {
      if (!Kernel32.getInstance().MoveFileEx(absPath,destFile.getAbsolutePath(),Kernel32API.MOVEFILE_REPLACE_EXISTING | Kernel32API.MOVEFILE_WRITE_THROUGH)) {
        String errorMessage=Integer.toString(Kernel32.getInstance().GetLastError());
        throw new IOException("String_Node_Str" + errorMessage);
      }
 else {
        return;
      }
    }
  }
  if (!file.renameTo(destJavaIoFile))   throw new IOException();
}
Program: 44853
Project: 44853
Buggy source:
private boolean areActionsChanged(){
  String[] commandBarActionIds=CommandBarAttributes.getActions();
  int nbActions=commandBarActionIds.length;
  for (int i=0; i < nbActions; ++i) {
    CommandBarButtonForDisplay buttonI=(CommandBarButtonForDisplay)commandBarButtons.get(i);
    if (buttonI == null) {
      if (commandBarActionIds[i] != null)       return true;
    }
 else     if (!buttonI.getActionId().equals(commandBarActionIds[i]))     return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean areActionsChanged(){
  String[] commandBarActionIds=CommandBarAttributes.getActions();
  int nbActions=commandBarActionIds.length;
  if (nbActions != commandBarButtons.size())   return true;
  for (int i=0; i < nbActions; ++i) {
    CommandBarButtonForDisplay buttonI=(CommandBarButtonForDisplay)commandBarButtons.get(i);
    if (buttonI == null) {
      if (commandBarActionIds[i] != null)       return true;
    }
 else     if (!buttonI.getActionId().equals(commandBarActionIds[i]))     return true;
  }
  return false;
}
Program: 44854
Project: 44854
Buggy source:
private boolean areAlternativeActionsChanged(){
  String[] commandBarAlternativeActionIds=CommandBarAttributes.getAlternateActions();
  int nbActions=commandBarAlternativeActionIds.length;
  for (int i=0; i < nbActions; ++i) {
    CommandBarButtonForDisplay buttonI=(CommandBarButtonForDisplay)commandBarAlternativeButtons.get(i);
    if (buttonI == null) {
      if (commandBarAlternativeActionIds[i] != null)       return true;
    }
 else     if (!buttonI.getActionId().equals(commandBarAlternativeActionIds[i]))     return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean areAlternativeActionsChanged(){
  String[] commandBarAlternativeActionIds=CommandBarAttributes.getAlternateActions();
  int nbActions=commandBarAlternativeActionIds.length;
  if (nbActions != commandBarAlternativeButtons.size())   return true;
  for (int i=0; i < nbActions; ++i) {
    CommandBarButtonForDisplay buttonI=(CommandBarButtonForDisplay)commandBarAlternativeButtons.get(i);
    if (buttonI == null) {
      if (commandBarAlternativeActionIds[i] != null)       return true;
    }
 else     if (!buttonI.getActionId().equals(commandBarAlternativeActionIds[i]))     return true;
  }
  return false;
}
Program: 44857
Project: 44857
Buggy source:
/** 
 * Returns true if the given KeyStroke is one of this action's accelerators. This method always returns false if this method has no accelerator.
 * @param keyStroke the KeyStroke to test against this action's accelerators
 * @return true if the given KeyStroke is one of this action's accelerators
 */
public boolean isAccelerator(KeyStroke keyStroke){
  KeyStroke accelerator=getAccelerator();
  if (accelerator != null && accelerator.equals(keyStroke))   return true;
  accelerator=getAlternateAccelerator();
  return accelerator != null && accelerator.equals(keyStroke);
}

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if the given KeyStroke is one of this action's accelerators. Keystrokes are compared using   {@link #acceleratorsEqual(KeyStroke,KeyStroke)}, so that the   {@link KeyStroke#isOnKeyRelease()} flagis not taken into account. This method always returns <code>false</code> if this method has no accelerator.
 * @param keyStroke the KeyStroke to test against this action's accelerators
 * @return true if the given KeyStroke is one of this action's accelerators
 */
public boolean isAccelerator(KeyStroke keyStroke){
  KeyStroke accelerator=getAccelerator();
  if (accelerator != null && acceleratorsEqual(accelerator,keyStroke))   return true;
  accelerator=getAlternateAccelerator();
  return accelerator != null && acceleratorsEqual(accelerator,keyStroke);
}
Program: 44859
Project: 44859
Buggy source:
/** 
 * Marks or unmarks the current selected file (current row) and advance current row to the next one,  with the following exceptions: <ul> <li>if quick search is active, this method does nothing <li>if '..' file is selected, file is not marked but current row is still advanced to the next one <li>if the   {@link com.mucommander.ui.action.impl.MarkSelectedFileAction} key event is repeated and the last file has alreadybeen marked/unmarked since the key was last released, the file is not marked in order to avoid marked/unmarked flaps when the mark key is kept pressed. </ul>
 * @see com.mucommander.ui.action.impl.MarkSelectedFileAction
 */
public void markSelectedFile(){
  if (markKeyRepeated && lastRowMarked)   return;
  if (!isParentFolderSelected()) {
    setRowMarked(currentRow,!tableModel.isRowMarked(currentRow));
  }
  if (currentRow != tableModel.getRowCount() - 1) {
    selectRow(currentRow + 1);
  }
 else   if (!lastRowMarked) {
    repaintRow(currentRow);
    lastRowMarked=true;
  }
  markKeyRepeated=true;
}

Fixed version (ground truth):
/** 
 * Marks or unmarks the current selected file (current row) and advance current row to the next one,  with the following exceptions: <ul> <li>if quick search is active, this method does nothing <li>if '..' file is selected, file is not marked but current row is still advanced to the next one <li>if the   {@link MarkSelectedFileAction} key event is repeated and the last file has alreadybeen marked/unmarked since the key was last released, the file is not marked in order to avoid marked/unmarked flaps when the mark key is kept pressed. </ul>
 * @see MarkSelectedFileAction
 */
public void markSelectedFile(){
  if (markKeyRepeated && lastRowMarked)   return;
  if (!isParentFolderSelected()) {
    setRowMarked(currentRow,!tableModel.isRowMarked(currentRow));
  }
  if (currentRow != tableModel.getRowCount() - 1) {
    selectRow(currentRow + 1);
  }
 else   if (!lastRowMarked) {
    repaintRow(currentRow);
    lastRowMarked=true;
  }
  markKeyRepeated=true;
}
Program: 44860
Project: 44860
Buggy source:
/** 
 * Reacts to buttons being pushed.
 */
public void actionPerformed(ActionEvent e){
  Object source=e.getSource();
  if (source == okButton || source == applyButton) {
    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)   commit();
  if (source == applyButton)   setCommitButtonsEnabled(false);
  if (source == okButton || source == cancelButton)   dispose();
}
Program: 44861
Project: 44861
Buggy source:
private JPanel createFilteringPanel(){
  JPanel panel=new JPanel(new FlowLayout(FlowLayout.LEFT));
  panel.setBorder(BorderFactory.createEmptyBorder());
  panel.add(new JLabel(Translator.get("String_Node_Str" + "String_Node_Str") + "String_Node_Str"));
  Iterator actionCategoriesIterator=ActionProperties.getActionCategories().iterator();
  final JComboBox combo=new JComboBox();
  combo.addItem(ActionCategories.ALL);
  while (actionCategoriesIterator.hasNext())   combo.addItem(actionCategoriesIterator.next());
  combo.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      final ActionCategory selectedActionCategory=(ActionCategory)combo.getSelectedItem();
      shortcutsTable.updateModel(new ShortcutsTable.ActionFilter(){
        public boolean accept(        String actionId){
          return selectedActionCategory.contains(actionId);
        }
      }
);
    }
  }
);
  combo.setSelectedIndex(0);
  panel.add(combo);
  return panel;
}

Fixed version (ground truth):
private JPanel createFilteringPanel(){
  JPanel panel=new JPanel(new FlowLayout(FlowLayout.LEFT));
  panel.setBorder(BorderFactory.createEmptyBorder());
  panel.add(new JLabel(Translator.get("String_Node_Str" + "String_Node_Str") + "String_Node_Str"));
  Iterator actionCategoriesIterator=ActionProperties.getActionCategories().iterator();
  final JComboBox combo=new JComboBox();
  combo.addItem(ActionCategories.ALL);
  while (actionCategoriesIterator.hasNext())   combo.addItem(actionCategoriesIterator.next());
  combo.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      final ActionCategory selectedActionCategory=(ActionCategory)combo.getSelectedItem();
      shortcutsTable.updateModel(new ShortcutsTable.ActionFilter(){
        public boolean accept(        String actionId){
          return selectedActionCategory.contains(actionId);
        }
      }
);
      tooltipBar.showDefaultMessage();
    }
  }
);
  combo.setSelectedIndex(0);
  panel.add(combo);
  return panel;
}
Program: 44862
Project: 44862
Buggy source:
public void dialogValidated(){
  try {
    portSpinner.commitEdit();
  }
 catch (  ParseException e) {
  }
  updateValues();
}

Fixed version (ground truth):
public void dialogValidated(){
  updateValues();
}
Program: 44863
Project: 44863
Buggy source:
HTTPPanel(ServerConnectDialog dialog,MainFrame mainFrame){
  super(dialog,mainFrame);
  urlField=new JTextField(lastURL);
  urlField.selectAll();
  addTextFieldListeners(urlField,true);
  addRow(Translator.get("String_Node_Str"),urlField,5);
  portSpinner=createPortSpinner(lastPort);
  addRow(Translator.get("String_Node_Str"),portSpinner,20);
  addRow(new JLabel(Translator.get("String_Node_Str")),10);
  usernameField=new JTextField(lastUsername);
  usernameField.selectAll();
  addTextFieldListeners(usernameField,false);
  addRow(Translator.get("String_Node_Str"),usernameField,5);
  passwordField=new JPasswordField(lastPassword);
  addTextFieldListeners(passwordField,false);
  addRow(Translator.get("String_Node_Str"),passwordField,0);
}

Fixed version (ground truth):
HTTPPanel(ServerConnectDialog dialog,MainFrame mainFrame){
  super(dialog,mainFrame);
  urlField=new JTextField(lastURL);
  urlField.selectAll();
  addTextFieldListeners(urlField,true);
  addRow(Translator.get("String_Node_Str"),urlField,20);
  addRow(new JLabel(Translator.get("String_Node_Str")),10);
  usernameField=new JTextField(lastUsername);
  usernameField.selectAll();
  addTextFieldListeners(usernameField,false);
  addRow(Translator.get("String_Node_Str"),usernameField,5);
  passwordField=new JPasswordField(lastPassword);
  addTextFieldListeners(passwordField,false);
  addRow(Translator.get("String_Node_Str"),passwordField,0);
}
Program: 44864
Project: 44864
Buggy source:
private void updateValues(){
  lastURL=urlField.getText();
  lastUsername=usernameField.getText();
  lastPassword=new String(passwordField.getPassword());
  lastPort=((Integer)portSpinner.getValue()).intValue();
}

Fixed version (ground truth):
private void updateValues(){
  lastURL=urlField.getText();
  lastUsername=usernameField.getText();
  lastPassword=new String(passwordField.getPassword());
}
Program: 44865
Project: 44865
Buggy source:
FileURL getServerURL() throws MalformedURLException {
  updateValues();
  if (!lastURL.toLowerCase().startsWith(FileProtocols.HTTP + "String_Node_Str"))   lastURL=FileProtocols.HTTP + "String_Node_Str" + lastURL;
  FileURL fileURL=FileURL.getFileURL(lastURL);
  fileURL.setPort(lastPort);
  fileURL.setCredentials(new Credentials(lastUsername,lastPassword));
  return fileURL;
}

Fixed version (ground truth):
FileURL getServerURL() throws MalformedURLException {
  updateValues();
  if (!(lastURL.toLowerCase().startsWith(FileProtocols.HTTP + "String_Node_Str") || lastURL.toLowerCase().startsWith(FileProtocols.HTTPS + "String_Node_Str")))   lastURL=FileProtocols.HTTP + "String_Node_Str" + lastURL;
  FileURL fileURL=FileURL.getFileURL(lastURL);
  fileURL.setCredentials(new Credentials(lastUsername,lastPassword));
  return fileURL;
}
Program: 44867
Project: 44867
Buggy source:
public void flush(){
}

Fixed version (ground truth):
public synchronized void flush(){
}
Program: 44868
Project: 44868
Buggy source:
/** 
 * Returns the last records that were collected by this handler.
 * @return the last records that were collected by this handler.
 */
public LogRecord[] getLogRecords(){
  LogRecord[] records=new LogRecord[logRecords.size()];
  logRecords.toArray(records);
  return records;
}

Fixed version (ground truth):
/** 
 * Returns the last records that were collected by this handler.
 * @return the last records that were collected by this handler.
 */
public synchronized LogRecord[] getLogRecords(){
  LogRecord[] records=new LogRecord[logRecords.size()];
  logRecords.toArray(records);
  return records;
}
Program: 44869
Project: 44869
Buggy source:
public void publish(LogRecord record){
  if (logRecords.size() == bufferSize)   logRecords.removeFirst();
  logRecords.add(record);
}

Fixed version (ground truth):
public synchronized void publish(LogRecord record){
  if (logRecords.size() == bufferSize)   logRecords.removeFirst();
  logRecords.add(record);
}
Program: 44870
Project: 44870
Buggy source:
public void close() throws SecurityException {
  logRecords.clear();
}

Fixed version (ground truth):
public synchronized void close() throws SecurityException {
  logRecords.clear();
}
Program: 44871
Project: 44871
Buggy source:
/** 
 * Register new accelerators to the given action.
 * @param actionId - id of the MuAction.
 * @param accelerator - KeyStroke that would be primary accelerator of the given action.
 * @param alternateAccelerator - KeyStroke that would be alternative accelerator of the given action.
 */
public static void changeActionAccelerators(String actionId,KeyStroke accelerator,KeyStroke alternateAccelerator){
  if (isKeyStrokeRegistered(accelerator)) {
    String prevAcceleratorActionId=getRegisteredActionIdForKeystroke(accelerator);
switch (getAcceleratorType(accelerator)) {
case AcceleratorMap.PRIMARY_ACCELERATOR:
      registerActionAccelerators(prevAcceleratorActionId,null,getAlternateAccelerator(prevAcceleratorActionId));
    break;
case AcceleratorMap.ALTERNATIVE_ACCELERATOR:
  registerActionAccelerators(prevAcceleratorActionId,getAccelerator(prevAcceleratorActionId),null);
break;
}
}
if (isKeyStrokeRegistered(alternateAccelerator)) {
String prevAltAcceleratorActionId=getRegisteredActionIdForKeystroke(alternateAccelerator);
switch (getAcceleratorType(alternateAccelerator)) {
case AcceleratorMap.PRIMARY_ACCELERATOR:
registerActionAccelerators(prevAltAcceleratorActionId,null,getAlternateAccelerator(prevAltAcceleratorActionId));
break;
case AcceleratorMap.ALTERNATIVE_ACCELERATOR:
registerActionAccelerators(prevAltAcceleratorActionId,getAccelerator(prevAltAcceleratorActionId),null);
break;
}
}
acceleratorMap.remove((KeyStroke)customPrimaryActionKeymap.remove(actionId));
acceleratorMap.remove((KeyStroke)customAlternateActionKeymap.remove(actionId));
registerActionAccelerators(actionId,accelerator,alternateAccelerator);
}

Fixed version (ground truth):
/** 
 * Register new accelerators to the given action.
 * @param actionId - id of the MuAction.
 * @param accelerator - KeyStroke that would be primary accelerator of the given action.
 * @param alternateAccelerator - KeyStroke that would be alternative accelerator of the given action.
 */
public static void changeActionAccelerators(String actionId,KeyStroke accelerator,KeyStroke alternateAccelerator){
  String previousActionForAccelerator=getRegisteredActionIdForKeystroke(accelerator);
  if (previousActionForAccelerator != null && !previousActionForAccelerator.equals(actionId))   unregisterAcceleratorFromAction(previousActionForAccelerator,accelerator);
  String previousActionForAlternativeAccelerator=getRegisteredActionIdForKeystroke(alternateAccelerator);
  if (previousActionForAlternativeAccelerator != null && !previousActionForAlternativeAccelerator.equals(alternateAccelerator))   unregisterAcceleratorFromAction(previousActionForAlternativeAccelerator,alternateAccelerator);
  acceleratorMap.remove((KeyStroke)customPrimaryActionKeymap.remove(actionId));
  acceleratorMap.remove((KeyStroke)customAlternateActionKeymap.remove(actionId));
  registerActionAccelerators(actionId,accelerator,alternateAccelerator);
}
Program: 44872
Project: 44872
Buggy source:
/** 
 * Return accelerator type: primary\alternative\not registered.
 * @param ks - accelerator.
 * @return accelerator type.
 */
public static int getAcceleratorType(KeyStroke ks){
  int type=acceleratorMap.getAcceleratorType(ks);
  return type != 0 ? type : ActionProperties.getDefaultAcceleratorType(ks);
}

Fixed version (ground truth):
/** 
 * Return accelerator type: primary\alternative\not registered.
 * @param ks - accelerator.
 * @return accelerator type.
 */
private static int getAcceleratorType(KeyStroke ks){
  int type=acceleratorMap.getAcceleratorType(ks);
  return type != 0 ? type : ActionProperties.getDefaultAcceleratorType(ks);
}
Program: 44873
Project: 44873
Buggy source:
private Hashtable createCategoryToItsActionsWithShortcutsMap(){
  Iterator actionCategoriesIterator=ActionProperties.getActionCategories().iterator();
  Hashtable categoryToItsActionsWithShortcutsIdsMap=new Hashtable();
  while (actionCategoriesIterator.hasNext())   categoryToItsActionsWithShortcutsIdsMap.put(actionCategoriesIterator.next(),new LinkedList());
  Enumeration actionIds=ActionManager.getActionIds();
  while (actionIds.hasMoreElements()) {
    String actionId=(String)actionIds.nextElement();
    ActionCategory category=ActionProperties.getActionCategory(actionId);
    if (category != null && ActionKeymap.getAccelerator(actionId) != null)     ((LinkedList)categoryToItsActionsWithShortcutsIdsMap.get(category)).add(actionId);
  }
  return categoryToItsActionsWithShortcutsIdsMap;
}

Fixed version (ground truth):
private Hashtable createCategoryToItsActionsWithShortcutsMap(){
  Iterator actionCategoriesIterator=ActionProperties.getActionCategories().iterator();
  Hashtable categoryToItsActionsWithShortcutsIdsMap=new Hashtable();
  while (actionCategoriesIterator.hasNext())   categoryToItsActionsWithShortcutsIdsMap.put(actionCategoriesIterator.next(),new LinkedList());
  Enumeration actionIds=ActionManager.getActionIds();
  while (actionIds.hasMoreElements()) {
    String actionId=(String)actionIds.nextElement();
    ActionCategory category=ActionProperties.getActionCategory(actionId);
    if (category != null && ActionKeymap.doesActionHaveShortcut(actionId))     ((LinkedList)categoryToItsActionsWithShortcutsIdsMap.get(category)).add(actionId);
  }
  return categoryToItsActionsWithShortcutsIdsMap;
}
Program: 44875
Project: 44875
Buggy source:
/** 
 * @return the default quick list header font.
 */
private static Font getMenuHeaderFont(){
  if (DEFAULT_MENU_HEADER_FONT == null) {
    if ((DEFAULT_MENU_HEADER_FONT=UIManager.getDefaults().getFont("String_Node_Str")) == null)     DEFAULT_MENU_HEADER_FONT=new JInternalFrame().getRootPane().getFont();
  }
  return DEFAULT_MENU_HEADER_FONT;
}

Fixed version (ground truth):
/** 
 * @return the default quick list header font.
 */
private static Font getMenuHeaderFont(){
  if (DEFAULT_MENU_HEADER_FONT == null) {
    if ((DEFAULT_MENU_HEADER_FONT=UIManager.getDefaults().getFont("String_Node_Str")) == null)     DEFAULT_MENU_HEADER_FONT=new JTable().getFont();
  }
  return DEFAULT_MENU_HEADER_FONT;
}
Program: 44876
Project: 44876
Buggy source:
/** 
 * Executes the split job.
 */
private void startJob(){
  long size=getBytes();
  if (size < 1) {
    return;
  }
  String destPath=edtTargetDirectory.getText();
  PathUtils.ResolvedDestination resolvedDest=PathUtils.resolveDestination(destPath,mainFrame.getActiveTable().getCurrentFolder());
  if (resolvedDest == null || (files.size() > 1 && resolvedDest.getDestinationType() != PathUtils.ResolvedDestination.EXISTING_FOLDER)) {
    showErrorDialog(Translator.get("String_Node_Str",destPath),Translator.get("String_Node_Str"));
    return;
  }
  long parts=getParts();
  if (parts > MAX_PARTS) {
    showErrorDialog(Translator.get("String_Node_Str",Integer.toString(MAX_PARTS)),Translator.get("String_Node_Str"));
    return;
  }
  ProgressDialog progressDialog=new ProgressDialog(mainFrame,Translator.get("String_Node_Str"));
  SplitFileJob job=new SplitFileJob(progressDialog,mainFrame,file,resolvedDest.getDestinationFolder(),size,(int)parts);
  job.setIntegrityCheckEnabled(cbGenerateCRC.isSelected());
  progressDialog.start(job);
}

Fixed version (ground truth):
/** 
 * Executes the split job.
 */
private void startJob(){
  long size=getBytes();
  if (size < 1) {
    return;
  }
  String destPath=edtTargetDirectory.getText();
  PathUtils.ResolvedDestination resolvedDest=PathUtils.resolveDestination(destPath,mainFrame.getActiveTable().getCurrentFolder());
  if (resolvedDest == null || (files.size() > 1 && resolvedDest.getDestinationType() != PathUtils.ResolvedDestination.EXISTING_FOLDER)) {
    showErrorDialog(Translator.get("String_Node_Str",destPath),Translator.get("String_Node_Str"));
    return;
  }
  long parts=getParts();
  if (parts > MAX_PARTS) {
    showErrorDialog(Translator.get("String_Node_Str",Integer.toString(MAX_PARTS)),Translator.get("String_Node_Str"));
    return;
  }
  ProgressDialog progressDialog=new ProgressDialog(mainFrame,Translator.get("String_Node_Str"));
  SplitFileJob job=new SplitFileJob(progressDialog,mainFrame,file,resolvedDest.getDestinationFolder(),(int)size,(int)parts);
  job.setIntegrityCheckEnabled(cbGenerateCRC.isSelected());
  progressDialog.start(job);
}
Program: 44878
Project: 44878
Buggy source:
public void requestFocus(){
  textEditorImpl.getTextArea().requestFocus();
}

Fixed version (ground truth):
public void requestFocus(){
  textEditorImpl.requestFocus();
}
Program: 44879
Project: 44879
Buggy source:
protected void saveAs(AbstractFile destFile) throws IOException {
  OutputStream out=destFile.getOutputStream(false);
  out.write(textEditorImpl.getTextArea().getText().getBytes(textEditorImpl.getFileEncoding()));
  out.close();
  setSaveNeeded(false);
}

Fixed version (ground truth):
protected void saveAs(AbstractFile destFile) throws IOException {
  OutputStream out;
  out=null;
  try {
    out=destFile.getOutputStream(false);
    textEditorImpl.write(out);
    setSaveNeeded(false);
  }
  finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      IOException e) {
      }
    }
  }
}
Program: 44880
Project: 44880
Buggy source:
void loadDocument(InputStream in,String encoding) throws IOException {
  this.encoding=encoding;
  if (encoding.toLowerCase().startsWith("String_Node_Str"))   in=new BOMInputStream(in);
  InputStreamReader isr=new InputStreamReader(in,encoding);
  try {
    textArea.read(isr,null);
    isr.close();
    if (documentListener != null)     textArea.getDocument().addDocumentListener(documentListener);
    textArea.setCaretPosition(0);
  }
  finally {
    isr.close();
  }
}

Fixed version (ground truth):
void loadDocument(InputStream in,String encoding) throws IOException {
  this.encoding=encoding;
  if (encoding.toLowerCase().startsWith("String_Node_Str"))   in=new BOMInputStream(in);
  Reader isr=new BufferedReader(new InputStreamReader(in,encoding));
  textArea.read(isr,null);
  if (documentListener != null)   textArea.getDocument().addDocumentListener(documentListener);
  textArea.setCaretPosition(0);
}
Program: 44881
Project: 44881
Buggy source:
void startEditing(AbstractFile file,DocumentListener documentListener) throws IOException {
  this.file=file;
  this.documentListener=documentListener;
  InputStream in=null;
  if (file.hasRandomAccessInputStream()) {
    try {
      in=file.getRandomAccessInputStream();
    }
 catch (    IOException e) {
    }
  }
  if (in == null)   in=file.getInputStream();
  String encoding=EncodingDetector.detectEncoding(in);
  if (encoding == null || !Charset.isSupported(encoding))   encoding="String_Node_Str";
  if (in instanceof RandomAccessInputStream) {
    ((RandomAccessInputStream)in).seek(0);
  }
 else {
    in.close();
    in=file.getInputStream();
  }
  loadDocument(in,encoding);
  ThemeManager.addCurrentThemeListener(this);
}

Fixed version (ground truth):
void startEditing(AbstractFile file,DocumentListener documentListener) throws IOException {
  this.file=file;
  this.documentListener=documentListener;
  InputStream in=null;
  try {
    if (file.hasRandomAccessInputStream()) {
      try {
        in=file.getRandomAccessInputStream();
      }
 catch (      IOException e) {
      }
    }
    if (in == null)     in=file.getInputStream();
    String encoding=EncodingDetector.detectEncoding(in);
    if (encoding == null || !Charset.isSupported(encoding))     encoding="String_Node_Str";
    if (in instanceof RandomAccessInputStream) {
      ((RandomAccessInputStream)in).seek(0);
    }
 else {
      in.close();
      in=file.getInputStream();
    }
    loadDocument(in,encoding);
  }
  finally {
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException e) {
      }
    }
  }
  ThemeManager.addCurrentThemeListener(this);
}