Example usage for org.apache.commons.io.filefilter TrueFileFilter INSTANCE

List of usage examples for org.apache.commons.io.filefilter TrueFileFilter INSTANCE

Introduction

In this page you can find the example usage for org.apache.commons.io.filefilter TrueFileFilter INSTANCE.

Prototype

IOFileFilter INSTANCE

To view the source code for org.apache.commons.io.filefilter TrueFileFilter INSTANCE.

Click Source Link

Document

Singleton instance of true filter.

Usage

From source file:org.pooledtimeseries.PoT.java

public static void main(String[] args) {
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
    Option fileOpt = OptionBuilder.withArgName("file").hasArg().withLongOpt("file")
            .withDescription("Path to a single file").create('f');

    Option dirOpt = OptionBuilder.withArgName("directory").hasArg().withLongOpt("dir")
            .withDescription("A directory with image files in it").create('d');

    Option helpOpt = OptionBuilder.withLongOpt("help").withDescription("Print this message.").create('h');

    Option pathFileOpt = OptionBuilder.withArgName("path file").hasArg().withLongOpt("pathfile")
            .withDescription(/*from   w ww  .  j  a v a  2s .c o m*/
                    "A file containing full absolute paths to videos. Previous default was memex-index_temp.txt")
            .create('p');

    Option outputFileOpt = OptionBuilder.withArgName("output file").withLongOpt("outputfile").hasArg()
            .withDescription("File containing similarity results. Defaults to ./similarity.txt").create('o');

    Option jsonOutputFlag = OptionBuilder.withArgName("json output").withLongOpt("json")
            .withDescription("Set similarity output format to JSON. Defaults to .txt").create('j');

    Option similarityFromFeatureVectorsOpt = OptionBuilder
            .withArgName("similarity from FeatureVectors directory")
            .withLongOpt("similarityFromFeatureVectorsDirectory").hasArg()
            .withDescription("calculate similarity matrix from given directory of feature vectors").create('s');

    Options options = new Options();
    options.addOption(dirOpt);
    options.addOption(pathFileOpt);
    options.addOption(fileOpt);
    options.addOption(helpOpt);
    options.addOption(outputFileOpt);
    options.addOption(jsonOutputFlag);
    options.addOption(similarityFromFeatureVectorsOpt);

    // create the parser
    CommandLineParser parser = new GnuParser();

    try {
        // parse the command line arguments
        CommandLine line = parser.parse(options, args);
        String directoryPath = null;
        String pathFile = null;
        String singleFilePath = null;
        String similarityFromFeatureVectorsDirectory = null;
        ArrayList<Path> videoFiles = null;

        if (line.hasOption("dir")) {
            directoryPath = line.getOptionValue("dir");
        }

        if (line.hasOption("pathfile")) {
            pathFile = line.getOptionValue("pathfile");
        }

        if (line.hasOption("file")) {
            singleFilePath = line.getOptionValue("file");
        }

        if (line.hasOption("outputfile")) {
            outputFile = line.getOptionValue("outputfile");
        }

        if (line.hasOption("json")) {
            outputFormat = OUTPUT_FORMATS.JSON;
        }

        if (line.hasOption("similarityFromFeatureVectorsDirectory")) {
            similarityFromFeatureVectorsDirectory = line
                    .getOptionValue("similarityFromFeatureVectorsDirectory");
        }

        if (line.hasOption("help")
                || (line.getOptions() == null || (line.getOptions() != null && line.getOptions().length == 0))
                || (directoryPath != null && pathFile != null && !directoryPath.equals("")
                        && !pathFile.equals(""))) {
            HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp("pooled_time_series", options);
            System.exit(1);
        }

        if (directoryPath != null) {
            File dir = new File(directoryPath);
            List<File> files = (List<File>) FileUtils.listFiles(dir, TrueFileFilter.INSTANCE,
                    TrueFileFilter.INSTANCE);
            videoFiles = new ArrayList<Path>(files.size());

            for (File file : files) {
                String filePath = file.toString();

                // When given a directory to load videos from we need to ensure that we
                // don't try to load the of.txt and hog.txt intermediate result files
                // that results from previous processing runs.
                if (!filePath.contains(".txt")) {
                    videoFiles.add(file.toPath());
                }
            }

            LOG.info("Added " + videoFiles.size() + " video files from " + directoryPath);

        }

        if (pathFile != null) {
            Path list_file = Paths.get(pathFile);
            videoFiles = loadFiles(list_file);
            LOG.info("Loaded " + videoFiles.size() + " video files from " + pathFile);
        }

        if (singleFilePath != null) {
            Path singleFile = Paths.get(singleFilePath);
            LOG.info("Loaded file: " + singleFile);
            videoFiles = new ArrayList<Path>(1);
            videoFiles.add(singleFile);
        }

        if (similarityFromFeatureVectorsDirectory != null) {
            File dir = new File(similarityFromFeatureVectorsDirectory);
            List<File> files = (List<File>) FileUtils.listFiles(dir, TrueFileFilter.INSTANCE,
                    TrueFileFilter.INSTANCE);
            videoFiles = new ArrayList<Path>(files.size());

            for (File file : files) {
                String filePath = file.toString();

                // We need to load only the *.of.txt and *.hog.txt values
                if (filePath.endsWith(".of.txt")) {
                    videoFiles.add(file.toPath());
                }

                if (filePath.endsWith(".hog.txt")) {
                    videoFiles.add(file.toPath());
                }
            }

            LOG.info("Added " + videoFiles.size() + " feature vectors from "
                    + similarityFromFeatureVectorsDirectory);
            evaluateSimilarity(videoFiles, 1);
        } else {
            evaluateSimilarity(videoFiles, 0);
        }
        LOG.info("done.");

    } catch (ParseException exp) {
        // oops, something went wrong
        System.err.println("Parsing failed.  Reason: " + exp.getMessage());
    }

}

