001 /** 002 * Copyright 2011 The Buzz Media, LLC 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package com.thebuzzmedia.sjxp; 017 018 /** 019 * Unchecked exception used to unify and report everything that can go wrong 020 * during an XML parse. 021 * <p/> 022 * Using this helps simplify caller code by allowing them to optionally catch 023 * this unchecked exception. Each exception of this type will include a detailed 024 * explanation of what caused the underlying exception to occur and avoids 025 * pushing up the concerns of the underlying impl to the caller. 026 * <p/> 027 * 90% of the time you just want to parse XML and know if it succeeded or 028 * failed, so SJXP simplifies for this scenario. 029 * <p/> 030 * For callers that do want to know exactly what went wrong, you can use 031 * {@link #getCause()} to get the source exception that this one is wrapping. 032 * 033 * @author Riyad Kalla (software@thebuzzmedia.com) 034 */ 035 public class XMLParserException extends RuntimeException { 036 private static final long serialVersionUID = 1L; 037 038 /** 039 * Create a new exception with the given message. 040 * 041 * @param message 042 * The explanation of why the exception was thrown. 043 */ 044 public XMLParserException(String message) { 045 super(message); 046 } 047 048 /** 049 * Create a new exception with the given message and cause. 050 * 051 * @param message 052 * The explanation of why the exception was thrown. 053 * @param cause 054 * The underlying exception that occurred that caused this one to 055 * be created. 056 */ 057 public XMLParserException(String message, Exception cause) { 058 super(message, cause); 059 } 060 }