001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2006 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: InvalidFormatException.java,v 1.2 2008/06/25 05:43:43 qcheng Exp $
026 *
027 */
028
029
030
031package com.sun.identity.policy;
032
033/**
034 * Exception thrown if a name of an object such as policy, rule or 
035 * referral has invalid format
036 *
037 * @supported.all.api
038 */
039public class InvalidFormatException extends PolicyException {
040
041    private String name;
042    private int type;
043
044    /**
045     * Constructs a <code>InvalidFormatException</code> instance.
046     *
047     * @param msg exception message
048     * @param name name that was in invalid format
049     * @param type type of object that had invalid name format
050     */
051    public InvalidFormatException(String msg, String name, int type) {
052        super(msg);
053        fillInStackTrace();
054        this.name = name;
055        this.type = type;
056    }
057
058    /**
059     * Constructs a <code>InvalidFormatException</code> instance.
060     *
061     * @param t nested root cause exception
062     * @param name name that was in invalid format
063     * @param type type of object that had invalid name format
064     */
065    public InvalidFormatException(Throwable t, String name, int type) {
066        super(t);
067        fillInStackTrace();
068        this.name = name;
069        this.type = type;
070    }
071
072    /**
073     * Constructs a <code>InvalidFormatException</code> instance.
074     *
075     * @param rbName Resource bundle name of exception message
076     * @param errCode id used with resource bundle to get error message
077     * @param args any arguments for message formatting. null if no
078     * additional arguments are necessary
079     * @param t nested root cause exception
080     * @param name name that was in invalid format
081     * @param type type of object that had invalid name format
082     */
083    public InvalidFormatException(String rbName,String errCode,
084        Object [] args, Throwable t, String name, int type) 
085    {
086        super(rbName,errCode,args,t);
087        fillInStackTrace();
088        this.name = name;
089        this.type = type;
090    }
091
092    /**
093     * Constructs a <code>InvalidFormatException</code> instance.
094     *
095     * @param rbName Resource bundle name of exception message
096     * @param errCode id used with resource bundle to get error message
097     * @param args any arguments for message formatting. null if no
098     * additional arguments are necessary
099     * @param name name that was in invalid format
100     * @param type type of object that had invalid name format
101     */
102    public InvalidFormatException(String rbName,String errCode,
103        Object [] args, String name, int type) 
104    {
105        super(rbName,errCode,args,null);
106        fillInStackTrace();
107        this.name = name;
108        this.type = type;
109    }
110
111    /**
112     * Gets the name of the object that encountered an invalid format.
113     *
114     * @return name that was in invalid format
115     */
116    public String getName() {
117        return (name);
118    }
119
120    /**
121     * Gets the type of object which encountered
122     * the invalid name. The defined objects are <code>POLICY</code>,
123     * <code>RULE</code>, <code>ORGANIZATION</code>,
124     * <code>USER_COLLECTION</code>
125     * <code>RESPONSE_PROVIDER_COLLECTION</code>
126     * <code>CONDITION_COLLECTION</code>
127     * <code>REFERRAL_COLLECTION</code>
128     * <code>REFERRAL_TYPE</code>
129     * <code>SUBJECT_TYPE</code>
130     * and <code>SERVICE</code>
131     *
132     * @return type of object that had invalid name format
133     */
134    public int getObjectType() {
135        return (type);
136    }
137}




























































Copyright © 2010-2017, ForgeRock All Rights Reserved.