📄 xmlparseexception.java
字号:
/*====================================================================*\XmlParseException.javaXML parse exception class.------------------------------------------------------------------------This file is part of FuncPlotter, a combined Java application and appletfor plotting explicit functions in one variable.Copyright 2005-2007 Andy Morgan-Richards.FuncPlotter is free software: you can redistribute it and/or modify itunder the terms of the GNU General Public License as published by theFree Software Foundation, either version 3 of the License, or (at youroption) any later version.This program is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public License alongwith this program. If not, see <http://www.gnu.org/licenses/>.\*====================================================================*/// PACKAGEpackage xml;//----------------------------------------------------------------------// IMPORTSimport exception.AppException;import exception.ExceptionUtilities;import java.io.File;import java.io.IOException;//----------------------------------------------------------------------// XML PARSE EXCEPTION CLASSpublic class XmlParseException extends AppException{////////////////////////////////////////////////////////////////////////// Constants//////////////////////////////////////////////////////////////////////// private static final int MAX_PATHNAME_LENGTH = 128; private static final String NAME_STR = "Name: "; private static final String VALUE_STR = "Value: ";////////////////////////////////////////////////////////////////////////// Constructors//////////////////////////////////////////////////////////////////////// public XmlParseException( AppException.Id id, String name ) { super( id ); this.name = name; } //------------------------------------------------------------------ public XmlParseException( AppException.Id id, String name, String value ) { this( id, name ); this.value = value; } //------------------------------------------------------------------ public XmlParseException( AppException.Id id, File file, String name ) { this( id, name ); this.file = file; } //------------------------------------------------------------------ public XmlParseException( AppException.Id id, File file, String name, String value ) { this( id, file, name ); this.value = value; } //------------------------------------------------------------------ public XmlParseException( AppException.Id id, File file, String[] substitutionStrs ) { super( id, substitutionStrs ); this.file = file; } //------------------------------------------------------------------ public XmlParseException( AppException.Id id, File file, String name, String[] substitutionStrs ) { this( id, file, substitutionStrs ); this.name = name; } //------------------------------------------------------------------ public XmlParseException( AppException.Id id, File file, String name, String value, String[] substitutionStrs ) { this( id, file, name, substitutionStrs ); this.value = value; } //------------------------------------------------------------------ public XmlParseException( XmlParseException exception, File file ) { this( exception.getId( ), file, exception.name, exception.value, exception.getSubstitutionStrings( ) ); } //------------------------------------------------------------------////////////////////////////////////////////////////////////////////////// Class methods//////////////////////////////////////////////////////////////////////// protected static String getPathname( File file ) { return ExceptionUtilities.getLimitedPathname( file, MAX_PATHNAME_LENGTH ); } //------------------------------------------------------------------////////////////////////////////////////////////////////////////////////// Instance methods : overriding methods//////////////////////////////////////////////////////////////////////// public String toString( ) { StringBuilder buffer = new StringBuilder( 256 ); if ( file != null ) { buffer.append( getPathname( file ) ); buffer.append( '\n' ); } if ( name != null ) { buffer.append( NAME_STR ); buffer.append( name ); buffer.append( '\n' ); } if ( value != null ) { buffer.append( VALUE_STR ); buffer.append( value ); buffer.append( '\n' ); } buffer.append( super.toString( ) ); return buffer.toString( ); } //------------------------------------------------------------------////////////////////////////////////////////////////////////////////////// Instance variables//////////////////////////////////////////////////////////////////////// private File file; private String name; private String value;}//----------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -