Search in sources :

Example 1 with ExceptionCollection

use of org.owasp.dependencycheck.exception.ExceptionCollection in project dependency-check-plugin by jenkinsci.

the class DependencyCheckExecutor method call.

/**
 * Performs a DependencyCheck analysis build.
 *
 * @return a boolean value indicating if the build was successful or not. A
 * successful build is not determined by the ability to analyze
 * dependencies, rather, simply to determine if errors were encountered
 * during the execution.
 */
public Boolean call() throws IOException {
    if (getJavaVersion() <= 1.6) {
        log(Messages.Failure_Java_Version());
        return false;
    }
    log(Messages.Executor_Display_Options());
    log(options.toString());
    if (!prepareDirectories()) {
        return false;
    }
    Engine engine = null;
    try {
        engine = executeDependencyCheck();
        if (options.isUpdateOnly()) {
            return true;
        } else {
            return generateExternalReports(engine);
        }
    } catch (DatabaseException ex) {
        log(Messages.Failure_Database_Connect());
        log(ex.getMessage());
    } catch (UpdateException ex) {
        log(Messages.Failure_Database_Update());
    } catch (ExceptionCollection ec) {
        log(Messages.Failure_Collection());
        for (Throwable t : ec.getExceptions()) {
            log("Exception Caught: " + t.getClass().getCanonicalName());
            if (t.getCause() != null && t.getCause().getMessage() != null) {
                log("Cause: " + t.getCause().getMessage());
            }
            log("Message: " + t.getMessage());
            log(ExceptionUtils.getStackTrace(t));
        }
    } finally {
        settings.cleanup(true);
        if (engine != null) {
            engine.close();
        }
    }
    return false;
}
Also used : ExceptionCollection(org.owasp.dependencycheck.exception.ExceptionCollection) UpdateException(org.owasp.dependencycheck.data.update.exception.UpdateException) DatabaseException(org.owasp.dependencycheck.data.nvdcve.DatabaseException) Engine(org.owasp.dependencycheck.Engine)

Aggregations

Engine (org.owasp.dependencycheck.Engine)1 DatabaseException (org.owasp.dependencycheck.data.nvdcve.DatabaseException)1 UpdateException (org.owasp.dependencycheck.data.update.exception.UpdateException)1 ExceptionCollection (org.owasp.dependencycheck.exception.ExceptionCollection)1