nus-yam/ex-repair huggingface dataset:
Program: 45132
Project: 45132
Buggy source:
public Iterator filters(){
  return fileFilter.getFileFilterIterator();
}

Fixed version (ground truth):
/** 
 * Returns an iterator on the various filters that must accept a file for it to match the association.
 * @return an iterator on the various filters that must accept a file for it to match the association.
 */
public Iterator filters(){
  return fileFilter.getFileFilterIterator();
}
Program: 45133
Project: 45133
Buggy source:
public CommandAssociation(Command command,ChainedFileFilter filter){
  this.command=command;
  this.fileFilter=filter;
}

Fixed version (ground truth):
/** 
 * Creates a new <code>CommandAssociation</code>.
 * @param command command that must be executed if the association is matched.
 * @param filter  filter that files must match in order to be taken into account by the association.
 */
public CommandAssociation(Command command,ChainedFileFilter filter){
  this.command=command;
  this.fileFilter=filter;
}
Program: 45134
Project: 45134
Buggy source:
public boolean accept(AbstractFile file){
  return fileFilter.match(file);
}

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if the specified file matches the association.
 * @param file file to match against the association.
 * @return      <code>true</code> if the specified file matches the association, <code>false</code> otherwise.
 */
public boolean accept(AbstractFile file){
  return fileFilter.match(file);
}
Program: 45135
Project: 45135
Buggy source:
/** 
 * Notifies the builder that a new command has been found. </p>
 * @param command          command that has been found.
 * @throws CommandException if an error occurs.
 */
public void addCommand(Command command) throws CommandException ;

Fixed version (ground truth):
/** 
 * Notifies the builder that a new command has been found.
 * @param command          command that has been found.
 * @throws CommandException if an error occurs.
 */
public void addCommand(Command command) throws CommandException ;
Program: 45136
Project: 45136
Buggy source:
/** 
 * Removes the specified command from the list of registered commands. <p> This method might actually refuse to remove <code>command</code>: if it is associated to any file name filter, a command cannot be removed without, well, messing the system up quite baddly.<br/> If the command is associated to any file name filter, this method will return <code>false</code> and not do anything. </p>
 * @param command command to remove from the list.
 * @return         <code>false</code> if the command could not be removed, <code>true</code> otherwise.
 */
public static boolean removeCommand(Command command){
  if (isCommandAssociated(command))   return false;
  if (commands.remove(command))   wereCommandsModified=true;
  return true;
}

Fixed version (ground truth):
/** 
 * Removes the specified command from the list of registered commands. <p> This method might actually refuse to remove <code>command</code>: if it is associated to any file name filter, a command cannot be removed without, well, messing the system up quite baddly.<br> If the command is associated to any file name filter, this method will return <code>false</code> and not do anything. </p>
 * @param command command to remove from the list.
 * @return         <code>false</code> if the command could not be removed, <code>true</code> otherwise.
 */
public static boolean removeCommand(Command command){
  if (isCommandAssociated(command))   return false;
  if (commands.remove(command))   wereCommandsModified=true;
  return true;
}
Program: 45137
Project: 45137
Buggy source:
/** 
 * Writes all registered commands to the custom commands file. <p> Data will be written to the path returned by   {@link #getCommandFile()}. Note, however, that this method will not actually do anything if the command list hasn't been modified since the last time it was saved. </p> <p> The command files will be saved as a <i>backed-up file</i> (see   {@link com.mucommander.io.BackupOutputStream}). Its format is described   {@link CommandsXmlConstants here}. </p>
 * @see #loadCommands()
 * @see #getCommandFile()
 * @see #setCommandFile(String)
 * @throws IOException if an I/O error occurs.
 */
