@@ -0,0 +1,1739 @@
+/*%0A * Created by brightSPARK Labs%0A * www.brightsparklabs.com%0A */%0A%0A/*%0A * Created by brightSPARK Labs%0A * www.brightsparklabs.com%0A */%0A%0Apackage com.brightsparklabs.asanti.common;%0A%0Aimport com.brightsparklabs.asanti.validator.ValidationFailure;%0Aimport com.brightsparklabs.asanti.validator.ValidationResult;%0A%0A/**%0A * Signals that invalid data was supplied to a decoder%0A *%0A * @author brightSPARK Labs%0A */%0Apublic class DecodeException extends Exception%0A%7B%0A    // -------------------------------------------------------------------------%0A    // CONSTRUCTION%0A    // -------------------------------------------------------------------------%0A%0A    /**%0A     * Default constructor%0A     *%0A     * @param message%0A     *         reason for the failure%0A     */%0A    public DecodeException(String message)%0A    %7B%0A        super(message);%0A    %7D%0A%0A    // -------------------------------------------------------------------------%0A    // PUBLIC METHODS%0A    // -------------------------------------------------------------------------%0A%0A    /**%0A     * Throws a DecodeException if the supplied validation results contain any failures. The%0A     * exception will contain details of the failures.%0A     *%0A     * @throws DecodeException%0A     *         if the validation result contains failures%0A     */%0A    public static void throwIfHasFailures(ValidationResult validationResult) throws DecodeException%0A    %7B%0A        if (!validationResult.hasFailures())%0A        %7B%0A            return;%0A        %7D%0A%0A        final StringBuilder builder = new StringBuilder();%0A        for (ValidationFailure failure : validationResult.getFailures())%0A        %7B%0A            builder.append(failure.getFailureReason()).append(%22%5Cn%22);%0A        %7D%0A        throw new DecodeException(builder.toString());%0A    %7D%0A%7D%0A

Throw DecodeException if decoding fails