001/* 002 * BioJava development code 003 * 004 * This code may be freely distributed and modified under the 005 * terms of the GNU Lesser General Public Licence. This should 006 * be distributed with the code. If you do not have a copy, 007 * see: 008 * 009 * http://www.gnu.org/copyleft/lesser.html 010 * 011 * Copyright for this code is held jointly by the individual 012 * authors. These should be listed in @author doc comments. 013 * 014 * For more information on the BioJava project and its aims, 015 * or to join the biojava-l mailing list, visit the home page 016 * at: 017 * 018 * http://www.biojava.org 019 */ 020 021package org.biojava.utils; 022 023import java.util.EventObject; 024 025/** 026 * Event which signals a bad line when parsing a record. 027 * 028 * @author Greg Cox 029 */ 030 031public class ParseErrorEvent extends EventObject 032{ 033 private final String mMessage; 034 035// Constructors 036 /** 037 * Construct a ParseErrorEvent with no other information. 038 * 039 * @param theSource The source of the parse error 040 */ 041 public ParseErrorEvent(Object theSource) 042 { 043 this(theSource, null); 044 } 045 046 /** 047 * 048 * Construct a ParseErrorEvent with a message. 049 * 050 * @param theSource The source of the parse error. 051 * @param theMessage The message. 052 */ 053 054 public ParseErrorEvent(Object theSource, String theMessage) 055 { 056 super(theSource); 057 this.mMessage = theMessage; 058 } 059 060// Accessor Methods 061 /** 062 * Find the message about this event 063 * 064 * @return The message. 065 */ 066 public String getMessage() 067 { 068 return mMessage; 069 } 070 071 public String toString() 072 { 073 StringBuffer representation = new StringBuffer( 074 super.toString() + 075 "[" + 076 this.getMessage() + 077 "]"); 078 return representation.substring(0); 079 } 080}