nus-yam/ex-repair huggingface dataset:
Program: 44933
Project: 44933
Buggy source:
/** 
 * update list model depending on the data in text component
 * @param list - auto-completion popup's list.
 * @param comp - text component
 * @return true if list model was updated successfully, false otherwise.
 */
public abstract boolean updateListData(final JList list,AutocompleterTextComponent comp);

Fixed version (ground truth):
/** 
 * update list model depending on the data in text component
 * @param list - auto-completion popup's list that should be updated.
 * @param comp - text component
 * @return true if an auto-completion popup with the updated list should be shown, false otherwise.
 */
public boolean updateListData(final JList list,AutocompleterTextComponent comp){
  list.setListData(getUpdatedSuggestions(comp));
  if (list.getModel().getSize() == 1) {
    try {
      String typedFilename=FileURL.getFileURL(comp.getText()).getFilename();
      if (typedFilename.equalsIgnoreCase((String)list.getModel().getElementAt(0)))       return false;
    }
 catch (    MalformedURLException e) {
    }
  }
  return list.getModel().getSize() > 0;
}
Program: 44935
Project: 44935
Buggy source:
/** 
 * Sets the capacity of the   {@link LRUCache} that caches frequently accessed file instances. The more the capacity,the more frequent the cache is hit but the higher the memory usage. By default, the capacity is {@link #DEFAULT_FILE_CACHE_CAPACITY}. <p>If the specified capacity is different from the current one, a new cache instance will be created, thus clearing all previously cached files.</p>
 * @param capacity the capacity of the LRU cache that caches frequently accessed file instances
 * @see com.mucommander.cache.LRUCache
 */
public static void setFileCacheCapacity(int capacity){
  if (fileCache == null || fileCache.getCapacity() != capacity)   fileCache=LRUCache.createInstance(DEFAULT_FILE_CACHE_CAPACITY);
}

Fixed version (ground truth):
/** 
 * Sets the capacity of the   {@link LRUCache} that caches frequently accessed file instances. The more the capacity,the more frequent the cache is hit but the higher the memory usage. By default, the capacity is {@link #DEFAULT_FILE_CACHE_CAPACITY}. <p>If the specified capacity is different from the current one, a new cache instance will be created, thus clearing all previously cached files.</p>
 * @param capacity the capacity of the LRU cache that caches frequently accessed file instances
 * @see com.mucommander.cache.LRUCache
 */
public static void setFileCacheCapacity(int capacity){
  if (fileCache == null || fileCache.getCapacity() != capacity)   fileCache=LRUCache.createInstance(capacity);
}
Program: 44936
Project: 44936
Buggy source:
/** 
 * Sets the given button's action, custom label showing the accelerator, and icon taking into account the scale factor.
 */
private void setButtonAction(JButton button,MuAction action){
  button.setAction(action);
  button.setText(action.getLabel() + "String_Node_Str" + action.getAcceleratorText()+ "String_Node_Str");
  if (scaleFactor != 1.0f)   button.setIcon(IconManager.getScaledIcon(action.getIcon(),scaleFactor));
}

Fixed version (ground truth):
/** 
 * Sets the given button's action, custom label showing the accelerator, and icon taking into account the scale factor.
 */
private void setButtonAction(JButton button,MuAction action){
  button.setAction(action);
  String label;
  label=action.getLabel();
  if (action.getAcceleratorText() != null)   label+="String_Node_Str" + action.getAcceleratorText() + ']';
  button.setText(label);
  if (scaleFactor != 1.0f)   button.setIcon(IconManager.getScaledIcon(action.getIcon(),scaleFactor));
}
Program: 44937
Project: 44937
Buggy source:
public void show(FolderPanel folderPanel){
  this.folderPanel=folderPanel;
  int y=folderPanel.getLocationTextField().getHeight();
  show(folderPanel,folderPanel.getWidth() / 2,y);
  int x=(x=((folderPanel.getWidth() - getWidth()) / 2)) < 0 ? 0 : x;
  y+=(y=(folderPanel.getHeight() - getHeight()) / 3) < 0 ? 0 : y;
  show(folderPanel,x,y);
}

Fixed version (ground truth):
public void show(FolderPanel folderPanel){
  this.folderPanel=folderPanel;
  Dimension dim=getPreferredSize();
  int x=Math.max((folderPanel.getWidth() - (int)dim.getWidth()) / 2,0);
  int y=folderPanel.getLocationTextField().getHeight() + Math.max((folderPanel.getHeight() - (int)dim.getHeight()) / 3,0);
  show(folderPanel,x,y);
}
Program: 44938
Project: 44938
Buggy source:
public void show(FolderPanel folderPanel){
  this.folderPanel=folderPanel;
  Dimension dim=getPreferredSize();
  int x=Math.max((folderPanel.getWidth() - (int)dim.getWidth()) / 2,0);
  int y=folderPanel.getLocationTextField().getHeight() + Math.max((folderPanel.getHeight() - (int)dim.getHeight()) / 3,0);
  show(folderPanel,x,y);
}

Fixed version (ground truth):
public void show(FolderPanel folderPanel){
  this.folderPanel=folderPanel;
  if (prepareForShowing()) {
    Dimension dim=getPreferredSize();
    int x=Math.max((folderPanel.getWidth() - (int)dim.getWidth()) / 2,0);
    int y=folderPanel.getLocationTextField().getHeight() + Math.max((folderPanel.getHeight() - (int)dim.getHeight()) / 3,0);
    show(folderPanel,x,y);
  }
}
Program: 44939
Project: 44939
Buggy source:
public EmptyMessageMenuItem(String text){
  super(text);
}

Fixed version (ground truth):
public EmptyMessageMenuItem(String text){
  super(text);
  dim=new Dimension((int)Math.ceil(getFontMetrics(FONT).stringWidth(text) * 1.1),FONT.getSize() * 2);
}
Program: 44940
Project: 44940
Buggy source:
public HeaderMenuItem(String text){
  super(text);
}

Fixed version (ground truth):
public HeaderMenuItem(String text){
  super(text);
  dim=new Dimension((int)Math.ceil(getFontMetrics(HEADER_FONT).stringWidth(text) * 1.1),(int)(HEADER_FONT.getSize() * 1.5));
}
Program: 44941
Project: 44941
Buggy source:
/** 
 * Populates the look&feel combo box will all available look&feels.
 */
