1   /*
2    * InvalidFormatException.java
3    *
4    * Copyright (c) 2002, The University of Sheffield.
5    *
6    * This file is part of GATE (see http://gate.ac.uk/), and is free
7    * software, licenced under the GNU Library General Public License,
8    * Version 2, June1991.
9    *
10   * A copy of this licence is included in the distribution in the file
11   * licence.html, and is also available at http://gate.ac.uk/gate/licence.html.
12   *
13   * borislav popov 16/04/2002
14   *
15   * $Id: InvalidFormatException.java,v 1.2 2002/07/03 09:33:41 nasso Exp $
16   */
17  package gate.creole.gazetteer;
18  
19  import java.net.URL;
20  import gate.util.GateException;
21  
22  /** exception thrown when an invalid format of a file is detected */
23  public class InvalidFormatException extends GateException{
24  
25    /**
26     * the associated file
27     */
28    private String file;
29  
30    /** the associated URL */
31    private URL url;
32  
33    /** the basic exception message */
34    private final static String MSG = "Invalid format of file is detected; file: ";
35  
36    /**
37     * Constructs the exception given a file and a comment
38     * @param file the file to be associated
39     * @param comment to be added to the basic excpetion message
40     */
41    public InvalidFormatException(String file,String comment) {
42      super(MSG+file+"\n"+(null==comment ? "" : comment));
43    }
44  
45  
46    /**
47     * Constructs the exception given an URL and a comment
48     * @param url  the url to be associated
49     * @param comment to be added to the basic excpetion message
50     */
51    public InvalidFormatException(URL url,String comment) {
52      super(MSG+url.toString()+"\n"+(null==comment ? "" : comment));
53    }
54  
55    public InvalidFormatException() {
56      super(MSG);
57    }
58  
59    /**
60     * Gets the associated file
61     * @return the associated file
62     */
63    public String getFile(){
64      return file;
65    }
66  
67    /**
68     * Gets the asssociated URL
69     * @return the associated URL
70     */
71    private URL getURL() {
72      return url;
73    }
74  } // class InvalidFormatException