dependency-check-core/src/main/java/org/owasp/dependencycheck/data/nvdcve/CveDB.java
/**
     * Checks to see if data exists so that analysis can be performed.
     *
     * @return <code>true</code> if data exists; otherwise <code>false</code>
     */
Checks to see if data exists so that analysis can be performed.
@return true if data exists; otherwise false
Checks to see if data exists so that analysis can be performed . @return true if data exists ; otherwise false
public synchronized boolean dataExists() {
        ResultSet rs = null;
        try {
            final PreparedStatement cs = getPreparedStatement(COUNT_CPE);
            rs = cs.executeQuery();
            if (rs.next() && rs.getInt(1) > 0) {
                return true;
            }
        } catch (Exception ex) {
            String dd;
            try {
                dd = Settings.getDataDirectory().getAbsolutePath();
            } catch (IOException ex1) {
                dd = Settings.getString(Settings.KEYS.DATA_DIRECTORY);
            }
            LOGGER.error("Unable to access the local database.\n\nEnsure that '{}' is a writable directory. "
                    + "If the problem persist try deleting the files in '{}' and running {} again. If the problem continues, please "
                    + "create a log file (see documentation at http://jeremylong.github.io/DependencyCheck/) and open a ticket at "
                    + "https://github.com/jeremylong/DependencyCheck/issues and include the log file.\n\n",
                    dd, dd, Settings.getString(Settings.KEYS.APPLICATION_NAME));
            LOGGER.debug("", ex);
        } finally {
            DBUtils.closeResultSet(rs);
        }
        return false;
    }
public synchronized boolean dataExists ( ) { ResultSet rs = null ; try { final PreparedStatement cs = getPreparedStatement ( COUNT_CPE ) ; rs = cs . executeQuery ( ) ; if ( rs . next ( ) && rs . getInt ( 1 ) > 0 ) { return true ; } } catch ( Exception ex ) { String dd ; try { dd = Settings . getDataDirectory ( ) . getAbsolutePath ( ) ; } catch ( IOException ex1 ) { dd = Settings . getString ( Settings . KEYS . DATA_DIRECTORY ) ; } LOGGER . error ( "Unable to access the local database.\n\nEnsure that '{}' is a writable directory. " + "If the problem persist try deleting the files in '{}' and running {} again. If the problem continues, please " + "create a log file (see documentation at http://jeremylong.github.io/DependencyCheck/) and open a ticket at " + "https://github.com/jeremylong/DependencyCheck/issues and include the log file.\n\n" , dd , dd , Settings . getString ( Settings . KEYS . APPLICATION_NAME ) ) ; LOGGER . debug ( "" , ex ) ; } finally { DBUtils . closeResultSet ( rs ) ; } return false ; }
Checks to see if data exists so that analysis can be performed.
Checks to see if data exists so that analysis can be performed .