Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/com/sun/jmx/snmp/SnmpStatusException.java
38924 views
/*1* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/242526package com.sun.jmx.snmp;27282930/**31* Reports an error which occurred during a get/set operation on a mib node.32*33* This exception includes a status error code as defined in the SNMP protocol.34*35* <p><b>This API is a Sun Microsystems internal API and is subject36* to change without notice.</b></p>37*/3839public class SnmpStatusException extends Exception implements SnmpDefinitions {40private static final long serialVersionUID = 5809485694133115675L;4142/**43* Error code as defined in RFC 1448 for: <CODE>noSuchName</CODE>.44*/45public static final int noSuchName = 2 ;4647/**48* Error code as defined in RFC 1448 for: <CODE>badValue</CODE>.49*/50public static final int badValue = 3 ;5152/**53* Error code as defined in RFC 1448 for: <CODE>readOnly</CODE>.54*/55public static final int readOnly = 4 ;565758/**59* Error code as defined in RFC 1448 for: <CODE>noAccess</CODE>.60*/61public static final int noAccess = 6 ;6263/**64* Error code for reporting a no such instance error.65*/66public static final int noSuchInstance = 0xE0;6768/**69* Error code for reporting a no such object error.70*/71public static final int noSuchObject = 0xE1;7273/**74* Constructs a new <CODE>SnmpStatusException</CODE> with the specified status error.75* @param status The error status.76*/77public SnmpStatusException(int status) {78errorStatus = status ;79}8081/**82* Constructs a new <CODE>SnmpStatusException</CODE> with the specified status error and status index.83* @param status The error status.84* @param index The error index.85*/86public SnmpStatusException(int status, int index) {87errorStatus = status ;88errorIndex = index ;89}9091/**92* Constructs a new <CODE>SnmpStatusException</CODE> with an error message.93* The error status is set to 0 (noError) and the index to -1.94* @param s The error message.95*/96public SnmpStatusException(String s) {97super(s);98}99100/**101* Constructs a new <CODE>SnmpStatusException</CODE> with an error index.102* @param x The original <CODE>SnmpStatusException</CODE>.103* @param index The error index.104*/105public SnmpStatusException(SnmpStatusException x, int index) {106super(x.getMessage());107errorStatus= x.errorStatus;108errorIndex= index;109}110111/**112* Return the error status.113* @return The error status.114*/115public int getStatus() {116return errorStatus ;117}118119/**120* Returns the index of the error.121* A value of -1 means that the index is not known/applicable.122* @return The error index.123*/124public int getErrorIndex() {125return errorIndex;126}127128129// PRIVATE VARIABLES130//--------------------131132/**133* Status of the error.134* @serial135*/136private int errorStatus = 0 ;137138/**139* Index of the error.140* If different from -1, indicates the index where the error occurs.141* @serial142*/143private int errorIndex= -1;144145}146147148