001 package com.croftsoft.core.lang.lifecycle; 002 003 /********************************************************************* 004 * Indicates lifecycle object initialization failure. 005 * 006 * <p> 007 * After this RuntimeException subclass is thrown by the init() method, 008 * the lifecycle object should be discarded. No methods, including the 009 * destroy() method, should be called as initialization was 010 * unsuccessful. 011 * </p> 012 * 013 * @version 014 * 2001-03-22 015 * @version 016 * 2001-02-28 017 * @author 018 * <A HREF="http://www.alumni.caltech.edu/~croft">David W. Croft</A> 019 *********************************************************************/ 020 021 public final class InitializationException extends RuntimeException 022 ////////////////////////////////////////////////////////////////////// 023 ////////////////////////////////////////////////////////////////////// 024 { 025 026 private static final long serialVersionUID = 1L; 027 028 private String rootExceptionString; 029 030 ////////////////////////////////////////////////////////////////////// 031 ////////////////////////////////////////////////////////////////////// 032 033 public InitializationException ( 034 String message, 035 Exception rootException ) 036 ////////////////////////////////////////////////////////////////////// 037 { 038 super ( message ); 039 040 if ( rootException != null ) 041 { 042 this.rootExceptionString = rootException.toString ( ); 043 } 044 else 045 { 046 this.rootExceptionString = null; 047 } 048 } 049 050 public InitializationException ( Exception rootException ) 051 ////////////////////////////////////////////////////////////////////// 052 { 053 this ( 054 rootException != null ? rootException.getMessage ( ) : null, 055 rootException ); 056 } 057 058 public InitializationException ( String message ) 059 ////////////////////////////////////////////////////////////////////// 060 { 061 this ( message, null ); 062 } 063 064 public InitializationException ( ) 065 ////////////////////////////////////////////////////////////////////// 066 { 067 this ( null, null ); 068 } 069 070 ////////////////////////////////////////////////////////////////////// 071 ////////////////////////////////////////////////////////////////////// 072 073 public String getRootExceptionString ( ) 074 ////////////////////////////////////////////////////////////////////// 075 { 076 return rootExceptionString; 077 } 078 079 ////////////////////////////////////////////////////////////////////// 080 ////////////////////////////////////////////////////////////////////// 081 }