protected void checkRepositoryHash(String hash) throws JournalException {
        if (!server.hasInitialized()) {
            throw new IllegalStateException("The repository has is not available until "
                    + "the server is fully initialized.");
        }

        JournalException hashException = null;

        if (hash == null) {
            hashException =
                    new JournalException("'" + QNAME_TAG_JOURNAL
                            + "' tag must have a '"
                            + QNAME_ATTR_REPOSITORY_HASH + "' attribute.");
        } else {
            try {
                String currentHash = server.getRepositoryHash();
                if (hash.equals(currentHash)) {
                    recoveryLog.log("Validated repository hash: '" + hash
                            + "'.");
                } else {
                    hashException =
                            new JournalException("'"
                                    + QNAME_ATTR_REPOSITORY_HASH
                                    + "' attribute in '"
                                    + QNAME_TAG_JOURNAL
                                    + "' tag does not match current repository hash: '"
                                    + hash + "' vs. '" + currentHash + "'.");
                }
            } catch (ServerException e) {
                hashException = new JournalException(e);
            }
        }

        if (hashException != null) {
            if (ignoreHashErrors) {
                recoveryLog.log("WARNING: " + hashException.getMessage());
            } else {
                throw hashException;
            }
        }

    }
protected void checkRepositoryHash ( String hash ) throws JournalException { if ( ! server . hasInitialized ( ) ) { throw new IllegalStateException ( "The repository has is not available until " + "the server is fully initialized." ) ; } JournalException hashException = null ; if ( hash == null ) { hashException = new JournalException ( "'" + QNAME_TAG_JOURNAL + "' tag must have a '" + QNAME_ATTR_REPOSITORY_HASH + "' attribute." ) ; } else { try { String currentHash = server . getRepositoryHash ( ) ; if ( hash . equals ( currentHash ) ) { recoveryLog . log ( "Validated repository hash: '" + hash + "'." ) ; } else { hashException = new JournalException ( "'" + QNAME_ATTR_REPOSITORY_HASH + "' attribute in '" + QNAME_TAG_JOURNAL + "' tag does not match current repository hash: '" + hash + "' vs. '" + currentHash + "'." ) ; } } catch ( ServerException e ) { hashException = new JournalException ( e ) ; } } if ( hashException != null ) { if ( ignoreHashErrors ) { recoveryLog . log ( "WARNING: " + hashException . getMessage ( ) ) ; } else { throw hashException ; } } }
Compare the repository hash from the journal file with the current hash
obtained from the server. If they do not match, either throw an exception
or simply log it, depending on the parameters. This method must not be
called before the server has completed initialization. That's the only
way we can be confident that the DOManager is present, and ready to
create the repository has that we will compare to.