private void populateLookAndFeels(){
  int currentIndex;
  String currentName;
  String buffer;
  lookAndFeelComboBox.removeAllItems();
  initialiseAvailableLookAndFeels();
  currentIndex=-1;
  currentName=UIManager.getLookAndFeel().getName();
  for (int i=0; i < lookAndFeels.length; i++) {
    buffer=lookAndFeels[i].getName();
    if (currentName.equals(buffer))     currentIndex=i;
 else     if (currentIndex == -1 && (currentName.startsWith(buffer) || buffer.startsWith(currentName)))     currentIndex=i;
    lookAndFeelComboBox.addItem(buffer);
  }
  if (currentIndex == -1)   currentIndex=0;
  lookAndFeelComboBox.setSelectedIndex(currentIndex);
}

Fixed version (ground truth):
/** 
 * Populates the look&feel combo box will all available look&feels.
 */
private void populateLookAndFeels(){
  int currentIndex;
  String currentName;
  lookAndFeelComboBox.removeAllItems();
  initialiseAvailableLookAndFeels();
  currentIndex=-1;
  currentName=UIManager.getLookAndFeel().getClass().getName();
  for (int i=0; i < lookAndFeels.length; i++) {
    if (lookAndFeels[i].getClassName().equals(currentName))     currentIndex=i;
    lookAndFeelComboBox.addItem(lookAndFeels[i].getName());
  }
  if (currentIndex == -1)   currentIndex=0;
  lookAndFeelComboBox.setSelectedIndex(currentIndex);
}
Program: 44942
Project: 44942
Buggy source:
/** 
 * Adds auto-completion capabilities to this text field.
 */
private void enableAutoCompletion(){
  new TextFieldCompletion(new AutocompleterTextComponent(this){
    public void OnEnterPressed(    KeyEvent keyEvent){
      textFieldValidated();
    }
    public void OnEscPressed(    KeyEvent keyEvent){
      textFieldCancelled();
    }
  }
,CompleterFactory.getLocationCompleter());
}

Fixed version (ground truth):
/** 
 * Adds auto-completion capabilities to this text field.
 */
private void enableAutoCompletion(){
  new TextFieldCompletion(new AutocompleterTextComponent(this){
    public void OnEnterPressed(    KeyEvent keyEvent){
      if (textFieldValidated())       folderChangeCompleted(false);
      keyEvent.consume();
    }
    public void OnEscPressed(    KeyEvent keyEvent){
      textFieldCancelled();
    }
  }
,CompleterFactory.getLocationCompleter());
}
Program: 44943
Project: 44943
Buggy source:
public void OnEnterPressed(KeyEvent keyEvent){
  textFieldValidated();
}

Fixed version (ground truth):
public void OnEnterPressed(KeyEvent keyEvent){
  if (textFieldValidated())   folderChangeCompleted(false);
  keyEvent.consume();
}
Program: 44944
Project: 44944
Buggy source:
public void textFieldValidated(){
  String location=getText();
  if (OsFamilies.WINDOWS.isCurrent() && location.indexOf("String_Node_Str") == 1) {
    Matcher matcher=windowsTrailingSpacePattern.matcher(location);
    if (matcher.find())     location=location.substring(0,matcher.start());
  }
  Bookmark b=BookmarkManager.getBookmark(location);
  if (b != null) {
    folderPanel.tryChangeCurrentFolder(b.getLocation());
    return;
  }
  AbstractFile rootFolders[]=RootFolders.getRootFolders();
  for (int i=0; i < rootFolders.length; i++) {
    if (rootFolders[i].getName().equalsIgnoreCase(location)) {
      folderPanel.tryChangeCurrentFolder(rootFolders[i]);
      return;
    }
  }
  if (location.startsWith("String_Node_Str")) {
    String variableKey=location.substring(1);
    String variableValue=System.getenv(variableKey);
    if (variableValue != null)     location=variableValue;
  }
  folderChangeInitiatedByLocationField=true;
  locationFieldTextSave=location;
  folderPanel.tryChangeCurrentFolder(location);
}

Fixed version (ground truth):
/** 
 * @return true if a malformed url was entered, false otherwise.
 */
public boolean textFieldValidated(){
  String location=getText();
  if (OsFamilies.WINDOWS.isCurrent() && location.indexOf("String_Node_Str") == 1) {
    Matcher matcher=windowsTrailingSpacePattern.matcher(location);
    if (matcher.find())     location=location.substring(0,matcher.start());
  }
  locationFieldTextSave=location;
  boolean tryToInterpretEnteredString=true;
  Bookmark b=BookmarkManager.getBookmark(location);
  if (b != null) {
    setText(location=b.getLocation());
    tryToInterpretEnteredString=false;
  }
  AbstractFile rootFolders[]=RootFolders.getRootFolders();
  for (int i=0; tryToInterpretEnteredString && i < rootFolders.length; i++) {
    if (rootFolders[i].getName().equalsIgnoreCase(location)) {
      setText(location=rootFolders[i].getAbsolutePath());
      tryToInterpretEnteredString=false;
    }
  }
  if (tryToInterpretEnteredString && location.startsWith("String_Node_Str")) {
    String variableKey=location.substring(1);
    String variableValue=System.getenv(variableKey);
    if (variableValue != null)     setText(location=variableValue);
  }
  folderChangeInitiatedByLocationField=true;
  return folderPanel.tryChangeCurrentFolder(location) == null;
}
Program: 44945
Project: 44945
Buggy source:
public void treeStructureChanged(TreeModelEvent e){
  updateSelectedFolder();
  tree.repaint();
}

Fixed version (ground truth):
public void treeStructureChanged(TreeModelEvent e){
  if (!changeTimer.isRunning()) {
    updateSelectedFolder();
    tree.repaint();
  }
}
Program: 44946
Project: 44946
Buggy source:
/** 
 * Changes the current folder in an associated folder panel, depending on the current selection in tree.
 */
public void valueChanged(TreeSelectionEvent e){
  TreePath path=e.getNewLeadSelectionPath();
  if (path != null) {
    AbstractFile f=(AbstractFile)path.getLastPathComponent();
    if (f != null && f.isBrowsable() && f != folderPanel.getCurrentFolder()) {
      if (changeTimer == null) {
        changeTimer=new ChangeTimer();
      }
      changeTimer.folder=f;
      changeTimer.restart();
    }
  }
}

