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:53 nasso Exp $
16   */
17  package gate.creole.ontology;
18  
19  import java.net.URL;
20  import gate.util.GateException;
21  
22  /** An exception thrown when invalid format of an ontology file is detected */
23  public class InvalidFormatException extends GateException{
24  
25    /** the ontology file */
26    private String file;
27    /** the url of the file */
28    private URL url;
29  
30    /** The basic exception message */
31    private final static String MSG = "Invalid format of file is detected; file: ";
32  
33    /**
34     * Construction given file and comment
35     * @param file the ontology file
36     * @param comment comment of the exception
37     */
38    public InvalidFormatException(String file,String comment) {
39      super(MSG+file+"\n"+(null==comment ? "" : comment));
40    }
41  
42    /**
43     * Construction given file URL and comment
44     * @param url the ontology url
45     * @param comment comment of the exception
46     */
47    public InvalidFormatException(URL url,String comment) {
48      super(MSG+url.toString()+"\n"+(null==comment ? "" : comment));
49    }
50  
51    public InvalidFormatException() {
52      super(MSG);
53    }
54  
55    /**
56     * Gets the file associated with this exception
57     * @return the file associated with this exception
58     */
59    public String getFile(){
60      return file;
61    }
62  
63    /**
64     * Gets the URL associated with this exception
65     * @return the URL associated with this exception
66     */
67    private URL getURL() {
68      return url;
69    }
70  } // class InvalidFormatException