From source file:org.silverpeas.admin.component.process.check.ComponentFileFilterProcessCheck.java

@Override
public void checkFiles(final ProcessExecutionContext processExecutionProcess, final FileHandler fileHandler)
        throws Exception {

    // Treatment on write only
    if (IOAccess.READ_WRITE.equals(fileHandler.getIoAccess())) {

        // Loading all ComponentInst detected
        final Set<String> componentInstanceIds = indentifyComponentInstances(processExecutionProcess,
                fileHandler);//from   w  ww.  ja va  2  s.  c o m

        // Checking authorized and forbidden files on each component detected
        for (final String componentInstanceId : componentInstanceIds) {

            final ComponentInst component = organizationController.getComponentInst(componentInstanceId);

            // Component file filter that contains authorized and forbidden rules
            final ComponentFileFilterParameter componentFileFilter = ComponentFileFilterParameter
                    .from(component);

            // Checking all files included in session
            for (File sessionDirectory : fileHandler.listAllSessionHandledRootPathFiles()) {
                for (File sessionFile : FileUtils.listFiles(sessionDirectory, TrueFileFilter.INSTANCE,
                        TrueFileFilter.INSTANCE)) {

                    // Verifying current file if it is authorized
                    if (sessionFile.getPath().contains(component.getId())) {
                        componentFileFilter.verifyFileAuthorized(sessionFile);
                    }
                }
            }

            // Checking dummy handled files
            for (DummyHandledFile dummyHandledFile : fileHandler.getDummyHandledFiles(componentInstanceId)) {
                if (!dummyHandledFile.isDeleted()
                        && !componentFileFilter.isMimeTypeAuthorized(dummyHandledFile.getMimeType())) {
                    ComponentFileFilterException exception = new ComponentFileFilterException(
                            componentFileFilter, dummyHandledFile.getName());
                    NotifierUtil.addSevere(SilverpeasTransverseErrorUtil.performExceptionMessage(exception,
                            MessageManager.getLanguage()));
                    throw exception;
                }
            }
        }
    }
}

