View Javadoc

1   /*
2    * Copyright 2012-2013 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package de.smartics.properties.api.core.domain;
17  
18  /**
19   * Signals that a properties configuration cannot be parsed.
20   */
21  public class ConfigException extends RuntimeException
22  {
23    // ********************************* Fields *********************************
24  
25    // --- constants ------------------------------------------------------------
26  
27    /**
28     * The class version identifier.
29     * <p>
30     * The value of this constant is {@value}.
31     */
32    private static final long serialVersionUID = 1L;
33  
34    // --- members --------------------------------------------------------------
35  
36    /**
37     * The resource that cannot be read.
38     */
39    private final String systemId;
40  
41    // ****************************** Initializer *******************************
42  
43    // ****************************** Constructors ******************************
44  
45    /**
46     * Default constructor.
47     *
48     * @param systemId the resource that cannot be read.
49     */
50    public ConfigException(final String systemId)
51    {
52      super("Cannot find config file '" + systemId + "'.");
53      this.systemId = systemId;
54    }
55  
56    /**
57     * Default Constructor.
58     *
59     * @param systemId the resource that cannot be read.
60     * @param cause the cause (which is saved for later retrieval by the
61     *          {@link #getCause()} method). (A <tt>null</tt> value is permitted,
62     *          and indicates that the cause is nonexistent or unknown.)
63     */
64    public ConfigException(final String systemId, final Throwable cause)
65    {
66      super("Cannot load config file '" + systemId + "'.", cause);
67      this.systemId = systemId;
68    }
69  
70    // ****************************** Inner Classes *****************************
71  
72    // ********************************* Methods ********************************
73  
74    // --- init -----------------------------------------------------------------
75  
76    // --- get&set --------------------------------------------------------------
77  
78    /**
79     * Returns the resource that cannot be read.
80     *
81     * @return the resource that cannot be read.
82     */
83    public final String getSystemId()
84    {
85      return systemId;
86    }
87  
88    // --- business -------------------------------------------------------------
89  
90    // --- object basics --------------------------------------------------------
91  
92  }