@Override
    public boolean isValidDataBase() {
        int version = getPoiFileInfo().version;

        // Check for table names
        // TODO Is it necessary to get the tables meta data as well?
        int numTables = 0;
        Cursor cursor = null;
        try {
            String sql = version < 2 ? DbConstants.VALID_DB_STATEMENT_V1 : DbConstants.VALID_DB_STATEMENT;
            cursor = this.db.rawQuery(sql, null);
            if (cursor.moveToNext()) {
                numTables = cursor.getInt(0);
            }
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
        } finally {
            try {
                if (cursor != null) {
                    cursor.close();
                }
            } catch (Exception e) {
                LOGGER.log(Level.SEVERE, e.getMessage(), e);
            }
        }

        if (version < 2) {
            return numTables == DbConstants.NUMBER_OF_TABLES_V1;
        } else {
            return numTables == DbConstants.NUMBER_OF_TABLES;
        }
    }
@ Override public boolean isValidDataBase ( ) { int version = getPoiFileInfo ( ) . version ; int numTables = 0 ; Cursor cursor = null ; try { String sql = version < 2 ? DbConstants . VALID_DB_STATEMENT_V1 : DbConstants . VALID_DB_STATEMENT ; cursor = this . db . rawQuery ( sql , null ) ; if ( cursor . moveToNext ( ) ) { numTables = cursor . getInt ( 0 ) ; } } catch ( Exception e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } finally { try { if ( cursor != null ) { cursor . close ( ) ; } } catch ( Exception e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } if ( version < 2 ) { return numTables == DbConstants . NUMBER_OF_TABLES_V1 ; } else { return numTables == DbConstants . NUMBER_OF_TABLES ; } }
{@inheritDoc}