From source file:org.silverpeas.core.admin.component.process.check.ComponentFileFilterProcessCheck.java

private void checkFilesInSession(final SilverpeasComponentInstance component,
        final ComponentFileFilterParameter componentFileFilter, final Collection<File> filesInSession) {
    for (File sessionDirectory : filesInSession) {
        for (File sessionFile : FileUtils.listFiles(sessionDirectory, TrueFileFilter.INSTANCE,
                TrueFileFilter.INSTANCE)) {

            // Verifying current file if it is authorized
            if (sessionFile.getPath().contains(component.getId())) {
                componentFileFilter.verifyFileAuthorized(sessionFile);
            }//from ww  w . j  a  v  a2s .  c o  m
        }
    }
}

From source file:org.silverpeas.core.process.io.file.TestFileHandler.java

@Test
public void testListFilesFromSessionAndRealPathWithFilters() throws Exception {
    buildCommonPathStructure();/*www .j  ava 2s  . co  m*/
    Collection<File> files = fileHandler.listFiles(BASE_PATH_TEST, realRootPath, TrueFileFilter.INSTANCE,
            TrueFileFilter.INSTANCE);
    assertThat(files.size(), is(13));
    assertThat(listFiles(sessionHandledPath, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE).size(), is(7));
    assertThat(listFiles(realRootPath, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE).size(), is(14));

    // Non recursive
    files = fileHandler.listFiles(BASE_PATH_TEST, realRootPath, TrueFileFilter.INSTANCE,
            FalseFileFilter.INSTANCE);
    assertThat(files.size(), is(3));
    assertThat(listFiles(sessionHandledPath, TrueFileFilter.INSTANCE, FalseFileFilter.INSTANCE).size(), is(2));
    assertThat(listFiles(realRootPath, TrueFileFilter.INSTANCE, FalseFileFilter.INSTANCE).size(), is(2));

    // Extension
    files = fileHandler.listFiles(BASE_PATH_TEST, realRootPath,
            new SuffixFileFilter(new String[] { ".test", ".xml", ".txt" }), TrueFileFilter.INSTANCE);
    assertThat(files.size(), is(3));
    assertThat(listFiles(sessionHandledPath, new SuffixFileFilter(new String[] { "test", ".xml", "txt" }),
            TrueFileFilter.INSTANCE).size(), is(1));
    assertThat(listFiles(realRootPath, new SuffixFileFilter(new String[] { "test", "xml", "txt" }),
            TrueFileFilter.INSTANCE).size(), is(3));
}

From source file:org.silverpeas.core.process.io.file.TestHandledFile.java

