001/** 002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 003 * 004 * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved 005 * 006 * The contents of this file are subject to the terms 007 * of the Common Development and Distribution License 008 * (the License). You may not use this file except in 009 * compliance with the License. 010 * 011 * You can obtain a copy of the License at 012 * https://opensso.dev.java.net/public/CDDLv1.0.html or 013 * opensso/legal/CDDLv1.0.txt 014 * See the License for the specific language governing 015 * permission and limitations under the License. 016 * 017 * When distributing Covered Code, include this CDDL 018 * Header Notice in each file and include the License file 019 * at opensso/legal/CDDLv1.0.txt. 020 * If applicable, add the following below the CDDL Header, 021 * with the fields enclosed by brackets [] replaced by 022 * your own identifying information: 023 * "Portions Copyrighted [year] [name of copyright owner]" 024 * 025 * $Id: SSOException.java,v 1.5 2008/06/25 05:41:42 qcheng Exp $ 026 * 027 */ 028 029package com.iplanet.sso; 030 031import com.sun.identity.shared.locale.Locale; 032import com.sun.identity.shared.locale.L10NMessageImpl; 033 034/** 035 * This <code>SSOException</code> is thrown when there are single sign on token 036 * operation error. 037 * 038 * @supported.all.api 039 */ 040public class SSOException extends L10NMessageImpl { 041 042 private static final long serialVersionUID = 8947757932659270975L; 043 044 /** 045 * Constructs a <code>SSOException</code> with a detail message. 046 * @param msg The message provided by the object that is throwing the 047 * exception. 048 */ 049 public SSOException(String msg) { 050 super(msg); 051 } 052 053 /** 054 * Constructs a <code>SSOException</code> with a detailed localizable error 055 * message. 056 * 057 * @param bundleName Resource Bundle Name to be used for getting 058 * localized error message. 059 * @param errCode Key to resource bundle. You can use 060 * 061 * <pre> 062 * ResourceBundle rb = ResourceBunde.getBundle (rbName,locale); 063 * String localizedStr = rb.getString(errorCode) 064 * </pre> 065 * 066 * @param args Arguments to message. If arguments to the message are not 067 * present, pass null. 068 */ 069 public SSOException(String bundleName, String errCode, Object[] args) { 070 super(bundleName, errCode, args); 071 } 072 073 /** 074 * Constructs a <code>SSOException</code> with a specified throwable cause 075 * and detailed message. 076 * 077 * @param t The <code>Throwable</code> object provided by the object that is 078 * throwing the exception. 079 */ 080 public SSOException(Throwable t) { 081 super(t); 082 } 083 084 /** 085 * Returns the localized message for this exception. Default locale is used 086 * to retrieve this message from properties file, which is the locale of OS. 087 * 088 * @return the localized message for this exception. 089 */ 090 public String getL10NMessage() { 091 return getL10NMessage(Locale.getDefaultLocale()); 092 } 093}