usr/src/java/smf-old/org/opensolaris/os/scf/common/ScfException.java
author Dan Labrecque <dan.labrecque@oracle.com>
Thu, 19 Jan 2012 16:01:30 -0500
changeset 793 0a5a7daf579b
parent 391 usr/src/java/scf/common/org/opensolaris/os/scf/common/ScfException.java@71abce159a62
permissions -rw-r--r--
7130765 - Move old SMF module to VP core package
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
     1
/*
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
     2
 * CDDL HEADER START
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
     3
 *
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
     5
 * Common Development and Distribution License (the "License").
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
     6
 * You may not use this file except in compliance with the License.
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
     7
 *
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    11
 * and limitations under the License.
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    12
 *
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    18
 *
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    19
 * CDDL HEADER END
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    20
 */
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    21
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    22
/*
793
0a5a7daf579b 7130765 - Move old SMF module to VP core package
Dan Labrecque <dan.labrecque@oracle.com>
parents: 391
diff changeset
    23
 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
0
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    24
 */
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    25
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    26
package org.opensolaris.os.scf.common;
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    27
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    28
import org.opensolaris.os.rad.ObjectException;
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    29
import org.opensolaris.os.smf.SmfError;
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    30
import org.opensolaris.os.smf.SmfErrorCode;
0
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    31
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    32
/**
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    33
 * The SCF checked exeption class.
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    34
 *
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    35
 * XXX: This should be generated by ADRgen
0
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    36
 */
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    37
@SuppressWarnings({"serial"})
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    38
public class ScfException extends Exception
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    39
{
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    40
    private SmfErrorCode error_ = null;
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    41
    private String msg_ = "";
0
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    42
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    43
    public ScfException(ObjectException e)
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    44
    {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    45
	super(e);
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    46
	SmfError se = e.getPayload(SmfError.class);
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    47
	if (se != null) {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    48
	    error_ = se.getError();
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    49
	    msg_ = se.getMessage();
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    50
	} else {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    51
	}
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    52
    }
0
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    53
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    54
    @Override
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    55
    public String getMessage()
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    56
    {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    57
	    return (msg_);
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    58
    }
0
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    59
391
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    60
    /**
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    61
     * Returns the error which caused the ScfException.
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    62
     */
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    63
    public SmfErrorCode getError()
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    64
    {
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    65
	    return (error_);
71abce159a62 13357 rad
David Powell <David.Powell@sun.com>
parents: 310
diff changeset
    66
    }
0
62ac12e07fc0 Initial integration.
David Powell <David.Powell@sun.com>
parents:
diff changeset
    67
}