private void storeFailed(final File failedDirectory, final File sourceFile) { try { IOUtil.copyFile(sourceFile, failedDirectory); } catch (final IOException e) { System.err.println( "Failed to copy file to failed directory: " + sourceFile + ", err: " + e.getMessage()); } }
private void copyToFailed(final File failedDirectory, final File refFile, final String suffix) { File source = new File(failedDirectory, refFile.getName() + suffix); if (!source.exists()) { source = new File(refFile.getAbsoluteFile().getParentFile(), refFile.getName() + suffix); try { IOUtil.copyFile(source, failedDirectory); } catch (final IOException e) { System.err.println( "Failed to copy file (reference) " + source + " to failed directory, err " + e.getMessage()); } } }
public void compareDirectory( final File sourceDirectory, final File referenceDir, final File failedDirectory) throws IOException { checkDirectories(sourceDirectory, referenceDir, failedDirectory); log("Starting comparison using width " + width); IOUtil.deleteAllFiles(failedDirectory); final boolean wasEnabled = enableLogging(false); try { final Iterator<File> fileIt = listSourceFiles(sourceDirectory); final CompareStatistics stats = new CompareStatistics(); while (fileIt.hasNext()) { final File file = (File) fileIt.next(); try { compareFile(file, referenceDir, failedDirectory, stats); } catch (final IOException e) { stats.failedIOException(e); } } stats.report(); } finally { enableLogging(wasEnabled); } }