Code example for NoSuchAlgorithmException

0
        if ("CRC".equals(algorithm)) {
            checksum = new CRC32();
        } else if ("ADLER".equals(algorithm)) {
            checksum = new Adler32();
        } else { 
            throw new BuildException(new NoSuchAlgorithmException());
        } 
    } 
 
 
    // -----  Logic  ----- 
 
 
    /** 
     * This algorithm supports only CRC and Adler. 
     * @return <i>true</i> if all is ok, otherwise <i>false</i>. 
     */ 
    public boolean isValid() { 
        return "CRC".equals(algorithm) || "ADLER".equals(algorithm);
    }