View Javadoc

1   /*
2    * Copyright (C) The DNA Group. All rights reserved.
3    *
4    * This software is published under the terms of the DNA
5    * Software License version 1.1, a copy of which has been included
6    * with this distribution in the LICENSE.txt file.
7    */
8   package org.codehaus.dna;
9   
10  /***
11   * The MissingResourceException is used to signal a problem
12   * retrieving a resource from the ResourceLocator object.
13   *
14   * @version $Revision: 1.2 $ $Date: 2004/05/01 09:51:48 $
15   */
16  public class MissingResourceException
17      extends Exception
18  {
19      /***
20       * The exception that caused this exception if any.
21       */
22      private final Throwable m_cause;
23  
24      /***
25       * The resource key that caused the problem.
26       */
27      private final String m_key;
28  
29      /***
30       * Create a MissingResourceException with specified message
31       * and key.
32       *
33       * @param message the message
34       * @param key the key
35       */
36      public MissingResourceException( final String message,
37                                       final String key )
38      {
39          this( message, key, null );
40      }
41  
42      /***
43       * Create a MissingResourceException with specified
44       * message, key and cause.
45       *
46       * @param message the message
47       * @param key the key
48       * @param cause the cause
49       */
50      public MissingResourceException( final String message,
51                                       final String key,
52                                       final Throwable cause )
53      {
54          super( message );
55          m_key = key;
56          m_cause = cause;
57      }
58  
59      /***
60       * Return the resource key that caused the problem.
61       *
62       * @return the resource key that caused the problem.
63       */
64      public String getKey()
65      {
66          return m_key;
67      }
68  
69      /***
70       * Return the exception that caused this exception if any.
71       *
72       * @return the exception that caused this exception if any.
73       */
74      public Throwable getCause()
75      {
76          return m_cause;
77      }
78  }