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