//------------------------------------------------------------------------------ // Compilation Unit Header //------------------------------------------------------------------------------ // // Copyright (c) 2006 Waysys LLC. All Rights Reserved. // // Permission to use, copy, modify, and distribute this software // and its documentation for NON-COMMERCIAL purposes and without // fee is hereby granted provided that this copyright notice // appears in all copies. // // Waysys MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF // THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED // TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A // PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Waysys SHALL NOT BE LIABLE FOR // ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR // DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. // // For further information, contact Waysys LLC at wshaffer@waysysweb.com // or 800-622-5315 (USA). // //------------------------------------------------------------------------------ // Maintenance History //------------------------------------------------------------------------------ // // Person Date Change // ------ ----------- ---------------------------------------------------- // // Shaffer 02-May-1997 File create // Shaffer 17-Jun-2000 Package names updated and adapted to JBuilder // Shaffer 12-Nov-2006 Added message for illegal day of week // Shaffer 07-Jan-2007 Added constructor to accept integer as second argument // Shaffer 09-Jan-2007 Added error message for minimum holiday year // //------------------------------------------------------------------------------ // Package Declaration //------------------------------------------------------------------------------ package com.waysysweb.util; //------------------------------------------------------------------------------ // Import Declarations //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // Public Class Declaration //------------------------------------------------------------------------------ /** * Represent information about an illegal date. * * @author William A. Shaffer * @version 1.01 17-Jun-2000 */ public class WayDateException extends WayException { /** * The serial verion unique identifier for this class */ private static final long serialVersionUID = 9704L; /** Minimum error value */ public final static int MIN_ERROR = Integer.MIN_VALUE; /** Base error number */ public final static int BASE_ERROR = 100; /** Illegal month */ public final static int ILLEGAL_MONTH = 101; /** Illegal day */ public final static int ILLEGAL_DAY = 102; /** Illegal year */ public final static int ILLEGAL_YEAR = 103; /** Illegal day of year */ public final static int ILLEGAL_DAY_YEAR = 104; /** Illegal absolute date */ public final static int ILLEGAL_ABSOLUTE = 105; /** Illegal holiday year */ public final static int ILLEGAL_HOLIDAY_YEAR= 106; /** Illegat day of week */ public final static int ILLEGAL_DAY_OF_WEEK = 107; /** Maximum error number */ public final static int MAX_ERROR = Integer.MAX_VALUE; /** array of error numbers */ private final static int errNum[] = { MIN_ERROR, BASE_ERROR, ILLEGAL_MONTH, ILLEGAL_DAY, ILLEGAL_YEAR, ILLEGAL_DAY_YEAR, ILLEGAL_ABSOLUTE, ILLEGAL_HOLIDAY_YEAR, ILLEGAL_DAY_OF_WEEK, MAX_ERROR }; private final static String errMessage[] = { /* MIN_VALUE */ "", /* 100 */ "", /* 101 */ "Illegal month: %. Must be between 1 and 12.", /* 102 */ "Illegal day: %. Must be between 1 and the last day of the month.", /* 103 */ "Illegal year: %. Must be between 1601 and 3999.", /* 104 */ "Illegal day of year: %.", /* 105 */ "Illegal absolute date: %.", /* 106 */ "Illegal year for holidays: %. Must be between 1900 and 3999.", /* 107 */ "Illegal day of week: %. Must be between 0 and 6.", /* MAX_VALUE */ "" }; /** * Create a WayDateException * * @param errorNum the number identifying the error. * @param arg an argument inserted into the error message. */ public WayDateException(int errorNum, String arg) { super(errorNum, arg); return; } /** * Create a WayDateException * * @param errorNum the number identifying the error. * @param arg an integer argument inserted into the error message */ public WayDateException(int errorNum, int arg) { super(errorNum, arg); return; } /** * Display the error message associated with this exception. * To be implemented in subclasses. * * @return the error message associated with this exception */ public String getMessage() { String message = buildMessage(errNum, errMessage); return message; } }