Fixed version (ground truth):
/** 
 * Changes the current folder in an associated folder panel, depending on the current selection in tree.
 */
public void valueChanged(TreeSelectionEvent e){
  TreePath path=e.getNewLeadSelectionPath();
  if (path != null) {
    AbstractFile f=(AbstractFile)path.getLastPathComponent();
    if (f != null && f.isBrowsable() && f != folderPanel.getCurrentFolder()) {
      changeTimer.folder=f;
      changeTimer.restart();
    }
  }
}
Program: 44947
Project: 44947
Buggy source:
/** 
 * Skips (up to) the specified number of bytes and returns the number of bytes effectively skipped. The exact given number of bytes will be skipped as long as the current offset as returned by   {@link #getOffset()}plus the number of bytes to skip doesn't exceed the length of this stream as returned by   {@link #getLength()}. If it does, all the remaining bytes will be skipped so that the offset of this stream will be positionned to  {@link #getLength()}.
 * @param n number of bytes to skip
 * @return the number of bytes that have effectively been skipped
 * @throws IOException if something went wrong
 */
public long skip(long n) throws IOException {
  long offset=getOffset();
  long length=getLength();
  if (offset + n >= length) {
    seek(length - 1);
    return length - offset - 1;
  }
  seek(offset + n);
  return n;
}

Fixed version (ground truth):
/** 
 * Skips (up to) the specified number of bytes and returns the number of bytes effectively skipped. The exact given number of bytes will be skipped as long as the current offset as returned by   {@link #getOffset()}plus the number of bytes to skip doesn't exceed the length of this stream as returned by   {@link #getLength()}. If it does, all the remaining bytes will be skipped so that the offset of this stream will be positionned to  {@link #getLength()}. Returns <code>-1</code> if the offset is already positionned to the end of the stream when this method is called.
 * @param n number of bytes to skip
 * @return the number of bytes that have effectively been skipped, -1 if the offset is already positionned to theend of the stream when this method is called
 * @throws IOException if something went wrong
 */
public long skip(long n) throws IOException {
  if (n <= 0)   return 0;
  long offset=getOffset();
  long length=getLength();
  if (offset >= length)   return -1;
  long newOffset=offset + n;
  if (newOffset > length)   newOffset=length;
  seek(newOffset);
  return (int)(newOffset - offset);
}
Program: 44950
Project: 44950
Buggy source:
/** 
 * Overrides   {@link AbstractFile#moveTo(AbstractFile)} to move/rename the file directly if the destination fileis also a local file.
 */
public boolean moveTo(AbstractFile destFile) throws FileTransferException {
  if (!destFile.getURL().getProtocol().equals(FileProtocols.FILE)) {
    return super.moveTo(destFile);
  }
  destFile=destFile.getTopAncestor();
  if (!(destFile instanceof LocalFile)) {
    return super.moveTo(destFile);
  }
  checkCopyPrerequisites(destFile,true);
  return file.renameTo(((LocalFile)destFile).file);
}

Fixed version (ground truth):
/** 
 * Overrides   {@link AbstractFile#moveTo(AbstractFile)} to move/rename the file directly if the destination fileis also a local file.
 */
public boolean moveTo(AbstractFile destFile) throws FileTransferException {
  if (!destFile.getURL().getProtocol().equals(FileProtocols.FILE)) {
    return super.moveTo(destFile);
  }
  destFile=destFile.getTopAncestor();
  if (!(destFile instanceof LocalFile)) {
    return super.moveTo(destFile);
  }
  checkCopyPrerequisites(destFile,true);
  File destJavaIoFile=((LocalFile)destFile).file;
  if (IS_WINDOWS) {
    if (OsVersions.WINDOWS_ME.isCurrentOrLower() && destFile.exists()) {
      destJavaIoFile.delete();
    }
 else {
      return Kernel32API.INSTANCE.MoveFileEx(absPath,destFile.getAbsolutePath(),Kernel32API.MOVEFILE_REPLACE_EXISTING | Kernel32API.MOVEFILE_WRITE_THROUGH);
    }
  }
  return file.renameTo(destJavaIoFile);
}
Program: 44951
Project: 44951
Buggy source:
public void setColumnModel(TableColumnModel columnModel){
  if (filenameEditor != null)   columnModel.getColumn(convertColumnIndexToView(Columns.NAME)).setCellEditor(filenameEditor);
  super.setColumnModel(columnModel);
}

Fixed version (ground truth):
public void setColumnModel(TableColumnModel columnModel){
  super.setColumnModel(columnModel);
  if (filenameEditor != null)   columnModel.getColumn(convertColumnIndexToView(Columns.NAME)).setCellEditor(filenameEditor);
  if (usesTableHeaderRenderingProperties())   setTableHeaderRenderingProperties();
}
Program: 44952
Project: 44952
Buggy source:
/** 
 * Under Mac OS X 10.5 (Leopard) and up, sets client properties on this table's JTableHeader to indicate the current sort criterion/column and sort order (ascending or descending). These properties allow Mac OS X/Java to render the headers accordingly, instead of having to use a   {@link FileTableHeaderRenderer custom header renderer}. This method has no effect whatsoever on platforms other where   {@link #usesTableHeaderRenderingProperties()}returns <code>false</code>.
 */
private void setTableHeaderRenderingProperties(){
  if (usesTableHeaderRenderingProperties()) {
    JTableHeader tableHeader=getTableHeader();
    boolean isActiveTable=isActiveTable();
    tableHeader.putClientProperty("String_Node_Str",isActiveTable ? new Integer(getColumnPosition(getSortByCriteria())) : null);
    tableHeader.putClientProperty("String_Node_Str",isActiveTable ? isSortAscending() ? "String_Node_Str" : "String_Node_Str" : null);
  }
}

Fixed version (ground truth):
/** 
 * Under Mac OS X 10.5 (Leopard) and up, sets client properties on this table's JTableHeader to indicate the current sort criterion/column and sort order (ascending or descending). These properties allow Mac OS X/Java to render the headers accordingly, instead of having to use a   {@link FileTableHeaderRenderer custom header renderer}. This method has no effect whatsoever on platforms other where   {@link #usesTableHeaderRenderingProperties()}returns <code>false</code>.
 */
