001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * https://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018package org.apache.commons.validator.routines.checkdigit; 019 020import java.util.IllegalFormatException; 021 022/** 023 * Check Digit calculation/validation error. 024 * 025 * @since 1.4 026 */ 027public class CheckDigitException extends Exception { 028 029 private static final long serialVersionUID = -3519894732624685477L; 030 031 /** 032 * Constructs a new exception with no message. 033 */ 034 public CheckDigitException() { 035 } 036 037 /** 038 * Constructs a new exception with a message. 039 * 040 * @param msg The error message. 041 */ 042 public CheckDigitException(final String msg) { 043 super(msg); 044 } 045 046 /** 047 * Constructs a new exception with a message and the underlying cause. 048 * 049 * @param format See {@link String#format(String, Object...)}. 050 * @param args See {@link String#format(String, Object...)}. 051 * @throws IllegalFormatException See {@link String#format(String, Object...)}. 052 * @since 1.11.0 053 */ 054 public CheckDigitException(final String format, final Object... args) { 055 super(String.format(format, args)); 056 } 057 058 /** 059 * Constructs an Exception with a message and the underlying cause. 060 * 061 * @param msg The error message. 062 * @param cause The underlying cause of the error. 063 */ 064 public CheckDigitException(final String msg, final Throwable cause) { 065 super(msg, cause); 066 } 067}