001 package cnslab.cnsnetwork; 002 003 import org.xml.sax.ErrorHandler; 004 import org.xml.sax.SAXParseException; 005 006 /*********************************************************************** 007 * @version 008 * $Date: 2012-08-04 13:43:22 -0500 (Sat, 04 Aug 2012) $ 009 * $Rev: 104 $ 010 * $Author: croft $ 011 * @author 012 * Yi Dong 013 * @author 014 * David Wallace Croft 015 ***********************************************************************/ 016 public final class SimpleErrorHandler 017 implements ErrorHandler 018 //////////////////////////////////////////////////////////////////////// 019 //////////////////////////////////////////////////////////////////////// 020 { 021 022 @Override 023 public void error ( final SAXParseException exception ) 024 //////////////////////////////////////////////////////////////////////// 025 { 026 throw new RuntimeException ( 027 "error: " + exception.getMessage ( ) 028 + " at line" + exception.getLineNumber ( ) 029 + "," + exception.getColumnNumber ( ) ); 030 } 031 032 @Override 033 public void fatalError ( final SAXParseException exception ) 034 //////////////////////////////////////////////////////////////////////// 035 { 036 throw new RuntimeException ( 037 "fatalError: " + exception.getMessage ( ) 038 + " at line" + exception.getLineNumber ( ) 039 + "," + exception.getColumnNumber ( ) ); 040 } 041 042 @Override 043 public void warning ( final SAXParseException exception ) 044 //////////////////////////////////////////////////////////////////////// 045 { 046 throw new RuntimeException ( 047 "warning: "+ exception.getMessage ( ) 048 + " at line" +exception.getLineNumber ( ) 049 + "," + exception.getColumnNumber ( ) ); 050 } 051 052 //////////////////////////////////////////////////////////////////////// 053 //////////////////////////////////////////////////////////////////////// 054 }