private void setTableHeaderRenderingProperties(){
  if (usesTableHeaderRenderingProperties()) {
    JTableHeader tableHeader=getTableHeader();
    if (tableHeader == null)     return;
    boolean isActiveTable=isActiveTable();
    tableHeader.putClientProperty("String_Node_Str",isActiveTable ? new Integer(getColumnPosition(getSortByCriteria())) : null);
    tableHeader.putClientProperty("String_Node_Str",isActiveTable ? isSortAscending() ? "String_Node_Str" : "String_Node_Str" : null);
  }
}
Program: 44953
Project: 44953
Buggy source:
/** 
 * Edits the currently selected file.
 */
public synchronized void performAction(){
  AbstractFile file;
  boolean useCustomCommand;
  Command customCommand;
  file=mainFrame.getActiveTable().getSelectedFile();
  if (file != null && !(file.isDirectory() || file.isSymlink())) {
    useCustomCommand=useCustomCommand();
    customCommand=getCustomCommand();
    if (useCustomCommand && customCommand != null) {
      if (file.getURL().getProtocol().equals(FileProtocols.FILE) && (file instanceof LocalFile)) {
        try {
          ProcessRunner.execute(customCommand.getTokens(file),file);
        }
 catch (        Exception e) {
          reportGenericError();
        }
      }
 else {
        ProgressDialog progressDialog=new ProgressDialog(mainFrame,Translator.get("String_Node_Str"));
        TempOpenWithJob job=new TempOpenWithJob(progressDialog,mainFrame,file,customCommand);
        progressDialog.start(job);
      }
    }
 else     performInternalAction(file);
  }
}

Fixed version (ground truth):
/** 
 * Edits the currently selected file.
 */
public synchronized void performAction(){
  AbstractFile file;
  boolean useCustomCommand;
  Command customCommand;
  file=mainFrame.getActiveTable().getSelectedFile();
  if (file != null) {
    useCustomCommand=useCustomCommand();
    customCommand=getCustomCommand();
    if (useCustomCommand && customCommand != null) {
      if (file.getURL().getProtocol().equals(FileProtocols.FILE) && (file instanceof LocalFile)) {
        try {
          ProcessRunner.execute(customCommand.getTokens(file),file);
        }
 catch (        Exception e) {
          reportGenericError();
        }
      }
 else {
        ProgressDialog progressDialog=new ProgressDialog(mainFrame,Translator.get("String_Node_Str"));
        TempOpenWithJob job=new TempOpenWithJob(progressDialog,mainFrame,file,customCommand);
        progressDialog.start(job);
      }
    }
 else     performInternalAction(file);
  }
}
Program: 44954
Project: 44954
Buggy source:
public boolean canViewFile(AbstractFile file){
  return filter.accept(file);
}

Fixed version (ground truth):
public boolean canViewFile(AbstractFile file){
  if (file.isDirectory())   return false;
  return filter.accept(file);
}
Program: 44955
Project: 44955
Buggy source:
private boolean doGenericChecks(AbstractFile file) throws WarnUserException {
  if (file.getSize() > 1048576)   throw new WarnUserException(Translator.get("String_Node_Str"));
  InputStream in=null;
  try {
    in=file.getInputStream();
    if (BinaryDetector.guessBinary(in))     throw new WarnUserException(Translator.get("String_Node_Str"));
  }
 catch (  IOException e) {
  }
 finally {
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException e2) {
      }
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean doGenericChecks(AbstractFile file) throws WarnUserException {
  if (file.isDirectory())   return false;
  if (file.getSize() > 1048576)   throw new WarnUserException(Translator.get("String_Node_Str"));
  InputStream in=null;
  try {
    in=file.getInputStream();
    if (BinaryDetector.guessBinary(in))     throw new WarnUserException(Translator.get("String_Node_Str"));
  }
 catch (  IOException e) {
  }
 finally {
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException e2) {
      }
    }
  }
  return true;
}
Program: 44956
Project: 44956
Buggy source:
public AbstractFile getParent() throws IOException {
  if (!getParentSet) {
    getParent=file.getParent();
    if (recurseInstances)     getParent=new CachedFile(getParent,true);
    getParentSet=true;
  }
  return getParent;
}

Fixed version (ground truth):
public AbstractFile getParent() throws IOException {
  if (!getParentSet) {
    getParent=file.getParent();
    if (recurseInstances && getParent != null)     getParent=new CachedFile(getParent,true);
    getParentSet=true;
  }
  return getParent;
}
Program: 44957
Project: 44957
Buggy source:
/** 
 * Opens both the active and inactive folder panel's parent directories.
 */
public void performAction(){
synchronized (lock) {
    if (goToParent(mainFrame.getActiveTable().getFolderPanel())) {
      isWaiting=true;
      status=false;
      while (isWaiting) {
        try {
          wait();
        }
 catch (        Exception e) {
        }
      }
      if (status)       goToParent(mainFrame.getInactiveTable().getFolderPanel());
    }
  }
}

Fixed version (ground truth):
/** 
 * Opens both the active and inactive folder panel's parent directories.
 */
public void performAction(){
  Thread openThread;
  AbstractFile parent;
  if ((parent=mainFrame.getActiveTable().getFolderPanel().getCurrentFolder().getParentSilently()) != null) {
    openThread=mainFrame.getActiveTable().getFolderPanel().tryChangeCurrentFolder(parent);
    if ((parent=mainFrame.getInactiveTable().getFolderPanel().getCurrentFolder().getParentSilently()) != null) {
      if (openThread != null) {
        while (openThread.isAlive()) {
          try {
            openThread.join();
          }
 catch (          InterruptedException e) {
          }
        }
      }
      mainFrame.getInactiveTable().getFolderPanel().tryChangeCurrentFolder(parent);
    }
  }
}
Program: 44958
Project: 44958
Buggy source:
/** 
 * Opens the current selection and its inactive equivalent.
 */