public static void writeCommands() throws IOException, CommandException {
  if (wereCommandsModified) {
    BackupOutputStream out;
    if (Debug.ON)     Debug.trace("String_Node_Str" + getCommandFile());
    out=null;
    try {
      buildCommands(new CommandWriter(out=new BackupOutputStream(getCommandFile())));
      wereCommandsModified=false;
    }
  finally {
      if (out != null) {
        try {
          out.close();
        }
 catch (        Exception e) {
        }
      }
    }
  }
 else   if (Debug.ON)   Debug.trace("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Writes all registered commands to the custom commands file. <p> Data will be written to the path returned by   {@link #getCommandFile()}. Note, however, that this method will not actually do anything if the command list hasn't been modified since the last time it was saved. </p> <p> The command files will be saved as a <i>backed-up file</i> (see   {@link com.mucommander.io.BackupOutputStream}). Its format is described   {@link CommandsXmlConstants here}. </p>
 * @throws IOException      if an I/O error occurs.
 * @throws CommandException if an error occurs.
 * @see #loadCommands()
 * @see #getCommandFile()
 * @see #setCommandFile(String)
 */
public static void writeCommands() throws IOException, CommandException {
  if (wereCommandsModified) {
    BackupOutputStream out;
    if (Debug.ON)     Debug.trace("String_Node_Str" + getCommandFile());
    out=null;
    try {
      buildCommands(new CommandWriter(out=new BackupOutputStream(getCommandFile())));
      wereCommandsModified=false;
    }
  finally {
      if (out != null) {
        try {
          out.close();
        }
 catch (        Exception e) {
        }
      }
    }
  }
 else   if (Debug.ON)   Debug.trace("String_Node_Str");
}
Program: 45138
Project: 45138
Buggy source:
/** 
 * Loads the custom commands XML File. <p> The command files will be loaded as a <i>backed-up file</i> (see   {@link com.mucommander.io.BackupInputStream}). Its format is described   {@link CommandsXmlConstants here}. </p>
 * @see #writeCommands()
 * @see #getCommandFile()
 * @see #setCommandFile(String)
 */
public static void loadCommands() throws IOException {
  AbstractFile file;
  InputStream in;
  file=getCommandFile();
  if (Debug.ON)   Debug.trace("String_Node_Str" + file.getAbsolutePath());
  in=null;
  try {
    CommandReader.read(in=new BackupInputStream(file),new CommandManager());
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + e.getMessage() + "String_Node_Str");
    commands=new Vector();
    throw new IOException(e.getMessage());
  }
 finally {
    registerDefaultCommand(FILE_OPENER_ALIAS,PlatformManager.getDefaultFileOpenerCommand(),null);
    registerDefaultCommand(URL_OPENER_ALIAS,PlatformManager.getDefaultUrlOpenerCommand(),null);
    registerDefaultCommand(EXE_OPENER_ALIAS,PlatformManager.getDefaultExeOpenerCommand(),null);
    registerDefaultCommand(FILE_MANAGER_ALIAS,PlatformManager.getDefaultFileManagerCommand(),PlatformManager.getDefaultFileManagerName());
    wereCommandsModified=false;
    if (in != null) {
      try {
        in.close();
      }
 catch (      Exception e) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Loads the custom commands XML File. <p> The command files will be loaded as a <i>backed-up file</i> (see   {@link com.mucommander.io.BackupInputStream}). Its format is described   {@link CommandsXmlConstants here}. </p>
 * @throws IOException if an I/O error occurs.
 * @see #writeCommands()
 * @see #getCommandFile()
 * @see #setCommandFile(String)
 */
public static void loadCommands() throws IOException {
  AbstractFile file;
  InputStream in;
  file=getCommandFile();
  if (Debug.ON)   Debug.trace("String_Node_Str" + file.getAbsolutePath());
  in=null;
  try {
    CommandReader.read(in=new BackupInputStream(file),new CommandManager());
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + e.getMessage() + "String_Node_Str");
    commands=new Vector();
    throw new IOException(e.getMessage());
  }
 finally {
    registerDefaultCommand(FILE_OPENER_ALIAS,PlatformManager.getDefaultFileOpenerCommand(),null);
    registerDefaultCommand(URL_OPENER_ALIAS,PlatformManager.getDefaultUrlOpenerCommand(),null);
    registerDefaultCommand(EXE_OPENER_ALIAS,PlatformManager.getDefaultExeOpenerCommand(),null);
    registerDefaultCommand(FILE_MANAGER_ALIAS,PlatformManager.getDefaultFileManagerCommand(),PlatformManager.getDefaultFileManagerName());
    wereCommandsModified=false;
    if (in != null) {
      try {
        in.close();
      }
 catch (      Exception e) {
      }
    }
  }
}
Program: 45140
Project: 45140
Buggy source:
public static String[] getTokensForFile(AbstractFile file,boolean allowDefault){
  Command command;
  if ((command=getCommandForFile(file,allowDefault)) == null)   return null;
  return command.getTokens(file);
}

Fixed version (ground truth):
/** 
 * Returns the tokens that compose the command that must be executed to open the specified file.
 * @param file         file for which the opening command's tokens must be returned.
 * @param allowDefault whether to use the default command if none was found to match the specified file.
 * @return              the tokens that compose the command that must be executed to open the specified file, <code>null</code> if not found.
 */
public static String[] getTokensForFile(AbstractFile file,boolean allowDefault){
  Command command;
  if ((command=getCommandForFile(file,allowDefault)) == null)   return null;
  return command.getTokens(file);
}
Program: 45141
Project: 45141
Buggy source:
/** 
 * , Writes all registered associations to the custom associations file. <p> Data will be written to the path returned by   {@link #getAssociationFile()}. Note, however, that this method will not actually do anything if the association list hasn't been modified since the last time it was saved. </p> <p> The association files will be saved as a <i>backed-up file</i> (see   {@link com.mucommander.io.BackupOutputStream}). Its format is described   {@link AssociationsXmlConstants here}. </p>
 * @see #loadAssociations()
 * @see #getAssociationFile()
 * @see #setAssociationFile(String)
 * @throws IOException if an I/O error occurs.
 */
public static void writeAssociations() throws CommandException, IOException {
  if (wereAssociationsModified) {
    BackupOutputStream out;
    if (Debug.ON)     Debug.trace("String_Node_Str" + getAssociationFile());
    out=null;
    try {
      buildAssociations(new AssociationWriter(out=new BackupOutputStream(getAssociationFile())));
      wereAssociationsModified=false;
    }
  finally {
      if (out != null) {
        try {
          out.close();
        }
 catch (        Exception e) {
        }
      }
    }
  }
 else   if (Debug.ON)   Debug.trace("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * , Writes all registered associations to the custom associations file. <p> Data will be written to the path returned by   {@link #getAssociationFile()}. Note, however, that this method will not actually do anything if the association list hasn't been modified since the last time it was saved. </p> <p> The association files will be saved as a <i>backed-up file</i> (see   {@link com.mucommander.io.BackupOutputStream}). Its format is described   {@link AssociationsXmlConstants here}. </p>
 * @throws IOException      if an I/O error occurs.
 * @throws CommandException if an error occurs.
 * @see #loadAssociations()
 * @see #getAssociationFile()
 * @see #setAssociationFile(String)
 */
public static void writeAssociations() throws CommandException, IOException {
  if (wereAssociationsModified) {
    BackupOutputStream out;
    if (Debug.ON)     Debug.trace("String_Node_Str" + getAssociationFile());
    out=null;
    try {
      buildAssociations(new AssociationWriter(out=new BackupOutputStream(getAssociationFile())));
      wereAssociationsModified=false;
    }
  finally {
      if (out != null) {
        try {
          out.close();
        }
 catch (        Exception e) {
        }
      }
    }
  }
 else   if (Debug.ON)   Debug.trace("String_Node_Str");
}
Program: 45142
Project: 45142
Buggy source:
public static Command getCommandForFile(AbstractFile file,boolean allowDefault){
  Iterator iterator;
  CommandAssociation association;
  iterator=associations();
  while (iterator.hasNext())   if ((association=(CommandAssociation)iterator.next()).accept(file))   return association.getCommand();
  if (allowDefault)   return (defaultCommand == null) ? RUN_AS_EXECUTABLE_COMMAND : defaultCommand;
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the command that must be executed to open the specified file.
 * @param file         file for which the opening command must be returned.
 * @param allowDefault whether to use the default command if none was found to match the specified file.
 * @return              the command that must be executed to open the specified file, <code>null</code> if not found.
 */
public static Command getCommandForFile(AbstractFile file,boolean allowDefault){
  Iterator iterator;
  CommandAssociation association;
  iterator=associations();
  while (iterator.hasNext())   if ((association=(CommandAssociation)iterator.next()).accept(file))   return association.getCommand();
  if (allowDefault)   return (defaultCommand == null) ? RUN_AS_EXECUTABLE_COMMAND : defaultCommand;
  return null;
}
Program: 45143
Project: 45143
Buggy source:
public static void registerAssociation(String command,ChainedFileFilter filter) throws CommandException {
  Command cmd;
  if ((cmd=getCommandForAlias(command)) != null) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + command + "String_Node_Str");
    associations.add(new CommandAssociation(cmd,filter));
    wereAssociationsModified=true;
  }
 else {
    if (Debug.ON)     Debug.trace("String_Node_Str" + command + "String_Node_Str");
    throw new CommandException(command + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Registers the specified association.
 * @param command          command to execute when the association is matched.
 * @param filter           file filters that a file must match to be accepted by the association.
 * @throws CommandException if an error occurs.
 */
public static void registerAssociation(String command,ChainedFileFilter filter) throws CommandException {
  Command cmd;
  if ((cmd=getCommandForAlias(command)) != null) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + command + "String_Node_Str");
    associations.add(new CommandAssociation(cmd,filter));
    wereAssociationsModified=true;
  }
 else {
    if (Debug.ON)     Debug.trace("String_Node_Str" + command + "String_Node_Str");
    throw new CommandException(command + "String_Node_Str");
  }
}
Program: 45144
Project: 45144
Buggy source:
/** 
 * Removes the command found at the specified index of the command list. <p> This method might actually not remove the command: if it is associated to any file name filter, a command cannot be removed without, well, messing the system up quite baddly.<br/> If the command is associated to any file name filter, this method will return <code>false</code> and not do anything. </p>
 * @param i index of the command to remove.
 * @return   <code>false</code> if the command could not be removed, <code>true</code> otherwise.
 */
public static boolean removeCommandAt(int i){
  Command buffer;
  buffer=(Command)commands.get(i);
  if (isCommandAssociated(buffer))   return false;
  commands.remove(i);
  wereCommandsModified=true;
  return true;
}

Fixed version (ground truth):
/** 
 * Removes the command found at the specified index of the command list. <p> This method might actually not remove the command: if it is associated to any file name filter, a command cannot be removed without, well, messing the system up quite baddly.<br> If the command is associated to any file name filter, this method will return <code>false</code> and not do anything. </p>
 * @param i index of the command to remove.
 * @return   <code>false</code> if the command could not be removed, <code>true</code> otherwise.
 */
public static boolean removeCommandAt(int i){
  Command buffer;
  buffer=(Command)commands.get(i);
  if (isCommandAssociated(buffer))   return false;
  commands.remove(i);
  wereCommandsModified=true;
  return true;
}
Program: 45145
Project: 45145
Buggy source:
/** 
 * Writes the specified command's XML description.
 * @param command command that should be written.
 */
public void addCommand(Command command) throws CommandException {
  XmlAttributes attributes;
  attributes=new XmlAttributes();
  attributes.add(ATTRIBUTE_ALIAS,command.getAlias());
  attributes.add(ATTRIBUTE_VALUE,command.getCommand());
  if (command.getType() == Command.SYSTEM_COMMAND)   attributes.add(ATTRIBUTE_TYPE,VALUE_SYSTEM);
 else   if (command.getType() == Command.INVISIBLE_COMMAND)   attributes.add(ATTRIBUTE_TYPE,VALUE_INVISIBLE);
  if (command.isDisplayNameSet())   attributes.add(ATTRIBUTE_DISPLAY,command.getDisplayName());
  try {
    out.writeStandAloneElement(ELEMENT_COMMAND,attributes);
  }
 catch (  IOException e) {
    throw new CommandException(e);
  }
}

Fixed version (ground truth):
/** 
 * Writes the specified command's XML description.
 * @param command          command that should be written.
 * @throws CommandException if an error occurs.
 */
public void addCommand(Command command) throws CommandException {
  XmlAttributes attributes;
  attributes=new XmlAttributes();
  attributes.add(ATTRIBUTE_ALIAS,command.getAlias());
  attributes.add(ATTRIBUTE_VALUE,command.getCommand());
  if (command.getType() == Command.SYSTEM_COMMAND)   attributes.add(ATTRIBUTE_TYPE,VALUE_SYSTEM);
 else   if (command.getType() == Command.INVISIBLE_COMMAND)   attributes.add(ATTRIBUTE_TYPE,VALUE_INVISIBLE);
  if (command.isDisplayNameSet())   attributes.add(ATTRIBUTE_DISPLAY,command.getDisplayName());
  try {
    out.writeStandAloneElement(ELEMENT_COMMAND,attributes);
  }
 catch (  IOException e) {
    throw new CommandException(e);
  }
}
Program: 45146
Project: 45146
Buggy source:
/** 
 * Builds a new writer that will send data to the specified output stream.
 * @param stream where to write the XML data.
 */
public CommandWriter(OutputStream stream) throws IOException {
  out=new XmlWriter(stream);
}

Fixed version (ground truth):
/** 
 * Builds a new writer that will send data to the specified output stream.
 * @param stream      where to write the XML data.
 * @throws IOException if an IO error occurs.
 */
public CommandWriter(OutputStream stream) throws IOException {
  out=new XmlWriter(stream);
}
Program: 45147
Project: 45147
Buggy source:
public boolean getFilter(){
  return filter;
}

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if files must have the filter's permission flag set in order to be accepted.
 * @return <code>true</code> if files must have the filter's permission flag set in order to be accepted, <code>false</code> otherwise.
 */
public boolean getFilter(){
  return filter;
}
Program: 45148
Project: 45148
Buggy source:
public int getPermission(){
  return permission;
}

Fixed version (ground truth):
/** 
 * Returns the permission that this filter will check.
 * @return the permission that this filter will check.
 */
public int getPermission(){
  return permission;
}
Program: 45149
Project: 45149
Buggy source:
public PermissionsFileFilter(int permission,boolean filter){
  this.permission=permission;
  this.filter=filter;
}

Fixed version (ground truth):
/** 
 * Creates a new <code>PermissionsFileFilter</code>.
 * @param permission permission that will be checked against as defined in {@link FilePermissions}.
 * @param filter     whether or not the specified permission flag must be set for a file to be accepted.
 */
public PermissionsFileFilter(int permission,boolean filter){
  this.permission=permission;
  this.filter=filter;
}
Program: 45150
Project: 45150
Buggy source:
/** 
 * Adds the given   {@link FileChangeListener} instance to the list of registered listeners.<p>Listeners are stored as weak references so  {@link #removeFileChangeListener(FileChangeListener)}doesn't need to be called for listeners to be garbage collected when they're not used anymore.</p>
 * @param listener the FileChangeListener to add to the list of registered listeners.
 */
public void addFileChangeListener(FileChangeListener listener){
  listeners.put(listener,null);
}

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

Fixed version (ground truth):
/** 
 * Removes the given   {@link FileChangeListener} instance to the list of registered listeners.
 * @param listener the FileChangeListener to remove from the list of registered listeners.
 * @see #addFileChangeListener(FileChangeListener)
 */
public void removeFileChangeListener(FileChangeListener listener){
  listeners.remove(listener);
}
Program: 45152
Project: 45152
Buggy source:
/** 
 * Recursively calculates the total size for the given files and folders.
 */
public static long getFileSize(AbstractFile files[]){
  AbstractFile file;
  long total=0;
  long fileSize;
  for (int i=0; i < files.length; i++) {
    file=files[i];
    if (file.isDirectory() && !file.isSymlink()) {
      try {
        total+=getFileCount(file.ls());
      }
 catch (      IOException e) {
      }
    }
 else {
      fileSize=file.getSize();
      if (fileSize > 0)       total+=fileSize;
    }
  }
  return total;
}

Fixed version (ground truth):
/** 
 * Recursively calculates the total size for the given files and folders.
 * @param files files and folders that need to be explored and weighed.
 * @return       the specified files total size.
 */
public static long getFileSize(AbstractFile files[]){
  AbstractFile file;
  long total=0;
  long fileSize;
  for (int i=0; i < files.length; i++) {
    file=files[i];
    if (file.isDirectory() && !file.isSymlink()) {
      try {
        total+=getFileCount(file.ls());
      }
 catch (      IOException e) {
      }
    }
 else {
      fileSize=file.getSize();
      if (fileSize > 0)       total+=fileSize;
    }
  }
  return total;
}
Program: 45153
Project: 45153
Buggy source:
/** 
 * Recursively calculates the total number of files.
 */
public static int getFileCount(AbstractFile files[]){
  AbstractFile file;
  int total=0;
  for (int i=0; i < files.length; i++) {
    file=files[i];
    if (file.isDirectory() && !file.isSymlink()) {
      try {
        total+=getFileCount(file.ls());
      }
 catch (      IOException e) {
      }
    }
 else     total++;
  }
  return total;
}

Fixed version (ground truth):
/** 
 * Recursively calculates the total number of files.
 * @param files files and folders that need to be explored and counted.
 * @return       the total number of files contained in the specified array.
 */
public static int getFileCount(AbstractFile[] files){
  AbstractFile file;
  int total=0;
  for (int i=0; i < files.length; i++) {
    file=files[i];
    if (file.isDirectory() && !file.isSymlink()) {
      try {
        total+=getFileCount(file.ls());
      }
 catch (      IOException e) {
      }
    }
 else     total++;
  }
  return total;
}
Program: 45154
Project: 45154
Buggy source:
/** 
 * Returns true if this PathTokenizer has more filename tokens.
 */
public boolean hasMoreFilenames(){
  return currentIndex < tokens.length;
}

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if this PathTokenizer has more filename tokens.
 * @return <code>true</code> if this PathTokenizer has more filename tokens, <code>false</code> otherwise.
 */
public boolean hasMoreFilenames(){
  return currentIndex < tokens.length;
}
Program: 45155
Project: 45155
Buggy source:
/** 
 * Returns the current path part that has been tokenized, i.e. that ends with the last filename token returned by  {@link #nextFilename()} and separator string returned by {@link #getLastSeparator()}.<br> If this PathTokenizer operates in reverse order, the returned path is the path part that has not yet been  tokenized.
 */
public String getCurrentPath(){
  return currentPath.toString();
}

Fixed version (ground truth):
/** 
 * Returns the current path part that has been tokenized, i.e. that ends with the last filename token returned by  {@link #nextFilename()} and separator string returned by {@link #getLastSeparator()}.<br> If this PathTokenizer operates in reverse order, the returned path is the path part that has not yet been  tokenized.
 * @return the current path part that has been tokenized.
 */
public String getCurrentPath(){
  return currentPath.toString();
}
Program: 45156
Project: 45156
Buggy source:
/** 
 * Returns the last separator string that appeared in the path after the last filename token returned by  {@link #nextFilename()} and before the next filename, or an empty string "" if there isn't any separatorcharacter after the filename (path ends without a trailing separator).<br> Note: the returned string can be made of several consecutive separator characters. <p>Initially, before any calls to  {@link #nextFilename()} have been made, this method will return any leadingseparator string in the path string, or an empty string if the path doesn't start with a separator.
 */
public String getLastSeparator(){
  return lastSeparator;
}

Fixed version (ground truth):
/** 
 * Returns the last separator string that appeared in the path after the last filename token returned by  {@link #nextFilename()} and before the next filename, or an empty string "" if there isn't any separatorcharacter after the filename (path ends without a trailing separator).<br> Note: the returned string can be made of several consecutive separator characters. <p>Initially, before any calls to  {@link #nextFilename()} have been made, this method will return any leadingseparator string in the path string, or an empty string if the path doesn't start with a separator.
 * @return the last separator string that appeared in the path.
 */
public String getLastSeparator(){
  return lastSeparator;
}
Program: 45157
Project: 45157
Buggy source:
/** 
 * Returns an   {@link AbstractFile} to the root package of the given <code>Class</code>. For example, if thespecified <code>Class</code> is <code>java.lang.Object</code>'s, the returned file will be the Java runtime JAR file, which on most platforms is <code>$JAVA_HOME/lib/jre/rt.jar</code>.<br/> The returned file can be used to list or manipulate all resource files contained in a particular classpath's location, including the .class files.
 * @param aClass the class for which to locate the root package.
 * @return an AbstractFile to the root package of the given <code>Class</code>
 */
public static AbstractFile getRootPackageAsFile(Class aClass){
  ClassLoader classLoader=aClass.getClassLoader();
  if (classLoader == null)   classLoader=getDefaultClassLoader();
  String aClassRelPath=aClass.getName().replace('.','/') + "String_Node_Str";
  URL aClassURL=getResourceAsURL(aClassRelPath,classLoader);
  if (aClassURL == null)   return null;
  if ("String_Node_Str".equals(aClassURL.getProtocol()))   return FileFactory.getFile(getJarFilePath(aClassURL));
  String aClassPath=getLocalFilePath(aClassURL);
  return FileFactory.getFile(aClassPath.substring(0,aClassPath.length() - aClassRelPath.length()));
}

Fixed version (ground truth):
/** 
 * Returns an   {@link AbstractFile} to the root package of the given <code>Class</code>. For example, if thespecified <code>Class</code> is <code>java.lang.Object</code>'s, the returned file will be the Java runtime JAR file, which on most platforms is <code>$JAVA_HOME/lib/jre/rt.jar</code>.<br> The returned file can be used to list or manipulate all resource files contained in a particular classpath's location, including the .class files.
 * @param aClass the class for which to locate the root package.
 * @return an AbstractFile to the root package of the given <code>Class</code>
 */
public static AbstractFile getRootPackageAsFile(Class aClass){
  ClassLoader classLoader=aClass.getClassLoader();
  if (classLoader == null)   classLoader=getDefaultClassLoader();
  String aClassRelPath=aClass.getName().replace('.','/') + "String_Node_Str";
  URL aClassURL=getResourceAsURL(aClassRelPath,classLoader);
  if (aClassURL == null)   return null;
  if ("String_Node_Str".equals(aClassURL.getProtocol()))   return FileFactory.getFile(getJarFilePath(aClassURL));
  String aClassPath=getLocalFilePath(aClassURL);
  return FileFactory.getFile(aClassPath.substring(0,aClassPath.length() - aClassRelPath.length()));
}
Program: 45159
Project: 45159
Buggy source:
public static String getDefaultUrlOpenerCommand(){
  return defaultUrlOpenerCommand;
}

Fixed version (ground truth):
/** 
 * Returns the default command used to open URLs under the current system.
 * @return the default command used to open URLs under the current system, or <code>null</code> if not found.
 */
public static String getDefaultUrlOpenerCommand(){
  return defaultUrlOpenerCommand;
}
Program: 45160
Project: 45160
Buggy source:
public static boolean getDefaultRegexpCaseSensitivity(){
  return defaultRegexpCaseSensitivity;
}

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if the current system should use case-sensitive regular expression when matching file names.
 * @return <code>true</code> if the current system should use case-sensitive regular expression when matching file names, <code>false</code> otherwise.
 */
public static boolean getDefaultRegexpCaseSensitivity(){
  return defaultRegexpCaseSensitivity;
}
Program: 45161
Project: 45161
Buggy source:
public static String getDefaultExeOpenerCommand(){
  return defaultExeOpenerCommand;
}

Fixed version (ground truth):
/** 
 * Returns the default command used to open executable files under the current system.
 * @return the default command used to open executable files under the current system, or <code>null</code> if not found.
 */
public static String getDefaultExeOpenerCommand(){
  return defaultExeOpenerCommand;
}
Program: 45162
Project: 45162
Buggy source:
public static String getDefaultShellCommand(){
  return defaultShellCommand;
}

Fixed version (ground truth):
/** 
 * Returns the system's default shell command.
 * @return the system's default shell command, or <code>null</code> if not known.
 */
public static String getDefaultShellCommand(){
  return defaultShellCommand;
}
Program: 45163
Project: 45163
Buggy source:
public static String getExeAssociation(){
  return exeAssociation;
}

Fixed version (ground truth):
/** 
 * Returns the regular expression used to match executable files.
 * @return the regular expression used to match executable files, <code>null</code> if not found.
 */
public static String getExeAssociation(){
  return exeAssociation;
}
Program: 45164
Project: 45164
Buggy source:
public static boolean runExecutables(){
  return runExecutables;
}

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if executable files must be opened with a different command than regular files.
 * @return <code>true</code> if executable files must be opened with a different command than regular files, <code>false</code> otherwise.
 */
public static boolean runExecutables(){
  return runExecutables;
}
Program: 45165
Project: 45165
Buggy source:
public static void setPreferencesFolder(AbstractFile folder) throws IOException {
  if (!folder.exists())   folder.mkdir();
 else   if (!folder.isBrowsable())   folder=folder.getParent();
  prefFolder=folder;
}

Fixed version (ground truth):
/** 
 * Sets the path to the folder in which muCommander will look for its preferences. <p> If <code>folder</code> is a file, its parent folder will be used instead. If it doesn't exist, this method will create it. </p>
 * @param folder      path to the folder in which muCommander will look for its preferences.
 * @throws IOException if an IO error occurs.
 * @see #getPreferencesFolder()
 * @see #setPreferencesFolder(String)
 * @see #setPreferencesFolder(File)
 */
public static void setPreferencesFolder(AbstractFile folder) throws IOException {
  if (!folder.exists())   folder.mkdir();
 else   if (!folder.isBrowsable())   folder=folder.getParent();
  prefFolder=folder;
}
Program: 45166
Project: 45166
Buggy source:
public static String getDefaultFileManagerName(){
  return defaultFileManagerName;
}

Fixed version (ground truth):
/** 
 * Returns the name of the system's default file manager.
 * @return the name of the system's default file manager, or <code>null</code> if not known.
 */
public static String getDefaultFileManagerName(){
  return defaultFileManagerName;
}
Program: 45167
Project: 45167
Buggy source:
public static String getDefaultFileManagerCommand(){
  return defaultFileManagerCommand;
}

Fixed version (ground truth):
/** 
 * Returns the command used to start the system's default file manager.
 * @return the command used to start the system's default file manager, or <code>null</code> if not found.
 */
public static String getDefaultFileManagerCommand(){
  return defaultFileManagerCommand;
}
Program: 45168
Project: 45168
Buggy source:
/** 
 * Tries to open the specified file in the system's file manager. <p> Developers should make sure the operation is possible before calling this. This can be done through   {@link #canOpenInFileManager()}. </p>
 */
public static void openInFileManager(AbstractFile file){
  try {
    if (!file.getURL().getProtocol().equals(FileProtocols.FILE))     return;
    if (!file.isDirectory())     file=file.getParent();
    Command command;
    if ((command=CommandManager.getCommandForAlias(CommandManager.FILE_MANAGER_ALIAS)) != null) {
      if (Debug.ON)       Debug.trace("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str");
      ProcessRunner.execute(command.getTokens(file),file);
    }
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str"+ e);
  }
}

Fixed version (ground truth):
/** 
 * Tries to open the specified file in the system's file manager. <p> Developers should make sure the operation is possible before calling this. This can be done through   {@link #canOpenInFileManager()}. </p>
 * @param file file to open in the system's file manager.
 */
public static void openInFileManager(AbstractFile file){
  try {
    if (!file.getURL().getProtocol().equals(FileProtocols.FILE))     return;
    if (!file.isDirectory())     file=file.getParent();
    Command command;
    if ((command=CommandManager.getCommandForAlias(CommandManager.FILE_MANAGER_ALIAS)) != null) {
      if (Debug.ON)       Debug.trace("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str");
      ProcessRunner.execute(command.getTokens(file),file);
    }
  }
 catch (  Exception e) {
    if (Debug.ON)     Debug.trace("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str"+ e);
  }
}
Program: 45169
Project: 45169
Buggy source:
/** 
 * Returns the path to the folder that contains all of the user's data. <p> All modules that save user data to a file should do so in a file located in the folder returned by this method. </p> <p> The value returned by this method can be set through   {@link #setPreferencesFolder(File)}. Otherwise, the   {@link #getDefaultPreferencesFolder() default preference folder} will beused. </p>
 * @return the path to the user's preference folder.
 */
public static AbstractFile getPreferencesFolder(){
  if (prefFolder != null)   return prefFolder;
  return getDefaultPreferencesFolder();
}

Fixed version (ground truth):
/** 
 * Returns the path to the folder that contains all of the user's data. <p> All modules that save user data to a file should do so in a file located in the folder returned by this method. </p> <p> The value returned by this method can be set through   {@link #setPreferencesFolder(File)}. Otherwise, the   {@link #getDefaultPreferencesFolder() default preference folder} will beused. </p>
 * @return the path to the user's preference folder.
 * @see #setPreferencesFolder(AbstractFile)
 */
public static AbstractFile getPreferencesFolder(){
  if (prefFolder != null)   return prefFolder;
  return getDefaultPreferencesFolder();
}
Program: 45170
Project: 45170
Buggy source:
/** 
 * Returns <code>true</code> if the current platform is capable of opening a file or folder in the desktop's default file manager (Finder for Mac OS X, Explorer for Windows...).
 */
public static boolean canOpenInFileManager(){
  return CommandManager.getCommandForAlias(CommandManager.FILE_MANAGER_ALIAS) != null;
}

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if the current platform is capable of opening a file or folder in the desktop's default file manager (Finder for Mac OS X, Explorer for Windows...).
 * @return <code>true</code> if the current platform is capable of opening file or folders in the default file manager, <code>false</code> otherwise.
 */
public static boolean canOpenInFileManager(){
  return CommandManager.getCommandForAlias(CommandManager.FILE_MANAGER_ALIAS) != null;
}
Program: 45171
Project: 45171
Buggy source:
/** 
 * Opens the specified URL in the registered web browser.
 */
public static void openUrl(AbstractFile file){
  try {
    String protocol;
    protocol=file.getURL().getProtocol();
    if (!protocol.equals(FileProtocols.HTTP) && !protocol.equals(FileProtocols.HTTPS))     return;
    Command command;
    if ((command=CommandManager.getCommandForAlias(CommandManager.URL_OPENER_ALIAS)) != null)     ProcessRunner.execute(command.getTokens(file),file);
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
/** 
 * Opens the specified URL in the registered web browser.
 * @param file URL to open.
 */
public static void openUrl(AbstractFile file){
  try {
    String protocol;
    protocol=file.getURL().getProtocol();
    if (!protocol.equals(FileProtocols.HTTP) && !protocol.equals(FileProtocols.HTTPS))     return;
    Command command;
    if ((command=CommandManager.getCommandForAlias(CommandManager.URL_OPENER_ALIAS)) != null)     ProcessRunner.execute(command.getTokens(file),file);
  }
 catch (  Exception e) {
  }
}
Program: 45172
Project: 45172
Buggy source:
public static String getDefaultFileOpenerCommand(){
  return defaultFileOpenerCommand;
}

Fixed version (ground truth):
/** 
 * Returns the default command used to open files under the current system.
 * @return the default command used to open files under the current system, or <code>null</code> if not found.
 */
public static String getDefaultFileOpenerCommand(){
  return defaultFileOpenerCommand;
}
Program: 45173
Project: 45173
Buggy source:
public ShutdownHook(){
  super(ShutdownHook.class.getName());
}

Fixed version (ground truth):
/** 
 * Creates a new <code>ShutdownHook</code>.
 */
public ShutdownHook(){
  super(ShutdownHook.class.getName());
}
Program: 45174
Project: 45174
Buggy source:
public static void initiateShutdown(){
  if (Debug.ON)   Debug.trace("String_Node_Str");
  System.exit(0);
}

Fixed version (ground truth):
/** 
 * Shuts down muCommander.
 */
public static void initiateShutdown(){
  if (Debug.ON)   Debug.trace("String_Node_Str");
  System.exit(0);
}
Program: 45175
Project: 45175
Buggy source:
public static void stop(){
  stressThread=null;
}

Fixed version (ground truth):
/** 
 * Stops the current stress test.
 */
public static void stop(){
  stressThread=null;
}
Program: 45176
Project: 45176
Buggy source:
public static void main(String args[]){
  Launcher.main(args);
  StressTester instance=new StressTester();
  JDialog stopDialog=new JDialog();
  JButton stopButton=new JButton("String_Node_Str");
  stopButton.addActionListener(instance);
  stopDialog.getContentPane().add(stopButton);
  stopDialog.setSize(new Dimension(80,60));
  stopDialog.setVisible(true);
}

Fixed version (ground truth):
/** 
 * Method used to start the stress tester.
 * @param args command line arguments.
 */
public static void main(String args[]){
  Launcher.main(args);
  StressTester instance=new StressTester();
  JDialog stopDialog=new JDialog();
  JButton stopButton=new JButton("String_Node_Str");
  stopButton.addActionListener(instance);
  stopDialog.getContentPane().add(stopButton);
  stopDialog.setSize(new Dimension(80,60));
  stopDialog.setVisible(true);
}
Program: 45177
Project: 45177
Buggy source:
public InputStream getInputStream() throws IOException {
  BookmarkBuilder builder;
  ByteArrayOutputStream stream;
  builder=BookmarkManager.getBookmarkWriter(stream=new ByteArrayOutputStream());
  try {
    builder.startBookmarks();
    builder.addBookmark(bookmark.getName(),bookmark.getLocation());
    builder.endBookmarks();
  }
 catch (  Throwable e) {
    Throwable e2;
    while ((e2=e.getCause()) != null)     e=e2;
    if (e2 instanceof IOException)     throw (IOException)e2;
    throw new IOException(e.getMessage());
  }
  return new ByteArrayInputStream(stream.toByteArray());
}

Fixed version (ground truth):
public InputStream getInputStream() throws IOException {
  BookmarkBuilder builder;
  ByteArrayOutputStream stream;
  builder=BookmarkManager.getBookmarkWriter(stream=new ByteArrayOutputStream());
  try {
    builder.startBookmarks();
    builder.addBookmark(bookmark.getName(),bookmark.getLocation());
    builder.endBookmarks();
  }
 catch (  Throwable e) {
    Throwable e2;
    while ((e2=e.getCause()) != null)     e=e2;
    if (e instanceof IOException)     throw (IOException)e;
    throw new IOException(e.getMessage());
  }
  return new ByteArrayInputStream(stream.toByteArray());
}
Program: 45180
Project: 45180
Buggy source:
protected void init(String title,String labelText,String okText,String errorDialogTitle){
  this.errorDialogTitle=errorDialogTitle;
  setTitle(title);
  YBoxPanel mainPanel=new YBoxPanel();
  JLabel label=new JLabel(labelText + "String_Node_Str");
  mainPanel.add(label);
  pathField=new JTextField();
  pathField.addActionListener(this);
  mainPanel.add(pathField);
  mainPanel.addSpace(10);
  setInitialFocusComponent(pathField);
  mainPanel.add(new JLabel(Translator.get("String_Node_Str")));
  fileExistsActionComboBox=new JComboBox();
  fileExistsActionComboBox.addItem(Translator.get("String_Node_Str"));
  int nbChoices=DEFAULT_ACTIONS_TEXT.length;
  for (int i=0; i < nbChoices; i++)   fileExistsActionComboBox.addItem(DEFAULT_ACTIONS_TEXT[i]);
  mainPanel.add(fileExistsActionComboBox);
  mainPanel.addSpace(10);
  JPanel fileDetailsPanel=createFileDetailsPanel();
  okButton=new JButton(okText);
  cancelButton=new JButton(Translator.get("String_Node_Str"));
  mainPanel.add(createButtonsPanel(createFileDetailsButton(fileDetailsPanel),DialogToolkit.createOKCancelPanel(okButton,cancelButton,getRootPane(),this)));
  mainPanel.add(fileDetailsPanel);
  getContentPane().add(mainPanel,BorderLayout.NORTH);
  setMinimumSize(MINIMUM_DIALOG_DIMENSION);
  setMaximumSize(MAXIMUM_DIALOG_DIMENSION);
}

Fixed version (ground truth):
protected void init(String title,String labelText,String okText,String errorDialogTitle){
  this.errorDialogTitle=errorDialogTitle;
  setTitle(title);
  YBoxPanel mainPanel=new YBoxPanel();
  JLabel label=new JLabel(labelText + "String_Node_Str");
  mainPanel.add(label);
  pathField=new JTextField();
  pathField.addActionListener(this);
  mainPanel.add(pathField);
  mainPanel.addSpace(10);
  setInitialFocusComponent(pathField);
  mainPanel.add(new JLabel(Translator.get("String_Node_Str") + "String_Node_Str"));
  fileExistsActionComboBox=new JComboBox();
  fileExistsActionComboBox.addItem(Translator.get("String_Node_Str"));
  int nbChoices=DEFAULT_ACTIONS_TEXT.length;
  for (int i=0; i < nbChoices; i++)   fileExistsActionComboBox.addItem(DEFAULT_ACTIONS_TEXT[i]);
  mainPanel.add(fileExistsActionComboBox);
  mainPanel.addSpace(10);
  JPanel fileDetailsPanel=createFileDetailsPanel();
  okButton=new JButton(okText);
  cancelButton=new JButton(Translator.get("String_Node_Str"));
  mainPanel.add(createButtonsPanel(createFileDetailsButton(fileDetailsPanel),DialogToolkit.createOKCancelPanel(okButton,cancelButton,getRootPane(),this)));
  mainPanel.add(fileDetailsPanel);
  getContentPane().add(mainPanel,BorderLayout.NORTH);
  setMinimumSize(MINIMUM_DIALOG_DIMENSION);
  setMaximumSize(MAXIMUM_DIALOG_DIMENSION);
}
Program: 45181
Project: 45181
Buggy source:
/** 
 * This method is invoked when the OK button is pressed.
 */
private void okPressed(){
  String destPath=pathField.getText();
  Object ret[]=FileToolkit.resolvePath(destPath,mainFrame.getActiveTable().getCurrentFolder());
  if (ret == null || (files.size() > 1 && ret[1] != null)) {
    showErrorDialog(Translator.get("String_Node_Str",destPath));
    return;
  }
  AbstractFile destFolder=(AbstractFile)ret[0];
  String newName=(String)ret[1];
  int defaultFileExistsAction=fileExistsActionComboBox.getSelectedIndex();
  if (defaultFileExistsAction == 0)   defaultFileExistsAction=FileCollisionDialog.ASK_ACTION;
 else   defaultFileExistsAction=DEFAULT_ACTIONS[defaultFileExistsAction - 1];
  startJob(destFolder,newName,defaultFileExistsAction);
}

Fixed version (ground truth):
/** 
 * This method is invoked when the OK button is pressed.
 */
private void okPressed(){
  String destPath=pathField.getText();
  Object ret[]=FileToolkit.resolvePath(destPath,mainFrame.getActiveTable().getCurrentFolder());
  if (ret == null || (files.size() > 1 && ret[1] != null)) {
    showErrorDialog(Translator.get("String_Node_Str",destPath),errorDialogTitle);
    return;
  }
  AbstractFile destFolder=(AbstractFile)ret[0];
  String newName=(String)ret[1];
  int defaultFileExistsAction=fileExistsActionComboBox.getSelectedIndex();
  if (defaultFileExistsAction == 0)   defaultFileExistsAction=FileCollisionDialog.ASK_ACTION;
 else   defaultFileExistsAction=DEFAULT_ACTIONS[defaultFileExistsAction - 1];
  startJob(destFolder,newName,defaultFileExistsAction);
}
Program: 45182
Project: 45182
Buggy source:
public CompatURLConnection(URL url,AbstractFile file) throws IOException {
  super(url);
  this.file=file;
  connected=true;
}

Fixed version (ground truth):
public CompatURLConnection(URL url,AbstractFile file) throws IOException {
  super(url);
  if (file != null) {
    this.file=file;
    connected=true;
  }
}
Program: 45183
Project: 45183
Buggy source:
/** 
 * Opens a stream on the right file. <p> If a backup file is found, and is bigger than the target file, then it will be used. </p>
 * @param file        file on which to open an input stream.
 * @return                a stream on the right file.
 * @exception IOException thrown if any IO related error occurs.
 */
private static InputStream getInputStream(AbstractFile file) throws IOException {
  AbstractFile backup;
  backup=FileFactory.getFile(file.getAbsolutePath() + BACKUP_SUFFIX);
  if (backup.exists() && (file.getSize() < backup.getSize()))   return backup.getInputStream();
  return file.getInputStream();
}

Fixed version (ground truth):
/** 
 * Opens a stream on the right file. <p> If a backup file is found, and is bigger than the target file, then it will be used. </p>
 * @param file        file on which to open an input stream.
 * @return                a stream on the right file.
 * @exception IOException thrown if any IO related error occurs.
 */
private static InputStream getInputStream(AbstractFile file) throws IOException {
  AbstractFile backup;
  FileURL test;
  test=(FileURL)file.getURL().clone();
  test.setPath(test.getPath() + BACKUP_SUFFIX);
  backup=FileFactory.getFile(test);
  if (backup != null && backup.exists() && (file.getSize() < backup.getSize()))   return backup.getInputStream();
  return file.getInputStream();
}