@Test
public void testListFilesWithFilters() throws Exception {
    buildCommonPathStructure();//from   www  .j  av  a2  s .c o m
    final HandledFile test = getHandledFile(realRootPath);
    Collection<HandledFile> files = test.listFiles(TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
    assertThat(files.size(), is(13));
    assertThat(listFiles(sessionHandledPath, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE).size(), is(7));
    assertThat(listFiles(realRootPath, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE).size(), is(14));

    // Non recursive
    files = test.listFiles(TrueFileFilter.INSTANCE, FalseFileFilter.INSTANCE);
    assertThat(files.size(), is(3));
    assertThat(listFiles(sessionHandledPath, TrueFileFilter.INSTANCE, FalseFileFilter.INSTANCE).size(), is(2));
    assertThat(listFiles(realRootPath, TrueFileFilter.INSTANCE, FalseFileFilter.INSTANCE).size(), is(2));

    // Extension
    files = test.listFiles(new SuffixFileFilter(new String[] { ".test", ".xml", ".txt" }),
            TrueFileFilter.INSTANCE);
    assertThat(files.size(), is(3));
    assertThat(listFiles(sessionHandledPath, new SuffixFileFilter(new String[] { "test", ".xml", "txt" }),
            TrueFileFilter.INSTANCE).size(), is(1));
    assertThat(listFiles(realRootPath, new SuffixFileFilter(new String[] { "test", "xml", "txt" }),
            TrueFileFilter.INSTANCE).size(), is(3));
}

From source file:org.sonar.plugins.python.DirectoryScanner.java

public List<File> getIncludedFiles() {
    final String baseDirAbsolutePath = baseDir.getAbsolutePath();
    IOFileFilter fileFilter = new IOFileFilter() {

        @Override//w  ww .  j  av  a2 s  .  c  o m
        public boolean accept(File dir, String name) {
            return accept(new File(dir, name));
        }

        @Override
        public boolean accept(File file) {
            String path = file.getAbsolutePath();
            path = path.substring(Math.min(baseDirAbsolutePath.length(), path.length()));
            return pattern.match(FilenameUtils.separatorsToUnix(path));
        }
    };
    return Lists.newArrayList(FileUtils.listFiles(baseDir, fileFilter, TrueFileFilter.INSTANCE));
}

From source file:org.sonatype.flexmojos.compiler.AbstractCompilerMojo.java

@SuppressWarnings("unchecked")
private boolean isCompilationRequired() throws MojoExecutionException {
    if (!quick) {
        // not running at quick mode
        return true;
    }//from  w  w  w  .  j av  a2  s  .com

    Artifact artifact = artifactFactory.createArtifact(project.getGroupId(), project.getArtifactId(),
            project.getVersion(), null, project.getPackaging());
    try {
        resolver.resolve(artifact, remoteRepositories, localRepository);
    } catch (AbstractArtifactResolutionException e) {
        // Not available at repository
        return true;
    }

    File artifactFile = artifact.getFile();
    if (artifactFile == null || !artifactFile.exists()) {
        // Recompile, file doesn't exists
        getLog().warn("Can't find any older instaled version.");
        return true;
    }
    try {
        FileUtils.copyFile(artifactFile, getOutput());
    } catch (IOException e) {
        throw new MojoExecutionException("Unable to copy instaled version to target folder.", e);
    }
    long lastCompiledArtifact = artifactFile.lastModified();

    Set<Artifact> dependencies = getDependencyArtifacts();
    for (Artifact dependency : dependencies) {
        if (FileUtils.isFileNewer(dependency.getFile(), lastCompiledArtifact)) {
            // a dependency is newer, recompile
            getLog().warn("Found a updated dependency: " + dependency);
            return true;
        }
    }

    List<File> paths = new ArrayList<File>(Arrays.asList(sourcePaths));
    paths.remove(new File(resourceBundlePath));

    addLocalesPath(paths, compiledLocales);
    addLocalesPath(paths, runtimeLocales);

    for (File sourcePath : paths) {
        Collection<File> files = FileUtils.listFiles(sourcePath, new AgeFileFilter(lastCompiledArtifact, false),
                TrueFileFilter.INSTANCE);

        // If has any newer file
        if (files.size() > 0) {
            getLog().warn("Found some updated files.");
            return true;
        }
    }

    // nothing new was found.
    return false;
}

From source file:org.sonatype.flexmojos.plugin.compiler.AbstractFlexCompilerMojo.java

@SuppressWarnings("unchecked")
public boolean isCompilationRequired() {
    if (!quick) {
        // not running at quick mode
        return true;
    }/*from   w w w  .jav  a2  s  .c  om*/

    Artifact artifact;
    try {
        artifact = resolve(project.getGroupId(), project.getArtifactId(), project.getVersion(), getClassifier(),
                project.getPackaging());
    } catch (RuntimeMavenResolutionException e) {
        artifact = e.getArtifact();
    }

    if (!artifact.isResolved() || artifact.getFile() == null || !artifact.getFile().exists()) {
        // Recompile, file doesn't exists
        getLog().warn("Can't find any older installed version.");
        return true;
    }

    long lastCompiledArtifact = artifact.getFile().lastModified();

    boolean required = false;
    Set<Artifact> dependencies = getDependencies();
    for (Artifact dependency : dependencies) {
        if (org.apache.commons.io.FileUtils.isFileNewer(dependency.getFile(), lastCompiledArtifact)) {
            // a dependency is newer, recompile
            getLog().warn("Found a updated dependency: " + dependency);
            required = true;
        }
    }

    if (!required) {
        Collection<File> files = org.apache.commons.io.FileUtils.listFiles(
                new File(project.getBuild().getSourceDirectory()),
                new AgeFileFilter(lastCompiledArtifact, false), TrueFileFilter.INSTANCE);

        // If has any newer file
        if (files.size() > 0) {
            getLog().warn("Found some updated files.");
            required = true;
        }
    }

    if (!required) {
        try {
            final File output = new File(getOutput());

            FileUtils.copyFile(artifact.getFile(), output);

            if (!output.setLastModified(artifact.getFile().lastModified())) {
                getLog().warn("Could not set modified on copied artifact. Unnecessary rebuilds will occur.");
            }
        } catch (IOException e) {
            getLog().error("Unable to copy installed version to target folder.", e);
            return true;
        }
    }

    // nothing new was found.
    return required;
}

From source file:org.sonatype.flexmojos.tests.AbstractFlexMojosTests.java

@SuppressWarnings("unchecked")
protected static File getProject(String projectName, String... filesToInterpolate) throws IOException {
    if (filesToInterpolate == null || filesToInterpolate.length == 0) {
        filesToInterpolate = new String[] { "pom.xml" };
    }//from   w ww .  ja  v  a2  s  .c  o  m

    copyProjectLock.writeLock().lock();
    try {
        File projectFolder = new File(projectsSource, projectName);
        AssertJUnit.assertTrue(
                "Project " + projectName + " folder not found.\n" + projectFolder.getAbsolutePath(),
                projectFolder.isDirectory());

        File destDir = new File(projectsWorkdir, projectName + "_" + getTestName());

        FileUtils.copyDirectory(projectFolder, destDir, HiddenFileFilter.VISIBLE);

        // projects filtering
        Collection<File> poms = FileUtils.listFiles(destDir, new WildcardFileFilter(filesToInterpolate),
                TrueFileFilter.INSTANCE);
        for (File pom : poms) {
            String pomContent = FileUtils.readFileToString(pom);
            pomContent = pomContent.replace("%{flexmojos.version}", getFlexmojosVersion());
            pomContent = pomContent.replace("%{flex.version}", getFlexSDKVersion());
            FileUtils.writeStringToFile(pom, pomContent);
        }

        return destDir;
    } finally {
        copyProjectLock.writeLock().unlock();
    }
}

From source file:org.tellervo.desktop.bulkdataentry.command.PopulateFromODKCommand.java

public void execute(MVCEvent argEvent) {

    try {//  w  w w . j a v a 2 s.co m
        MVC.splitOff(); // so other mvc events can execute
    } catch (IllegalThreadException e) {
        // this means that the thread that called splitOff() was not an MVC thread, and the next event's won't be blocked anyways.
        e.printStackTrace();
    } catch (IncorrectThreadException e) {
        // this means that this MVC thread is not the main thread, it was already splitOff() previously
        e.printStackTrace();
    }

    PopulateFromODKFileEvent event = (PopulateFromODKFileEvent) argEvent;
    ArrayList<ODKParser> filesProcessed = new ArrayList<ODKParser>();
    ArrayList<ODKParser> filesFailed = new ArrayList<ODKParser>();
    Path instanceFolder = null;

    // Launch the ODK wizard to collect parameters from user
    ODKImportWizard wizard = new ODKImportWizard(BulkImportModel.getInstance().getMainView());

    if (wizard.wasCancelled())
        return;

    if (wizard.isRemoteAccessSelected()) {
        // Doing remote server download of ODK files
        try {

            // Request a zip file of ODK files from the server ensuring the temp file is deleted on exit
            URI uri;
            uri = new URI(
                    App.prefs.getPref(PrefKey.WEBSERVICE_URL, "invalid url!") + "/" + "odk/fetchInstances.php");
            String file = getRemoteODKFiles(uri);

            if (file == null) {
                // Download was cancelled
                return;
            }

            new File(file).deleteOnExit();

            // Unzip to a temporary folder, again ensuring it is deleted on exit 
            instanceFolder = Files.createTempDirectory("odk-unzip");
            instanceFolder.toFile().deleteOnExit();

            log.debug("Attempting to open zip file: '" + file + "'");

            ZipFile zipFile = new ZipFile(file);
            try {
                Enumeration<? extends ZipEntry> entries = zipFile.entries();
                while (entries.hasMoreElements()) {
                    ZipEntry entry = entries.nextElement();
                    File entryDestination = new File(instanceFolder.toFile(), entry.getName());
                    entryDestination.deleteOnExit();
                    if (entry.isDirectory()) {
                        entryDestination.mkdirs();
                    } else {
                        entryDestination.getParentFile().mkdirs();
                        InputStream in = zipFile.getInputStream(entry);
                        OutputStream out = new FileOutputStream(entryDestination);
                        IOUtils.copy(in, out);
                        IOUtils.closeQuietly(in);
                        out.close();
                    }
                }
            } finally {
                zipFile.close();
            }
        } catch (URISyntaxException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } else {
        // Accessing ODK files from local folder
        instanceFolder = new File(wizard.getODKInstancesFolder()).toPath();
    }

    // Check the instance folder specified exists
    File folder = instanceFolder.toFile();
    if (!folder.exists()) {

        log.error("Instances folder does not exist");
        return;
    }

    // Compile a hash set of all media files in the instance folder and subfolders
    File file = null;
    File[] mediaFileArr = null;
    if (wizard.isIncludeMediaFilesSelected()) {
        HashSet<File> mediaFiles = new HashSet<File>();

        // Array of file extensions to consider as media files
        String[] mediaExtensions = { "jpg", "mpg", "snd", "mp4", "m4a" };
        for (String ext : mediaExtensions) {
            SuffixFileFilter filter = new SuffixFileFilter("." + ext);
            Iterator<File> it = FileUtils.iterateFiles(folder, filter, TrueFileFilter.INSTANCE);
            while (it.hasNext()) {
                file = it.next();
                mediaFiles.add(file);
            }
        }

        // Copy files to consolidate to a new folder 
        mediaFileArr = mediaFiles.toArray(new File[mediaFiles.size()]);
        String copyToFolder = wizard.getCopyToLocation();
        for (int i = 0; i < mediaFileArr.length; i++) {
            file = mediaFileArr[i];

            File target = new File(copyToFolder + file.getName());
            try {
                FileUtils.copyFile(file, target, true);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            mediaFileArr[i] = target;
        }
    }

    SampleModel smodel = event.sampleModel;
    ElementModel emodel = event.elementModel;
    ObjectModel model = event.objectModel;

    try {
        if (smodel.getTableModel().getRowCount() == 1 && smodel.getTableModel().getAllSingleRowModels().get(0)
                .getProperty(SingleSampleModel.TITLE) == null) {
            // Empty table first
            smodel.getTableModel().getAllSingleRowModels().clear();
        }
    } catch (Exception ex) {
        log.debug("Error deleting empty rows");
    }

    try {
        if (emodel.getTableModel().getRowCount() == 1 && emodel.getTableModel().getAllSingleRowModels().get(0)
                .getProperty(SingleElementModel.TITLE) == null) {
            // Empty table first
            emodel.getTableModel().getAllSingleRowModels().clear();
        }
    } catch (Exception ex) {
        log.debug("Error deleting empty rows");
    }

    try {
        if (model.getTableModel().getRowCount() == 1 && model.getTableModel().getAllSingleRowModels().get(0)
                .getProperty(SingleObjectModel.OBJECT_CODE) == null) {
            // Empty table first
            model.getTableModel().getAllSingleRowModels().clear();
        }
    } catch (Exception ex) {
        log.debug("Error deleting empty rows");
    }

    SuffixFileFilter fileFilter = new SuffixFileFilter(".xml");
    Iterator<File> iterator = FileUtils.iterateFiles(folder, fileFilter, TrueFileFilter.INSTANCE);
    while (iterator.hasNext()) {
        file = iterator.next();
        filesFound++;

        try {

            ODKParser parser = new ODKParser(file);
            filesProcessed.add(parser);

            if (!parser.isValidODKFile()) {
                filesFailed.add(parser);
                continue;
            } else if (parser.getFileType() == null) {
                filesFailed.add(parser);
                continue;
            } else if (parser.getFileType() == ODKFileType.OBJECTS) {
                addObjectToTableFromParser(parser, model, wizard, mediaFileArr);
            } else if (parser.getFileType() == ODKFileType.ELEMENTS_AND_SAMPLES) {
                addElementFromParser(parser, emodel, wizard, mediaFileArr);
                addSampleFromParser(parser, smodel, wizard, mediaFileArr);
            } else {
                filesFailed.add(parser);
                continue;
            }

        } catch (FileNotFoundException e) {
            otherErrors += "<p color=\"red\">Error loading file:</p>\n"
                    + ODKParser.formatFileNameForReport(file);
            otherErrors += "<br/>  - File not found<br/><br/>";
        } catch (IOException e) {
            otherErrors += "<p color=\"red\">Error loading file:</p>\n"
                    + ODKParser.formatFileNameForReport(file);
            otherErrors += "<br/>  - IOException - " + e.getLocalizedMessage() + "<br/><br/>";
        } catch (Exception e) {
            otherErrors += "<p color=\"red\">Error parsing file:</p>\n"
                    + ODKParser.formatFileNameForReport(file);
            otherErrors += "<br/>  - Exception - " + e.getLocalizedMessage() + "<br/><br/>";
        }

    }

    // Create a CSV file of metadata if the user requested it
    if (wizard.isCreateCSVFileSelected()) {
        try {
            createCSVFile(filesProcessed, wizard.getCSVFilename());
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    // Compile logs to display to user
    StringBuilder log = new StringBuilder();
    log.append("<html>\n");
    for (ODKParser parser : filesFailed) {
        log.append("<p color=\"red\">Error loading file:</p>\n"
                + ODKParser.formatFileNameForReport(parser.getFile()));
        log.append("<br/>  - " + parser.getParseErrorMessage() + "<br/><br/>");
    }
    for (ODKParser parser : filesProcessed) {
        if (filesFailed.contains(parser))
            continue;
        if (parser.getParseErrorMessage() == "")
            continue;

        log.append("<p color=\"orange\">Warning loading file:</p>\n"
                + ODKParser.formatFileNameForReport(parser.getFile()));
        log.append("<br/>  - " + parser.getParseErrorMessage() + "<br/><br/>");
    }
    log.append(otherErrors);
    log.append("</html>");
    ODKParserLogViewer logDialog = new ODKParserLogViewer(BulkImportModel.getInstance().getMainView());
    logDialog.setLog(log.toString());
    logDialog.setFileCount(filesFound, filesLoadedSuccessfully);

    // Display log if there were any errors or if no files were found
    if (filesFound > filesLoadedSuccessfully) {
        logDialog.setVisible(true);
    } else if (filesFound == 0 && wizard.isRemoteAccessSelected()) {
        Alert.error(BulkImportModel.getInstance().getMainView(), "Not found",
                "No ODK data files were found on the server.  Please ensure you've used the 'send finalized form' option in ODK Collect and try again");
        return;
    } else if (filesFound == 0) {
        Alert.error(BulkImportModel.getInstance().getMainView(), "Not found",
                "No ODK data files were found in the specified folder.  Please check and try again.");
        return;
    } else if (wizard.isIncludeMediaFilesSelected()) {
        Alert.message(BulkImportModel.getInstance().getMainView(), "Download Complete",
                "The ODK download is complete.  As requested, your media files have been temporarily copied to the local folder '"
                        + wizard.getCopyToLocation()
                        + "'.  Please remember to move them to their final location");
    }

}