public void performAction(){
synchronized (lock) {
    AbstractFile file;
    AbstractFile otherFile;
    if ((file=mainFrame.getActiveTable().getSelectedFile(true)) == null)     return;
    try {
      if (mainFrame.getActiveTable().isParentFolderSelected())       otherFile=mainFrame.getInactiveTable().getCurrentFolder().getParentSilently();
 else {
        otherFile=mainFrame.getInactiveTable().getCurrentFolder().getDirectChild(file.getName());
        if (!(file.isBrowsable() == otherFile.isBrowsable()))         otherFile=null;
      }
    }
 catch (    Exception e) {
      otherFile=null;
    }
    open(file,mainFrame.getActiveTable().getFolderPanel());
    if (!file.isBrowsable())     open(otherFile,mainFrame.getInactiveTable().getFolderPanel());
 else     if (otherFile != null && otherFile.exists()) {
      isWaiting=true;
      status=true;
      while (isWaiting) {
        try {
          wait();
        }
 catch (        Exception e) {
        }
      }
      if (status)       open(otherFile,mainFrame.getInactiveTable().getFolderPanel());
    }
  }
}

Fixed version (ground truth):
/** 
 * Opens the current selection and its inactive equivalent.
 */
public void performAction(){
  Thread openThread;
  AbstractFile file;
  AbstractFile otherFile;
  if ((file=mainFrame.getActiveTable().getSelectedFile(true)) == null || !file.isBrowsable())   return;
  try {
    if (mainFrame.getActiveTable().isParentFolderSelected())     otherFile=mainFrame.getInactiveTable().getCurrentFolder().getParentSilently();
 else {
      otherFile=mainFrame.getInactiveTable().getCurrentFolder().getDirectChild(file.getName());
      if (!otherFile.exists() && !otherFile.isBrowsable())       otherFile=null;
    }
  }
 catch (  Exception e) {
    otherFile=null;
  }
  openThread=mainFrame.getActiveTable().getFolderPanel().tryChangeCurrentFolder(file);
  if (otherFile != null) {
    if (openThread != null) {
      while (openThread.isAlive()) {
        try {
          openThread.join();
        }
 catch (        InterruptedException e) {
        }
      }
    }
    mainFrame.getInactiveTable().getFolderPanel().tryChangeCurrentFolder(otherFile);
  }
}
Program: 44959
Project: 44959
Buggy source:
/** 
 * Creates a new <code>OpenInBothPanelsAction</code> with the specified parameters.
 * @param mainFrame  frame to which the action is attached.
 * @param properties action's properties.
 */
public OpenInBothPanelsAction(MainFrame mainFrame,Hashtable properties){
  super(mainFrame,properties);
  mainFrame.getFolderPanel1().getLocationManager().addLocationListener(this);
  mainFrame.getFolderPanel2().getLocationManager().addLocationListener(this);
}

Fixed version (ground truth):
/** 
 * Creates a new <code>OpenInBothPanelsAction</code> with the specified parameters.
 * @param mainFrame  frame to which the action is attached.
 * @param properties action's properties.
 */
public OpenInBothPanelsAction(MainFrame mainFrame,Hashtable properties){
  super(mainFrame,properties);
  setSelectedFileFilter(new AttributeFileFilter(AttributeFileFilter.BROWSABLE));
}
Program: 44960
Project: 44960
Buggy source:
public void write(byte b[],int off,int len) throws IOException {
  int nbToWrite;
synchronized (bb) {
    bb.position(0);
    nbToWrite=Math.min(bb.capacity(),len);
    bb.limit(nbToWrite);
    bb.put(b,off,nbToWrite);
    bb.position(0);
    channel.write(bb);
  }
}

Fixed version (ground truth):
public void write(byte b[],int off,int len) throws IOException {
  int nbToWrite;
synchronized (bb) {
    do {
      bb.position(0);
      nbToWrite=Math.min(bb.capacity(),len);
      bb.limit(nbToWrite);
      bb.put(b,off,nbToWrite);
      bb.position(0);
      nbToWrite=channel.write(bb);
      len-=nbToWrite;
      off+=nbToWrite;
    }
 while (len > 0);
  }
}
Program: 44961
Project: 44961
Buggy source:
public abstract void performInternalAction(AbstractFile file);

Fixed version (ground truth):
/** 
 * Opens the specified file without a custom command.
 * @param file file to open.
 */
public abstract void performInternalAction(AbstractFile file);
Program: 44962
Project: 44962
Buggy source:
/** 
 * Edits the currently selected file.
 */
public synchronized void performAction(){
  AbstractFile file;
  file=mainFrame.getActiveTable().getSelectedFile();
  if (file != null && !(file.isDirectory() || file.isSymlink())) {
    if (useCustomCommand && customCommand != null) {
      if (file.getURL().getProtocol().equals(FileProtocols.FILE) && (file instanceof LocalFile)) {
        try {
          ProcessRunner.execute(customCommand.getTokens(file),file);
        }
 catch (        Exception e) {
          reportGenericError();
        }
      }
 else {
        ProgressDialog progressDialog=new ProgressDialog(mainFrame,Translator.get("String_Node_Str"));
        TempOpenWithJob job=new TempOpenWithJob(progressDialog,mainFrame,file,customCommand);
        progressDialog.start(job);
      }
    }
 else     performInternalAction(file);
  }
}

Fixed version (ground truth):
/** 
 * Edits the currently selected file.
 */
public synchronized void performAction(){
  AbstractFile file;
  boolean useCustomCommand;
  Command customCommand;
  file=mainFrame.getActiveTable().getSelectedFile();
  if (file != null && !(file.isDirectory() || file.isSymlink())) {
    useCustomCommand=useCustomCommand();
    customCommand=getCustomCommand();
    if (useCustomCommand && customCommand != null) {
      if (file.getURL().getProtocol().equals(FileProtocols.FILE) && (file instanceof LocalFile)) {
        try {
          ProcessRunner.execute(customCommand.getTokens(file),file);
        }
 catch (        Exception e) {
          reportGenericError();
        }
      }
 else {
        ProgressDialog progressDialog=new ProgressDialog(mainFrame,Translator.get("String_Node_Str"));
        TempOpenWithJob job=new TempOpenWithJob(progressDialog,mainFrame,file,customCommand);
        progressDialog.start(job);
      }
    }
 else     performInternalAction(file);
  }
}
Program: 44963
Project: 44963
Buggy source:
/** 
 * Sets the custom editor to the specified command.
 * @param command command to use as a custom editor.
 */
protected void setCustomCommand(String command){
  if (command == null)   customCommand=null;
 else   customCommand=new Command(getClass().getName(),command);
}

Fixed version (ground truth):
/** 
 * Sets the command to use to open files.
 * @param command command that will be used to open files.
 */
