// Path: web-io/src/main/java/org/jbehave/web/io/ZipFileArchiver.java
// @SuppressWarnings("serial")
// public static final class FileUnarchiveFailedException extends
// 		RuntimeException {
// 
// 	public FileUnarchiveFailedException(File archive, File directory,
// 			Exception cause) {
// 		super("Failed to unarchive " + archive + " to dir " + directory,
// 				cause);
// 	}
// 
// }


import static java.util.Arrays.asList;
import static org.apache.commons.lang3.StringUtils.isBlank;
import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.io.FilenameUtils;
import org.jbehave.web.io.ZipFileArchiver.FileUnarchiveFailedException;
    }

    public List<File> upload(List<FileItem> fileItems, List<String> errors) {
        List<File> files = new ArrayList<File>();
        File directory = uploadDirectory();
        for (FileItem item : fileItems) {
            try {
                File file = writeItemToFile(directory, item);
                monitor.fileUploaded(file);
                files.add(file);                
            } catch (FileItemNameMissingException e) {
                // ignore and carry on
            } catch (FileWriteFailedException e) {
                errors.add(e.getMessage());
                if (e.getCause() != null) {
                    errors.add(e.getCause().getMessage());
                }
                monitor.fileUploadFailed(item, e);
            }
        }
        return files;
    }

    public void unarchiveFiles(List<File> files, List<String> errors) {
        File directory = uploadDirectory();
        for (File file : files) {
            if (archiver.isArchive(file)) {
                try {
                    archiver.unarchive(file, directory);
                    monitor.fileUnarchived(file, directory);
// Path: web-io/src/main/java/org/jbehave/web/io/ZipFileArchiver.java
// @SuppressWarnings("serial")
// public static final class FileUnarchiveFailedException extends
// 		RuntimeException {
// 
// 	public FileUnarchiveFailedException(File archive, File directory,
// 			Exception cause) {
// 		super("Failed to unarchive " + archive + " to dir " + directory,
// 				cause);
// 	}
// 
// }


// Path: web-io/src/main/java/org/jbehave/web/io/ArchivingFileManager.java
import static java.util.Arrays.asList;
import static org.apache.commons.lang3.StringUtils.isBlank;
import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.io.FilenameUtils;
import org.jbehave.web.io.ZipFileArchiver.FileUnarchiveFailedException;

    }

    public List<File> upload(List<FileItem> fileItems, List<String> errors) {
        List<File> files = new ArrayList<File>();
        File directory = uploadDirectory();
        for (FileItem item : fileItems) {
            try {
                File file = writeItemToFile(directory, item);
                monitor.fileUploaded(file);
                files.add(file);                
            } catch (FileItemNameMissingException e) {
                // ignore and carry on
            } catch (FileWriteFailedException e) {
                errors.add(e.getMessage());
                if (e.getCause() != null) {
                    errors.add(e.getCause().getMessage());
                }
                monitor.fileUploadFailed(item, e);
            }
        }
        return files;
    }

    public void unarchiveFiles(List<File> files, List<String> errors) {
        File directory = uploadDirectory();
        for (File file : files) {
            if (archiver.isArchive(file)) {
                try {
                    archiver.unarchive(file, directory);
                    monitor.fileUnarchived(file, directory);
                } catch (FileUnarchiveFailedException e) {