001/** 002 * 003 * Copyright © 2014-2015 Florian Schmaus 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.jxmpp.stringprep; 018 019import java.io.IOException; 020 021/** 022 * XMPP Stringprep exceptions signal an error when performing a particular Stringprep profile on a String. 023 */ 024public class XmppStringprepException extends IOException { 025 026 /** 027 * 028 */ 029 private static final long serialVersionUID = -8491853210107124624L; 030 031 private final String causingString; 032 033 /** 034 * Construct a new XMPP Stringprep exception with the given causing String and exception. 035 * 036 * @param causingString the String causing the exception. 037 * @param exception the exception. 038 */ 039 public XmppStringprepException(String causingString, Exception exception) { 040 super("XmppStringprepException caused by '" + causingString + "': " + exception); 041 initCause(exception); 042 this.causingString = causingString; 043 } 044 045 /** 046 * Construct a new XMPP Stringprep exception with the given causing String and exception message. 047 * 048 * @param causingString the String causing the exception. 049 * @param message the message of the exception. 050 */ 051 public XmppStringprepException(String causingString, String message) { 052 super(message); 053 this.causingString = causingString; 054 } 055 056 /** 057 * Get the String causing the XMPP Stringprep exception. 058 * 059 * @return the causing String. 060 */ 061 public String getCausingString() { 062 return causingString; 063 } 064}