protected void setCustomCommand(String command){
  putValue(CUSTOM_COMMAND_PROPERTY_KEY,command == null ? null : new Command(getClass().getName(),command));
}
Program: 44964
Project: 44964
Buggy source:
public AbstractViewerAction(MainFrame mainFrame,Hashtable properties){
  super(mainFrame,properties);
  setSelectedFileFilter(new AttributeFileFilter(AttributeFileFilter.DIRECTORY,true));
  MuConfiguration.addConfigurationListener(this);
}

Fixed version (ground truth):
/** 
 * Creates a new instance of <code>AbstractViewerAction</code>.
 * @param mainFrame  frame to which the action is attached.
 * @param properties action's properties.
 */
public AbstractViewerAction(MainFrame mainFrame,Hashtable properties){
  super(mainFrame,properties);
  setSelectedFileFilter(new AttributeFileFilter(AttributeFileFilter.DIRECTORY,true));
}
Program: 44965
Project: 44965
Buggy source:
protected void setUseCustomCommand(boolean use){
  useCustomCommand=use;
}

Fixed version (ground truth):
/** 
 * Sets whether or not to use custom commands to open files.
 * @param use whether or not to use custom commands.
 */
protected void setUseCustomCommand(boolean use){
  putValue(USE_CUSTOM_COMMAND_PROPERTY_KEY,new Boolean(use));
}
Program: 44966
Project: 44966
Buggy source:
public EditAction(MainFrame mainFrame,Hashtable properties){
  super(mainFrame,properties);
  setUseCustomCommand(MuConfiguration.getVariable(MuConfiguration.USE_CUSTOM_EDITOR,MuConfiguration.DEFAULT_USE_CUSTOM_EDITOR));
  setCustomCommand(MuConfiguration.getVariable(MuConfiguration.CUSTOM_EDITOR));
}

Fixed version (ground truth):
/** 
 * Creates a new instance of <code>EditAction</code>.
 * @param mainFrame  frame to which the action is attached.
 * @param properties action's properties.
 */
public EditAction(MainFrame mainFrame,Hashtable properties){
  super(mainFrame,properties);
  setUseCustomCommand(MuConfiguration.getVariable(MuConfiguration.USE_CUSTOM_EDITOR,MuConfiguration.DEFAULT_USE_CUSTOM_EDITOR));
  setCustomCommand(MuConfiguration.getVariable(MuConfiguration.CUSTOM_EDITOR));
  MuConfiguration.addConfigurationListener(this);
}
Program: 44967
Project: 44967
Buggy source:
public ViewAction(MainFrame mainFrame,Hashtable properties){
  super(mainFrame,properties);
  setUseCustomCommand(MuConfiguration.getVariable(MuConfiguration.USE_CUSTOM_VIEWER,MuConfiguration.DEFAULT_USE_CUSTOM_VIEWER));
  setCustomCommand(MuConfiguration.getVariable(MuConfiguration.CUSTOM_VIEWER));
}

Fixed version (ground truth):
/** 
 * Creates a new instance of <code>ViewAction</code>.
 * @param mainFrame  frame to which the action is attached.
 * @param properties action's properties.
 */
public ViewAction(MainFrame mainFrame,Hashtable properties){
  super(mainFrame,properties);
  setUseCustomCommand(MuConfiguration.getVariable(MuConfiguration.USE_CUSTOM_VIEWER,MuConfiguration.DEFAULT_USE_CUSTOM_VIEWER));
  setCustomCommand(MuConfiguration.getVariable(MuConfiguration.CUSTOM_VIEWER));
  MuConfiguration.addConfigurationListener(this);
}
Program: 44968
Project: 44968
Buggy source:
public static long getUnitBytes(int unit){
  long bytes;
switch (unit) {
case BYTE_UNIT:
    bytes=1;
  break;
case KILO_BYTE_UNIT:
bytes=KB_1;
break;
case MEGA_BYTE_UNIT:
bytes=MB_1;
break;
case GIGA_BYTE_UNIT:
bytes=GB_1;
break;
case TERA_BYTE_UNIT:
bytes=TB_1;
break;
default :
return 0;
}
return bytes;
}

Fixed version (ground truth):
/** 
 * Returns the size in bytes of the given byte unit, e.g. <code>1024</code> for   {@link #KILOBYTE_UNIT}.
 * @param unit a unit constant, see constant fields for allowed values
 * @return the size in bytes of the given byte unit
 */
public static long getUnitBytes(int unit){
  long bytes;
switch (unit) {
case BYTE_UNIT:
    bytes=1;
  break;
case KILOBYTE_UNIT:
bytes=KB_1;
break;
case MEGABYTE_UNIT:
bytes=MB_1;
break;
case GIGABYTE_UNIT:
bytes=GB_1;
break;
case TERABYTE_UNIT:
bytes=TB_1;
break;
default :
return 0;
}
return bytes;
}
Program: 44970
Project: 44970
Buggy source:
public static String getUnitString(int unit,boolean speedUnit){
  String unitString;
switch (unit) {
case BYTE_UNIT:
    unitString=B;
  break;
case KILO_BYTE_UNIT:
unitString=KB;
break;
case MEGA_BYTE_UNIT:
unitString=MB;
break;
case GIGA_BYTE_UNIT:
unitString=GB;
break;
case TERA_BYTE_UNIT:
unitString=TB;
break;
default :
return "String_Node_Str";
}
return speedUnit ? Translator.get(SPEED_KEY,unitString) : unitString;
}

Fixed version (ground truth):
public static String getUnitString(int unit,boolean speedUnit){
  String unitString;
switch (unit) {
case BYTE_UNIT:
    unitString=B;
  break;
case KILOBYTE_UNIT:
unitString=KB;
break;
case MEGABYTE_UNIT:
unitString=MB;
break;
case GIGABYTE_UNIT:
unitString=GB;
break;
case TERABYTE_UNIT:
unitString=TB;
break;
default :
return "String_Node_Str";
}
return speedUnit ? Translator.get(SPEED_KEY,unitString) : unitString;
}
Program: 44971
Project: 44971
Buggy source:
public AbstractFile[] ls(FilenameFilter filenameFilter) throws IOException {
  String names[]=file.list();
  if (names == null)   throw new IOException();
  if (filenameFilter != null)   names=filenameFilter.filter(names);
  AbstractFile children[]=new AbstractFile[names.length];
  FileURL childURL;
  for (int i=0; i < names.length; i++) {
    childURL=(FileURL)fileURL.clone();
    childURL.setPath(absPath + SEPARATOR + names[i]);
    children[i]=FileFactory.getFile(childURL,this);
  }
  return children;
}

