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