Package com.denimgroup.threadfix.importer.exception

Examples of com.denimgroup.threadfix.importer.exception.ScanFileUnavailableException


        return null;
  }
 
  private InputStream getSampleFileInputStream() {
    if (inputStream == null) {
            throw new ScanFileUnavailableException("inputStream field was null. Unable to retrieve samples.js file.");
        }
   
    zipFile = unpackZipStream();
    if (zipFile == null) {
            throw new ScanFileUnavailableException("unpackZipStream() returned null. Unable to retrieve samples.js file.");
        }
   
    folderName = findFolderName(zipFile); // keep for now, unsure about this though

    return findSamplesFile(zipFile);
View Full Code Here


    // TODO refactor this class to make lookups simpler
    // probably read everything and keep in-memory map of stuff we need
    private InputStream findSamplesFile(@Nonnull ZipFile zipFile) {
        if (zipFile.entries() == null) {
            throw new ScanFileUnavailableException("No zip entries were found in the zip file.");
        }

        Enumeration<? extends ZipEntry> entries = zipFile.entries();
        while (entries.hasMoreElements()) {
            ZipEntry entry = entries.nextElement();
            if (entry.getName().endsWith("samples.js")) {
                try {
                    return zipFile.getInputStream(entry);
                } catch (IOException e) {
                    log.error("IOException thrown when reading entries from zip file.", e);
                }
            }
        }

        throw new ScanFileUnavailableException("Samples.js was not found in the zip file.");
    }
View Full Code Here

     * using this method.
     * TODO take these methods out
     */
    protected InputStream getFileFromZip(String fileName) {
        if (zipFile == null || fileName == null || fileName.trim().equals("")) {
            throw new ScanFileUnavailableException("zipFile was null or fileName died");
        }

        InputStream inputStream = null;

        ZipEntry auditFile = zipFile.getEntry(fileName);
View Full Code Here

        return inputStream;
    }

    protected ZipFile unpackZipStream() {
        if (this.inputStream == null) {
            throw new ScanFileUnavailableException("inputStream was null.");
        }

        log.debug("Attempting to unpack the zip stream.");

        long timeStamp = new Date().getTime();
View Full Code Here

    return id;
  }

    private Map<String, InputStream> getReportFiles() {
        if (zipFile.entries() == null) {
            throw new ScanFileUnavailableException("No zip entries were found in the zip file.");
        }

        Map<String, InputStream> m = new HashMap<>();
        Enumeration<? extends ZipEntry> entries = zipFile.entries();
        while (entries.hasMoreElements()) {
View Full Code Here

TOP

Related Classes of com.denimgroup.threadfix.importer.exception.ScanFileUnavailableException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.