Fixed version (ground truth):
public AbstractFile[] ls(FilenameFilter filenameFilter) throws IOException {
  String names[]=file.list();
  if (names == null)   throw new IOException();
  if (filenameFilter != null)   names=filenameFilter.filter(names);
  AbstractFile children[]=new AbstractFile[names.length];
  FileURL childURL;
  for (int i=0; i < names.length; i++) {
    childURL=(FileURL)fileURL.clone();
    if (isUNC)     childURL.setPath(addTrailingSeparator(fileURL.getPath()) + names[i]);
 else     childURL.setPath(absPath + SEPARATOR + names[i]);
    children[i]=FileFactory.getFile(childURL,this);
  }
  return children;
}
Program: 44972
Project: 44972
Buggy source:
/** 
 * Creates a new instance of LocalFile. The given FileURL's protocol should be   {@link FileProtocols#FILE}, and the host   {@link FileURL#LOCALHOST}.  
 */
public LocalFile(FileURL fileURL) throws IOException {
  super(fileURL);
  String path=fileURL.getPath();
  String hostname=fileURL.getHost();
  if (IS_WINDOWS && !FileURL.LOCALHOST.equals(hostname))   path="String_Node_Str" + hostname + fileURL.getPath().replace('/','\\');
  this.file=new File(path);
  if (!file.isAbsolute())   throw new IOException();
  this.parentFilePath=file.getParent();
  this.absPath=file.getAbsolutePath();
  this.absPath=absPath.endsWith(SEPARATOR) ? absPath.substring(0,absPath.length() - 1) : absPath;
}

Fixed version (ground truth):
/** 
 * Creates a new instance of LocalFile. The given FileURL's protocol should be   {@link FileProtocols#FILE}, and the host   {@link FileURL#LOCALHOST}.  
 */
public LocalFile(FileURL fileURL) throws IOException {
  super(fileURL);
  String path=fileURL.getPath();
  String hostname=fileURL.getHost();
  if (IS_WINDOWS && !FileURL.LOCALHOST.equals(hostname)) {
    path="String_Node_Str" + hostname + fileURL.getPath().replace('/','\\');
    isUNC=true;
  }
  this.file=new File(path);
  if (!file.isAbsolute())   throw new IOException();
  this.parentFilePath=file.getParent();
  this.absPath=file.getAbsolutePath();
  this.absPath=absPath.endsWith(SEPARATOR) ? absPath.substring(0,absPath.length() - 1) : absPath;
}
Program: 44973
Project: 44973
Buggy source:
/** 
 * Returns <code>true</code> if a quick search is being performed.
 */
public boolean isActive(){
  return timerThread != null;
}

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if a quick search is being performed.
 * @return true if a quick search is being performed
 */
public boolean isActive(){
  return timerThread != null;
}
Program: 44975
Project: 44975
Buggy source:
/** 
 * Returns <code>true</code> the current quick search string matches the given filename. Always returns <code>false</code> when the quick search is inactive.
 * @param filename the filename to test against the quick search string
 * @return true if the current quick search string matches the given filename
 */
public boolean matches(String filename){
  if (!isActive())   return false;
  return filename.toLowerCase().indexOf(searchString.toLowerCase()) != -1;
}

Fixed version (ground truth):
/** 
 * Returns <code>true</code> the current quick search string matches the given filename. Always returns <code>false</code> when the quick search is inactive.
 * @param filename the filename to test against the quick search string
 * @return true if the current quick search string matches the given filename
 */
public boolean matches(String filename){
  return isActive() && filename.toLowerCase().indexOf(searchString.toLowerCase()) != -1;
}
Program: 44976
Project: 44976
Buggy source:
public void setLength(long newLength) throws IOException {
  raf.setLength(newLength);
}

Fixed version (ground truth):
public void setLength(long newLength) throws IOException {
  raf.setLength(newLength);
  if (getOffset() > newLength)   raf.seek(newLength);
}
Program: 44977
Project: 44977
Buggy source:
/** 
 * Registers a FileEditor.
 */
public static void registerFileEditor(EditorFactory factory){
  editorFactories.add(factory);
}

Fixed version (ground truth):
/** 
 * Registers a FileEditor.
 * @param factory file editor factory to register.
 */
public static void registerFileEditor(EditorFactory factory){
  editorFactories.add(factory);
}
Program: 44978
Project: 44978
Buggy source:
/** 
 * Returns a description of the file currently being edited which will be used as a window title. This method returns the file's path but it can be overridden to provide more information.
 */
public String getTitle(){
  return file.getAbsolutePath();
}

Fixed version (ground truth):
/** 
 * Returns a description of the file currently being edited which will be used as a window title. This method returns the file's path but it can be overridden to provide more information.
 * @return the editor's title.
 */
public String getTitle(){
  return file.getAbsolutePath();
}
Program: 44979
Project: 44979
Buggy source:
/** 
 * This method is invoked when the user asked to save current file to the specified file.
 * @param saveAsFile the file which should be used to save the file currently being edited(path can be different from current file if the user chose 'Save as').
 */
protected abstract void saveAs(AbstractFile saveAsFile) throws IOException ;

Fixed version (ground truth):
/** 
 * This method is invoked when the user asked to save current file to the specified file.
 * @param saveAsFile the file which should be used to save the file currently being edited(path can be different from current file if the user chose 'Save as').
 * @throws IOException if an I/O error occurs.
 */
protected abstract void saveAs(AbstractFile saveAsFile) throws IOException ;
Program: 44980
Project: 44980
Buggy source:
/** 
 * Sets the EditorFrame (separate window) that contains this FileEditor.
 */
public void setFrame(EditorFrame frame){
  this.frame=frame;
}

Fixed version (ground truth):
/** 
 * Sets the EditorFrame (separate window) that contains this FileEditor.
 * @param frame frame that contains this <code>FileEditor</code>.
 * @see #getFrame()
 */
public void setFrame(EditorFrame frame){
  this.frame=frame;
}
Program: 44981
Project: 44981
Buggy source:
/** 
 * This method is invoked when the specified file is about to be edited. This method should retrieve the file and do whatever's necessary for this component can be displayed.
 * @param file the file that is about to be edited.
 */
