archiva-modules/archiva-base/archiva-checksum/src/main/java/org/apache/archiva/checksum/ChecksummedFile.java
/**
     * Parse a checksum string.
     * <p>
     * Validate the expected path, and expected checksum algorithm, then return
     * the trimmed checksum hex string.
     * </p>
     *
     * @param checksumFile The file where the checksum is stored
     * @param checksumAlgorithm The checksum algorithm to check
     * @param fileName The filename of the reference file
     * @return
     * @throws IOException
     */
Parse a checksum string.

Validate the expected path, and expected checksum algorithm, then return
the trimmed checksum hex string.


Parse a checksum string . Validate the expected path and expected checksum algorithm then return the trimmed checksum hex string .
public String parseChecksum( Path checksumFile, ChecksumAlgorithm checksumAlgorithm, String fileName, Charset encoding )
        throws ChecksumValidationException
    {
        ChecksumFileContent fc = parseChecksumFile( checksumFile, checksumAlgorithm, encoding );
        if ( fc.isFormatMatch() && !isValidChecksumPattern( fc.getFileReference( ), fileName ) )
        {
            throw new ChecksumValidationException(BAD_CHECKSUM_FILE_REF,
                "The file reference '" + fc.getFileReference( ) + "' in the checksum file does not match expected file: '" + fileName + "'" );
        } else if (!fc.isFormatMatch()) {
            throw new ChecksumValidationException( BAD_CHECKSUM_FILE, "The checksum file content could not be parsed: "+checksumFile );
        }
        return fc.getChecksum( );
    }
public String parseChecksum ( Path checksumFile , ChecksumAlgorithm checksumAlgorithm , String fileName , Charset encoding ) throws ChecksumValidationException { ChecksumFileContent fc = parseChecksumFile ( checksumFile , checksumAlgorithm , encoding ) ; if ( fc . isFormatMatch ( ) && ! isValidChecksumPattern ( fc . getFileReference ( ) , fileName ) ) { throw new ChecksumValidationException ( BAD_CHECKSUM_FILE_REF , "The file reference '" + fc . getFileReference ( ) + "' in the checksum file does not match expected file: '" + fileName + "'" ) ; } else if ( ! fc . isFormatMatch ( ) ) { throw new ChecksumValidationException ( BAD_CHECKSUM_FILE , "The checksum file content could not be parsed: " + checksumFile ) ; } return fc . getChecksum ( ) ; }
Parse a checksum string.
Parse a checksum string .