View Javadoc

1   /* -*- mode: JDE; c-basic-offset: 2; indent-tabs-mode: nil -*-
2    *
3    * $Id: InvalidFileException.java,v 1.1 2003/07/31 20:27:19 ljnelson Exp $
4    *
5    * Copyright (c) 2003 Laird Jarrett Nelson.
6    *
7    * Permission is hereby granted, free of charge, to any person obtaining a copy
8    * of this software and associated documentation files (the "Software"), to deal
9    * in the Software without restriction, including without limitation the rights
10   * to use, copy, modify, merge, publish, distribute, sublicense and/or sell 
11   * copies of the Software, and to permit persons to whom the Software is 
12   * furnished to do so, subject to the following conditions:
13   * 
14   * The above copyright notice and this permission notice shall be included in 
15   * all copies or substantial portions of the Software.
16   * 
17   * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
19   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
20   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
21   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23   * SOFTWARE.
24   *
25   * The original copy of this license is available at
26   * http://www.opensource.org/license/mit-license.html.
27   */
28  package sfutils.frs;
29  
30  import java.io.File;
31  
32  import sfutils.SourceForgeException;
33  
34  /***
35   * A {@link SourceForgeException} that indicates an invalid {@link File} was
36   * supplied to a method.
37   *
38   * @author     <a href="mailto:ljnelson94@alumni.amherst.edu">Laird Nelson</a>
39   * @version    $Revision: 1.1 $ $Date: 2003/07/31 20:27:19 $
40   * @since      July 18, 2003 
41   */
42  public class InvalidFileException extends SourceForgeException {
43     
44    /***
45     * The {@link File} that was invalid.  This field may be <code>null</code>.
46     */
47    private final File file;
48   
49    /***
50     * Creates a new {@link InvalidFileException}.
51     *
52     * @param      cause
53     *               the {@link Exception} that caused this {@link
54     *               InvalidFileException} to be thrown; may be <code>null</code> 
55     */
56    public InvalidFileException(final Exception cause) {
57      this(cause, null, null);
58    }
59    
60    /***
61     * Creates a new {@link InvalidFileException}.
62     *
63     * @param      message
64     *               a descriptive message; may be <code>null</code>
65     */
66    public InvalidFileException(final String message) {
67      this(null, null, message);
68    }
69  
70    /***
71     * Creates a new {@link InvalidFileException}.
72     *
73     * @param      file
74     *               the {@link File} that is invalid for some reason; may be
75     *               <code>null</code>
76     */
77    public InvalidFileException(final File file) {
78      this(null, file, null);
79    }
80    
81    /***
82     * Creates a new {@link InvalidFileException}.
83     *
84     * @param      cause
85     *               the {@link Exception} that caused this {@link
86     *               InvalidFileException} to be thrown; may be <code>null</code>
87     * @param      message
88     *               a descriptive message; may be <code>null</code> 
89     */
90    public InvalidFileException(final Exception cause,
91                                final String message) {
92      this(cause, null, message);
93    }
94  
95    /***
96     * Creates a new {@link InvalidFileException}.
97     *
98     * @param      cause
99     *               the {@link Exception} that caused this {@link
100    *               InvalidFileException} to be thrown; may be <code>null</code>
101    * @param      file 
102    *               the {@link File} that is invalid; may be <code>null</code>
103    */
104   public InvalidFileException(final Exception cause,
105                               final File file) {
106     this(cause, file, null);
107   }
108 
109   /***
110    * Creates a new {@link InvalidFileException}.
111    *
112    * @param      cause
113    *               the {@link Exception} that caused this {@link
114    *               InvalidFileException} to be thrown; may be <code>null</code>
115    * @param      file
116    *               the {@link File} that is invalid for some reason; may be
117    *               <code>null</code>
118    * @param      message
119    *               a descriptive message; may be <code>null</code> 
120    */
121   public InvalidFileException(final Exception cause,
122                               final File file,
123                               final String message) {
124     super(cause, message);
125     this.file = file;
126   }
127 
128   /***
129    * Returns the {@link File} that was invalid.  This method may return
130    * <code>null</code>.
131    *
132    * @return     the {@link File} that was invalid, or <code>null</code>
133    */
134   public File getFile() {
135     return this.file;
136   }
137   
138 }