public abstract void edit(AbstractFile file) throws IOException ;

Fixed version (ground truth):
/** 
 * This method is invoked when the specified file is about to be edited. This method should retrieve the file and do whatever's necessary for this component can be displayed.
 * @param file the file that is about to be edited.
 * @throws IOException if an I/O error occurs.
 */
public abstract void edit(AbstractFile file) throws IOException ;
Program: 44982
Project: 44982
Buggy source:
/** 
 * Returns the frame which contains this editor, may return <code>null</code> if the editor is not inside a EditorFrame.
 */
protected EditorFrame getFrame(){
  return frame;
}

Fixed version (ground truth):
/** 
 * Returns the frame which contains this editor. <p> This method may return <code>null</code> if the editor is not inside a EditorFrame.
 * @return the frame which contains this editor.
 * @see #setFrame(EditorFrame)
 */
protected EditorFrame getFrame(){
  return frame;
}
Program: 44983
Project: 44983
Buggy source:
/** 
 * Returns maximum file size this FileEditor can handle for sure, -1 if there is no such limit. If a user wish to edit a file that exceeds this size, he/she will be asked if he/she still wants to edit it.
 */
public long getMaxRecommendedSize(){
  return -1;
}

Fixed version (ground truth):
/** 
 * Returns the maximum file size this FileEditor can handle. <p> If there is no maximum limit, returns <code>-1</code>. </p> <p> If a user wish to edit a file that exceeds this size, he/she will be asked if he/she still wants to edit it. </p>
 * @return the maximum file size this <code>FileEditor</code> can handle.
 */
public long getMaxRecommendedSize(){
  return -1;
}
Program: 44984
Project: 44984
Buggy source:
/** 
 * Sets the file that is to be edited. This method will automatically be called after a file editor is created and should not be called directly.
 */
public final void setCurrentFile(AbstractFile file){
  this.file=file;
}

Fixed version (ground truth):
/** 
 * Sets the file that is to be edited. This method will automatically be called after a file editor is created and should not be called directly.
 * @param file file that is to be edited.
 */
public final void setCurrentFile(AbstractFile file){
  this.file=file;
}
Program: 44985
Project: 44985
Buggy source:
/** 
 * Returns <code>true</code> if the given file can be handled by this FileEditor.<br> The FileEditor may base its decision only upon the filename and its extension or may wish to read some of the file and compare it to a magic number.
 */
public static boolean canEditFile(AbstractFile file){
  return false;
}

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if the given file can be handled by this FileEditor. <p> The FileEditor may base its decision only upon the filename and its extension or may wish to read some of the file and compare it to a magic number. </p>
 * @param file file that must be checked.
 * @return <code>true</code> if the given file can be handled by this FileEditor, <code>false</code> otherwise.
 */
public static boolean canEditFile(AbstractFile file){
  return false;
}
Program: 44986
Project: 44986
Buggy source:
/** 
 * This method is invoked when the specified file is about to be viewed. This method should retrieve the file and do the necessary so that this component can be displayed.
 * @param file the file that is about to be viewed.
 */
public abstract void view(AbstractFile file) throws IOException ;

Fixed version (ground truth):
/** 
 * This method is invoked when the specified file is about to be viewed. This method should retrieve the file and do the necessary so that this component can be displayed.
 * @param file        the file that is about to be viewed.
 * @throws IOException if an I/O error occurs.
 */
public abstract void view(AbstractFile file) throws IOException ;
Program: 44987
Project: 44987
Buggy source:
/** 
 * Returns a description of the file currently being viewed which will be used as a window title. This method returns the file's name but it can be overridden to provide more information.
 */
public String getTitle(){
  return file.getName();
}

Fixed version (ground truth):
/** 
 * Returns a description of the file currently being viewed which will be used as a window title. This method returns the file's name but it can be overridden to provide more information.
 * @return this dialog's title.
 */
public String getTitle(){
  return file.getName();
}
Program: 44988
Project: 44988
Buggy source:
/** 
 * Sets the ViewerFrame (separate window) that contains this FileViewer.
 */
public void setFrame(ViewerFrame frame){
  this.frame=frame;
}

Fixed version (ground truth):
/** 
 * Sets the ViewerFrame (separate window) that contains this FileViewer.
 * @param frame frame that contains this <code>FileViewer</code>.
 * @see #getFrame()
 */
public void setFrame(ViewerFrame frame){
  this.frame=frame;
}
Program: 44989
Project: 44989
Buggy source:
/** 
 * Returns <code>true</code> if the given file can be handled by this FileViewer.<br> The FileViewer may base its decision only upon the filename and its extension or may wish to read some of the file and compare it to a magic number.
 */
public static boolean canViewFile(AbstractFile file){
  return false;
}

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if the given file can be handled by this FileViewer. <p> The FileViewer may base its decision only upon the filename and its extension or may wish to read some of the file and compare it to a magic number. </p>
 * @param file file that must be checked.
 * @return      <code>true</code> if the given file can be handled by this <code>FileViewer</code>, <code>false</code> otherwise.
 */
public static boolean canViewFile(AbstractFile file){
  return false;
}
Program: 44990
Project: 44990
Buggy source:
/** 
 * Returns the frame which contains this viewer, may return <code>null</code> if the viewer is not inside a ViewerFrame.
 */
protected ViewerFrame getFrame(){
  return frame;
}

Fixed version (ground truth):
/** 
 * Returns the frame which contains this viewer. <p> This method may return <code>null</code>if the viewer is not inside a ViewerFrame. </p>
 * @return the frame which contains this viewer.
 * @see #setFrame(ViewerFrame)
 */
protected ViewerFrame getFrame(){
  return frame;
}
Program: 44991
Project: 44991
Buggy source:
/** 
 * Returns maximum file size this FileViewer can handle for sure, -1 if there is no such limit. If a user wish to view a file that exceeds this size, he/she will be asked if he/she still wants to view it.
 */
public long getMaxRecommendedSize(){
  return -1;
}

Fixed version (ground truth):
/** 
 * Returns maximum file size this FileViewer can handle for sure. <p> If there is no maximum limit, returns <code>-1</code>. </p> <p> If a user wish to view a file that exceeds this size, he/she will be asked if he/she still wants to view it. </p>
 * @return the maximum file size this file viewer can handle.
 */
public long getMaxRecommendedSize(){
  return -1;
}