basic-lib/src/main/java/com/streamsets/pipeline/lib/dirspooler/LocalFileSystem.java
public int compare(WrappedFile path1, WrappedFile path2, boolean useLastModified) {
    // why not just check if the file exists? Well, there is a possibility file gets moved/archived/deleted right after
    // that check. In that case we will still fail. So fail, and recover.
    try {
      if (useLastModified && !exists(path2)) {
        return 1;
      }
      return getComparator(useLastModified).compare(path1, path2);
    } catch (RuntimeException ex) {
      Throwable cause = ex.getCause();
      // Happens only in timestamp ordering.
      // Very unlikely this will happen, new file has to be added to the queue at the exact time when
      // the currentFile was consumed and archived while a new file has not yet been picked up for processing.
      // Ignore - we just add the new file, since this means this file is indeed newer
      // (else this would have been consumed and archived first)
      if (cause != null && cause instanceof NoSuchFileException) {
        LOG.debug("Starting file may have already been archived.", cause);
        return 1;
      }

      LOG.warn("Error while comparing files", ex);
      throw ex;
    }
  }
public int compare(WrappedFile path1, WrappedFile path2, boolean useLastModified) {
    // why not just check if the file exists? Well, there is a possibility file gets moved/archived/deleted right after
    // that check. In that case we will still fail. So fail, and recover.
    try {
      if (useLastModified && !exists(path2)) {
        return 1;
      }
      return getComparator(useLastModified).compare(path1, path2);
    } catch (RuntimeException ex) {
      Throwable cause = ex.getCause();
      // Happens only in timestamp ordering.
      // Very unlikely this will happen, new file has to be added to the queue at the exact time when
      // the currentFile was consumed and archived while a new file has not yet been picked up for processing.
      // Ignore - we just add the new file, since this means this file is indeed newer
      // (else this would have been consumed and archived first)
      if (cause != null && cause instanceof NoSuchFileException) {
        LOG.debug("Starting file may have already been archived.", cause);
        return 1;
      }

      LOG.warn("Error while comparing files", ex);
      throw ex;
    }
  }
public int compare ( WrappedFile path1 , WrappedFile path2 , boolean useLastModified ) { // why not just check if the file exists? Well, there is a possibility file gets moved/archived/deleted right after // that check. In that case we will still fail. So fail, and recover. try { if ( useLastModified && ! exists ( path2 ) ) { return 1 ; } return getComparator ( useLastModified ) . compare ( path1 , path2 ) ; } catch ( RuntimeException ex ) { Throwable cause = ex . getCause ( ) ; // Happens only in timestamp ordering. // Very unlikely this will happen, new file has to be added to the queue at the exact time when // the currentFile was consumed and archived while a new file has not yet been picked up for processing. // Ignore - we just add the new file, since this means this file is indeed newer // (else this would have been consumed and archived first) if ( cause != null && cause instanceof NoSuchFileException ) { LOG . debug ( "Starting file may have already been archived." , cause ) ; return 1 ; } LOG . warn ( "Error while comparing files" , ex ) ; throw ex ; } }
This method is a simple wrapper that lets us find the NoSuchFileException if that was the cause.
This method is a simple wrapper that lets us find the NoSuchFileException if that was the cause .