1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
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 }