dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.java
/**
     * Extracts a file from an archive.
     *
     * @param input the archives input stream
     * @param file the file to extract
     * @throws AnalysisException thrown if there is an error
     */
Extracts a file from an archive.
@param input the archives input stream
@param file the file to extract
@throws AnalysisException thrown if there is an error
Extracts a file from an archive . @param input the archives input stream @param file the file to extract @throws AnalysisException thrown if there is an error
private static void extractAcceptedFile(ArchiveInputStream input, File file) throws AnalysisException {
        LOGGER.debug("Extracting '{}'", file.getPath());
        final File parent = file.getParentFile();
        if (!parent.isDirectory() && !parent.mkdirs()) {
            final String msg = String.format("Unable to build directory '%s'.", parent.getAbsolutePath());
            throw new AnalysisException(msg);
        }
        try (FileOutputStream fos = new FileOutputStream(file)) {
            IOUtils.copy(input, fos);
        } catch (FileNotFoundException ex) {
            LOGGER.debug("", ex);
            final String msg = String.format("Unable to find file '%s'.", file.getName());
            throw new AnalysisException(msg, ex);
        } catch (IOException ex) {
            LOGGER.debug("", ex);
            final String msg = String.format("IO Exception while parsing file '%s'.", file.getName());
            throw new AnalysisException(msg, ex);
        }
    }
private static void extractAcceptedFile ( ArchiveInputStream input , File file ) throws AnalysisException { LOGGER . debug ( "Extracting '{}'" , file . getPath ( ) ) ; final File parent = file . getParentFile ( ) ; if ( ! parent . isDirectory ( ) && ! parent . mkdirs ( ) ) { final String msg = String . format ( "Unable to build directory '%s'." , parent . getAbsolutePath ( ) ) ; throw new AnalysisException ( msg ) ; } try ( FileOutputStream fos = new FileOutputStream ( file ) ) { IOUtils . copy ( input , fos ) ; } catch ( FileNotFoundException ex ) { LOGGER . debug ( "" , ex ) ; final String msg = String . format ( "Unable to find file '%s'." , file . getName ( ) ) ; throw new AnalysisException ( msg , ex ) ; } catch ( IOException ex ) { LOGGER . debug ( "" , ex ) ; final String msg = String . format ( "IO Exception while parsing file '%s'." , file . getName ( ) ) ; throw new AnalysisException ( msg , ex ) ; } }
Extracts a file from an archive.
Extracts a file from an archive .