Java Code Examples for com.sun.jmx.snmp.SnmpStatusException#snmpRspInconsistentName()
The following examples show how to use
com.sun.jmx.snmp.SnmpStatusException#snmpRspInconsistentName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SnmpGenericObjectServer.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Set the value of an SNMP variable. * * <p><b><i> * You should never need to use this method directly. * </i></b></p> * * @param meta The impacted metadata object * @param name The ObjectName of the impacted MBean * @param x The new requested SnmpValue * @param id The OID arc identifying the variable we're trying to set. * @param data User contextual data allocated through the * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory} * * @return The new value of the variable after the operation. * * @exception SnmpStatusException whenever an SNMP exception must be * raised. Raising an exception will abort the request. <br> * Exceptions should never be raised directly, but only by means of * <code> * req.registerSetException(<i>VariableId</i>,<i>SnmpStatusException</i>) * </code> **/ public SnmpValue set(SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data) throws SnmpStatusException { final String attname = meta.getAttributeName(id); final Object attvalue= meta.buildAttributeValue(id,x); final Attribute att = new Attribute(attname,attvalue); Object result = null; try { server.setAttribute(name,att); result = server.getAttribute(name,attname); } catch(InvalidAttributeValueException iv) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } catch (InstanceNotFoundException f) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (ReflectionException r) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (MBeanException m) { Exception t = m.getTargetException(); if (t instanceof SnmpStatusException) throw (SnmpStatusException) t; throw new SnmpStatusException(SnmpStatusException.noAccess); } catch (Exception e) { throw new SnmpStatusException(SnmpStatusException.noAccess); } return meta.buildSnmpValue(id,result); }
Example 2
Source File: SnmpGenericObjectServer.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Set the value of an SNMP variable. * * <p><b><i> * You should never need to use this method directly. * </i></b></p> * * @param meta The impacted metadata object * @param name The ObjectName of the impacted MBean * @param x The new requested SnmpValue * @param id The OID arc identifying the variable we're trying to set. * @param data User contextual data allocated through the * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory} * * @return The new value of the variable after the operation. * * @exception SnmpStatusException whenever an SNMP exception must be * raised. Raising an exception will abort the request. <br> * Exceptions should never be raised directly, but only by means of * <code> * req.registerSetException(<i>VariableId</i>,<i>SnmpStatusException</i>) * </code> **/ public SnmpValue set(SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data) throws SnmpStatusException { final String attname = meta.getAttributeName(id); final Object attvalue= meta.buildAttributeValue(id,x); final Attribute att = new Attribute(attname,attvalue); Object result = null; try { server.setAttribute(name,att); result = server.getAttribute(name,attname); } catch(InvalidAttributeValueException iv) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } catch (InstanceNotFoundException f) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (ReflectionException r) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (MBeanException m) { Exception t = m.getTargetException(); if (t instanceof SnmpStatusException) throw (SnmpStatusException) t; throw new SnmpStatusException(SnmpStatusException.noAccess); } catch (Exception e) { throw new SnmpStatusException(SnmpStatusException.noAccess); } return meta.buildSnmpValue(id,result); }
Example 3
Source File: SnmpGenericObjectServer.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Set the value of an SNMP variable. * * <p><b><i> * You should never need to use this method directly. * </i></b></p> * * @param meta The impacted metadata object * @param name The ObjectName of the impacted MBean * @param x The new requested SnmpValue * @param id The OID arc identifying the variable we're trying to set. * @param data User contextual data allocated through the * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory} * * @return The new value of the variable after the operation. * * @exception SnmpStatusException whenever an SNMP exception must be * raised. Raising an exception will abort the request. <br> * Exceptions should never be raised directly, but only by means of * <code> * req.registerSetException(<i>VariableId</i>,<i>SnmpStatusException</i>) * </code> **/ public SnmpValue set(SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data) throws SnmpStatusException { final String attname = meta.getAttributeName(id); final Object attvalue= meta.buildAttributeValue(id,x); final Attribute att = new Attribute(attname,attvalue); Object result = null; try { server.setAttribute(name,att); result = server.getAttribute(name,attname); } catch(InvalidAttributeValueException iv) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } catch (InstanceNotFoundException f) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (ReflectionException r) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (MBeanException m) { Exception t = m.getTargetException(); if (t instanceof SnmpStatusException) throw (SnmpStatusException) t; throw new SnmpStatusException(SnmpStatusException.noAccess); } catch (Exception e) { throw new SnmpStatusException(SnmpStatusException.noAccess); } return meta.buildSnmpValue(id,result); }
Example 4
Source File: SnmpGenericObjectServer.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Set the value of an SNMP variable. * * <p><b><i> * You should never need to use this method directly. * </i></b></p> * * @param meta The impacted metadata object * @param name The ObjectName of the impacted MBean * @param x The new requested SnmpValue * @param id The OID arc identifying the variable we're trying to set. * @param data User contextual data allocated through the * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory} * * @return The new value of the variable after the operation. * * @exception SnmpStatusException whenever an SNMP exception must be * raised. Raising an exception will abort the request. <br> * Exceptions should never be raised directly, but only by means of * <code> * req.registerSetException(<i>VariableId</i>,<i>SnmpStatusException</i>) * </code> **/ public SnmpValue set(SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data) throws SnmpStatusException { final String attname = meta.getAttributeName(id); final Object attvalue= meta.buildAttributeValue(id,x); final Attribute att = new Attribute(attname,attvalue); Object result = null; try { server.setAttribute(name,att); result = server.getAttribute(name,attname); } catch(InvalidAttributeValueException iv) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } catch (InstanceNotFoundException f) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (ReflectionException r) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (MBeanException m) { Exception t = m.getTargetException(); if (t instanceof SnmpStatusException) throw (SnmpStatusException) t; throw new SnmpStatusException(SnmpStatusException.noAccess); } catch (Exception e) { throw new SnmpStatusException(SnmpStatusException.noAccess); } return meta.buildSnmpValue(id,result); }
Example 5
Source File: SnmpGenericObjectServer.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Set the value of an SNMP variable. * * <p><b><i> * You should never need to use this method directly. * </i></b></p> * * @param meta The impacted metadata object * @param name The ObjectName of the impacted MBean * @param x The new requested SnmpValue * @param id The OID arc identifying the variable we're trying to set. * @param data User contextual data allocated through the * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory} * * @return The new value of the variable after the operation. * * @exception SnmpStatusException whenever an SNMP exception must be * raised. Raising an exception will abort the request. <br> * Exceptions should never be raised directly, but only by means of * <code> * req.registerSetException(<i>VariableId</i>,<i>SnmpStatusException</i>) * </code> **/ public SnmpValue set(SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data) throws SnmpStatusException { final String attname = meta.getAttributeName(id); final Object attvalue= meta.buildAttributeValue(id,x); final Attribute att = new Attribute(attname,attvalue); Object result = null; try { server.setAttribute(name,att); result = server.getAttribute(name,attname); } catch(InvalidAttributeValueException iv) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } catch (InstanceNotFoundException f) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (ReflectionException r) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (MBeanException m) { Exception t = m.getTargetException(); if (t instanceof SnmpStatusException) throw (SnmpStatusException) t; throw new SnmpStatusException(SnmpStatusException.noAccess); } catch (Exception e) { throw new SnmpStatusException(SnmpStatusException.noAccess); } return meta.buildSnmpValue(id,result); }
Example 6
Source File: SnmpGenericObjectServer.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Set the value of an SNMP variable. * * <p><b><i> * You should never need to use this method directly. * </i></b></p> * * @param meta The impacted metadata object * @param name The ObjectName of the impacted MBean * @param x The new requested SnmpValue * @param id The OID arc identifying the variable we're trying to set. * @param data User contextual data allocated through the * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory} * * @return The new value of the variable after the operation. * * @exception SnmpStatusException whenever an SNMP exception must be * raised. Raising an exception will abort the request. <br> * Exceptions should never be raised directly, but only by means of * <code> * req.registerSetException(<i>VariableId</i>,<i>SnmpStatusException</i>) * </code> **/ public SnmpValue set(SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data) throws SnmpStatusException { final String attname = meta.getAttributeName(id); final Object attvalue= meta.buildAttributeValue(id,x); final Attribute att = new Attribute(attname,attvalue); Object result = null; try { server.setAttribute(name,att); result = server.getAttribute(name,attname); } catch(InvalidAttributeValueException iv) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } catch (InstanceNotFoundException f) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (ReflectionException r) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (MBeanException m) { Exception t = m.getTargetException(); if (t instanceof SnmpStatusException) throw (SnmpStatusException) t; throw new SnmpStatusException(SnmpStatusException.noAccess); } catch (Exception e) { throw new SnmpStatusException(SnmpStatusException.noAccess); } return meta.buildSnmpValue(id,result); }
Example 7
Source File: SnmpGenericObjectServer.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Set the value of an SNMP variable. * * <p><b><i> * You should never need to use this method directly. * </i></b></p> * * @param meta The impacted metadata object * @param name The ObjectName of the impacted MBean * @param x The new requested SnmpValue * @param id The OID arc identifying the variable we're trying to set. * @param data User contextual data allocated through the * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory} * * @return The new value of the variable after the operation. * * @exception SnmpStatusException whenever an SNMP exception must be * raised. Raising an exception will abort the request. <br> * Exceptions should never be raised directly, but only by means of * <code> * req.registerSetException(<i>VariableId</i>,<i>SnmpStatusException</i>) * </code> **/ public SnmpValue set(SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data) throws SnmpStatusException { final String attname = meta.getAttributeName(id); final Object attvalue= meta.buildAttributeValue(id,x); final Attribute att = new Attribute(attname,attvalue); Object result = null; try { server.setAttribute(name,att); result = server.getAttribute(name,attname); } catch(InvalidAttributeValueException iv) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } catch (InstanceNotFoundException f) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (ReflectionException r) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (MBeanException m) { Exception t = m.getTargetException(); if (t instanceof SnmpStatusException) throw (SnmpStatusException) t; throw new SnmpStatusException(SnmpStatusException.noAccess); } catch (Exception e) { throw new SnmpStatusException(SnmpStatusException.noAccess); } return meta.buildSnmpValue(id,result); }
Example 8
Source File: SnmpGenericObjectServer.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Set the value of an SNMP variable. * * <p><b><i> * You should never need to use this method directly. * </i></b></p> * * @param meta The impacted metadata object * @param name The ObjectName of the impacted MBean * @param x The new requested SnmpValue * @param id The OID arc identifying the variable we're trying to set. * @param data User contextual data allocated through the * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory} * * @return The new value of the variable after the operation. * * @exception SnmpStatusException whenever an SNMP exception must be * raised. Raising an exception will abort the request. <br> * Exceptions should never be raised directly, but only by means of * <code> * req.registerSetException(<i>VariableId</i>,<i>SnmpStatusException</i>) * </code> **/ public SnmpValue set(SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data) throws SnmpStatusException { final String attname = meta.getAttributeName(id); final Object attvalue= meta.buildAttributeValue(id,x); final Attribute att = new Attribute(attname,attvalue); Object result = null; try { server.setAttribute(name,att); result = server.getAttribute(name,attname); } catch(InvalidAttributeValueException iv) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } catch (InstanceNotFoundException f) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (ReflectionException r) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (MBeanException m) { Exception t = m.getTargetException(); if (t instanceof SnmpStatusException) throw (SnmpStatusException) t; throw new SnmpStatusException(SnmpStatusException.noAccess); } catch (Exception e) { throw new SnmpStatusException(SnmpStatusException.noAccess); } return meta.buildSnmpValue(id,result); }
Example 9
Source File: SnmpGenericObjectServer.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Set the value of an SNMP variable. * * <p><b><i> * You should never need to use this method directly. * </i></b></p> * * @param meta The impacted metadata object * @param name The ObjectName of the impacted MBean * @param x The new requested SnmpValue * @param id The OID arc identifying the variable we're trying to set. * @param data User contextual data allocated through the * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory} * * @return The new value of the variable after the operation. * * @exception SnmpStatusException whenever an SNMP exception must be * raised. Raising an exception will abort the request. <br> * Exceptions should never be raised directly, but only by means of * <code> * req.registerSetException(<i>VariableId</i>,<i>SnmpStatusException</i>) * </code> **/ public SnmpValue set(SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data) throws SnmpStatusException { final String attname = meta.getAttributeName(id); final Object attvalue= meta.buildAttributeValue(id,x); final Attribute att = new Attribute(attname,attvalue); Object result = null; try { server.setAttribute(name,att); result = server.getAttribute(name,attname); } catch(InvalidAttributeValueException iv) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } catch (InstanceNotFoundException f) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (ReflectionException r) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (MBeanException m) { Exception t = m.getTargetException(); if (t instanceof SnmpStatusException) throw (SnmpStatusException) t; throw new SnmpStatusException(SnmpStatusException.noAccess); } catch (Exception e) { throw new SnmpStatusException(SnmpStatusException.noAccess); } return meta.buildSnmpValue(id,result); }
Example 10
Source File: SnmpGenericObjectServer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Set the value of an SNMP variable. * * <p><b><i> * You should never need to use this method directly. * </i></b></p> * * @param meta The impacted metadata object * @param name The ObjectName of the impacted MBean * @param x The new requested SnmpValue * @param id The OID arc identifying the variable we're trying to set. * @param data User contextual data allocated through the * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory} * * @return The new value of the variable after the operation. * * @exception SnmpStatusException whenever an SNMP exception must be * raised. Raising an exception will abort the request. <br> * Exceptions should never be raised directly, but only by means of * <code> * req.registerSetException(<i>VariableId</i>,<i>SnmpStatusException</i>) * </code> **/ public SnmpValue set(SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data) throws SnmpStatusException { final String attname = meta.getAttributeName(id); final Object attvalue= meta.buildAttributeValue(id,x); final Attribute att = new Attribute(attname,attvalue); Object result = null; try { server.setAttribute(name,att); result = server.getAttribute(name,attname); } catch(InvalidAttributeValueException iv) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } catch (InstanceNotFoundException f) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (ReflectionException r) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (MBeanException m) { Exception t = m.getTargetException(); if (t instanceof SnmpStatusException) throw (SnmpStatusException) t; throw new SnmpStatusException(SnmpStatusException.noAccess); } catch (Exception e) { throw new SnmpStatusException(SnmpStatusException.noAccess); } return meta.buildSnmpValue(id,result); }
Example 11
Source File: SnmpRequestTree.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public static int mapGetException(int errorStatus, int version) throws SnmpStatusException { final int errorCode = errorStatus; if (version == SnmpDefinitions.snmpVersionOne) return errorCode; int mappedErrorCode = errorCode; // Now take care of V2 errorCodes that can be stored // in the varbind itself: if (errorCode == SnmpStatusException.noSuchObject) // noSuchObject => noSuchObject mappedErrorCode = errorCode; else if (errorCode == SnmpStatusException.noSuchInstance) // noSuchInstance => noSuchInstance mappedErrorCode = errorCode; // Now we're going to try to transform every other // global code in either noSuchInstance or noSuchObject, // so that the get can return a partial result. // // Only noSuchInstance or noSuchObject can be stored // in the varbind itself. // // According to RFC 1905: noAccess is emitted when the // the access is denied because it is not in the MIB view... // else if (errorCode == SnmpStatusException.noAccess) // noAccess => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // According to RFC 1905: (my interpretation because it is not // really clear) The specified variable name exists - but the // variable does not exists and cannot be created under the // present circumstances (probably because the request specifies // another variable/value which is incompatible, or because the // value of some other variable in the MIB prevents the creation) // // Note that this error should never be raised in a GET context // but who knows? // else if (errorCode == SnmpStatusException.snmpRspInconsistentName) // inconsistentName => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // All the errors comprised between snmpRspWrongType and // snmpRspInconsistentValue concern values: so we're going // to assume the OID was correct, and reply with noSuchInstance. // // Note that this error should never be raised in a GET context // but who knows? // else if ((errorCode >= SnmpStatusException.snmpRspWrongType) && (errorCode <= SnmpStatusException.snmpRspInconsistentValue)) mappedErrorCode = SnmpStatusException.noSuchInstance; // We're going to assume the OID was correct, and reply // with noSuchInstance. // else if (errorCode == SnmpStatusException.readOnly) mappedErrorCode = SnmpStatusException.noSuchInstance; // For all other errors but genErr, we're going to reply with // noSuchObject // else if (errorCode != SnmpStatusException.snmpRspAuthorizationError && errorCode != SnmpStatusException.snmpRspGenErr) mappedErrorCode = SnmpStatusException.noSuchObject; // Only genErr will abort the GET and be returned as global // error. // return mappedErrorCode; }
Example 12
Source File: SnmpRequestTree.java From hottub with GNU General Public License v2.0 | 4 votes |
public static int mapGetException(int errorStatus, int version) throws SnmpStatusException { final int errorCode = errorStatus; if (version == SnmpDefinitions.snmpVersionOne) return errorCode; int mappedErrorCode = errorCode; // Now take care of V2 errorCodes that can be stored // in the varbind itself: if (errorCode == SnmpStatusException.noSuchObject) // noSuchObject => noSuchObject mappedErrorCode = errorCode; else if (errorCode == SnmpStatusException.noSuchInstance) // noSuchInstance => noSuchInstance mappedErrorCode = errorCode; // Now we're going to try to transform every other // global code in either noSuchInstance or noSuchObject, // so that the get can return a partial result. // // Only noSuchInstance or noSuchObject can be stored // in the varbind itself. // // According to RFC 1905: noAccess is emitted when the // the access is denied because it is not in the MIB view... // else if (errorCode == SnmpStatusException.noAccess) // noAccess => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // According to RFC 1905: (my interpretation because it is not // really clear) The specified variable name exists - but the // variable does not exists and cannot be created under the // present circumstances (probably because the request specifies // another variable/value which is incompatible, or because the // value of some other variable in the MIB prevents the creation) // // Note that this error should never be raised in a GET context // but who knows? // else if (errorCode == SnmpStatusException.snmpRspInconsistentName) // inconsistentName => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // All the errors comprised between snmpRspWrongType and // snmpRspInconsistentValue concern values: so we're going // to assume the OID was correct, and reply with noSuchInstance. // // Note that this error should never be raised in a GET context // but who knows? // else if ((errorCode >= SnmpStatusException.snmpRspWrongType) && (errorCode <= SnmpStatusException.snmpRspInconsistentValue)) mappedErrorCode = SnmpStatusException.noSuchInstance; // We're going to assume the OID was correct, and reply // with noSuchInstance. // else if (errorCode == SnmpStatusException.readOnly) mappedErrorCode = SnmpStatusException.noSuchInstance; // For all other errors but genErr, we're going to reply with // noSuchObject // else if (errorCode != SnmpStatusException.snmpRspAuthorizationError && errorCode != SnmpStatusException.snmpRspGenErr) mappedErrorCode = SnmpStatusException.noSuchObject; // Only genErr will abort the GET and be returned as global // error. // return mappedErrorCode; }
Example 13
Source File: SnmpRequestTree.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public static int mapGetException(int errorStatus, int version) throws SnmpStatusException { final int errorCode = errorStatus; if (version == SnmpDefinitions.snmpVersionOne) return errorCode; int mappedErrorCode = errorCode; // Now take care of V2 errorCodes that can be stored // in the varbind itself: if (errorCode == SnmpStatusException.noSuchObject) // noSuchObject => noSuchObject mappedErrorCode = errorCode; else if (errorCode == SnmpStatusException.noSuchInstance) // noSuchInstance => noSuchInstance mappedErrorCode = errorCode; // Now we're going to try to transform every other // global code in either noSuchInstance or noSuchObject, // so that the get can return a partial result. // // Only noSuchInstance or noSuchObject can be stored // in the varbind itself. // // According to RFC 1905: noAccess is emitted when the // the access is denied because it is not in the MIB view... // else if (errorCode == SnmpStatusException.noAccess) // noAccess => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // According to RFC 1905: (my interpretation because it is not // really clear) The specified variable name exists - but the // variable does not exists and cannot be created under the // present circumstances (probably because the request specifies // another variable/value which is incompatible, or because the // value of some other variable in the MIB prevents the creation) // // Note that this error should never be raised in a GET context // but who knows? // else if (errorCode == SnmpStatusException.snmpRspInconsistentName) // inconsistentName => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // All the errors comprised between snmpRspWrongType and // snmpRspInconsistentValue concern values: so we're going // to assume the OID was correct, and reply with noSuchInstance. // // Note that this error should never be raised in a GET context // but who knows? // else if ((errorCode >= SnmpStatusException.snmpRspWrongType) && (errorCode <= SnmpStatusException.snmpRspInconsistentValue)) mappedErrorCode = SnmpStatusException.noSuchInstance; // We're going to assume the OID was correct, and reply // with noSuchInstance. // else if (errorCode == SnmpStatusException.readOnly) mappedErrorCode = SnmpStatusException.noSuchInstance; // For all other errors but genErr, we're going to reply with // noSuchObject // else if (errorCode != SnmpStatusException.snmpRspAuthorizationError && errorCode != SnmpStatusException.snmpRspGenErr) mappedErrorCode = SnmpStatusException.noSuchObject; // Only genErr will abort the GET and be returned as global // error. // return mappedErrorCode; }
Example 14
Source File: SnmpRequestTree.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public static int mapGetException(int errorStatus, int version) throws SnmpStatusException { final int errorCode = errorStatus; if (version == SnmpDefinitions.snmpVersionOne) return errorCode; int mappedErrorCode = errorCode; // Now take care of V2 errorCodes that can be stored // in the varbind itself: if (errorCode == SnmpStatusException.noSuchObject) // noSuchObject => noSuchObject mappedErrorCode = errorCode; else if (errorCode == SnmpStatusException.noSuchInstance) // noSuchInstance => noSuchInstance mappedErrorCode = errorCode; // Now we're going to try to transform every other // global code in either noSuchInstance or noSuchObject, // so that the get can return a partial result. // // Only noSuchInstance or noSuchObject can be stored // in the varbind itself. // // According to RFC 1905: noAccess is emitted when the // the access is denied because it is not in the MIB view... // else if (errorCode == SnmpStatusException.noAccess) // noAccess => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // According to RFC 1905: (my interpretation because it is not // really clear) The specified variable name exists - but the // variable does not exists and cannot be created under the // present circumstances (probably because the request specifies // another variable/value which is incompatible, or because the // value of some other variable in the MIB prevents the creation) // // Note that this error should never be raised in a GET context // but who knows? // else if (errorCode == SnmpStatusException.snmpRspInconsistentName) // inconsistentName => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // All the errors comprised between snmpRspWrongType and // snmpRspInconsistentValue concern values: so we're going // to assume the OID was correct, and reply with noSuchInstance. // // Note that this error should never be raised in a GET context // but who knows? // else if ((errorCode >= SnmpStatusException.snmpRspWrongType) && (errorCode <= SnmpStatusException.snmpRspInconsistentValue)) mappedErrorCode = SnmpStatusException.noSuchInstance; // We're going to assume the OID was correct, and reply // with noSuchInstance. // else if (errorCode == SnmpStatusException.readOnly) mappedErrorCode = SnmpStatusException.noSuchInstance; // For all other errors but genErr, we're going to reply with // noSuchObject // else if (errorCode != SnmpStatusException.snmpRspAuthorizationError && errorCode != SnmpStatusException.snmpRspGenErr) mappedErrorCode = SnmpStatusException.noSuchObject; // Only genErr will abort the GET and be returned as global // error. // return mappedErrorCode; }
Example 15
Source File: SnmpRequestTree.java From JDKSourceCode1.8 with MIT License | 4 votes |
public static int mapGetException(int errorStatus, int version) throws SnmpStatusException { final int errorCode = errorStatus; if (version == SnmpDefinitions.snmpVersionOne) return errorCode; int mappedErrorCode = errorCode; // Now take care of V2 errorCodes that can be stored // in the varbind itself: if (errorCode == SnmpStatusException.noSuchObject) // noSuchObject => noSuchObject mappedErrorCode = errorCode; else if (errorCode == SnmpStatusException.noSuchInstance) // noSuchInstance => noSuchInstance mappedErrorCode = errorCode; // Now we're going to try to transform every other // global code in either noSuchInstance or noSuchObject, // so that the get can return a partial result. // // Only noSuchInstance or noSuchObject can be stored // in the varbind itself. // // According to RFC 1905: noAccess is emitted when the // the access is denied because it is not in the MIB view... // else if (errorCode == SnmpStatusException.noAccess) // noAccess => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // According to RFC 1905: (my interpretation because it is not // really clear) The specified variable name exists - but the // variable does not exists and cannot be created under the // present circumstances (probably because the request specifies // another variable/value which is incompatible, or because the // value of some other variable in the MIB prevents the creation) // // Note that this error should never be raised in a GET context // but who knows? // else if (errorCode == SnmpStatusException.snmpRspInconsistentName) // inconsistentName => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // All the errors comprised between snmpRspWrongType and // snmpRspInconsistentValue concern values: so we're going // to assume the OID was correct, and reply with noSuchInstance. // // Note that this error should never be raised in a GET context // but who knows? // else if ((errorCode >= SnmpStatusException.snmpRspWrongType) && (errorCode <= SnmpStatusException.snmpRspInconsistentValue)) mappedErrorCode = SnmpStatusException.noSuchInstance; // We're going to assume the OID was correct, and reply // with noSuchInstance. // else if (errorCode == SnmpStatusException.readOnly) mappedErrorCode = SnmpStatusException.noSuchInstance; // For all other errors but genErr, we're going to reply with // noSuchObject // else if (errorCode != SnmpStatusException.snmpRspAuthorizationError && errorCode != SnmpStatusException.snmpRspGenErr) mappedErrorCode = SnmpStatusException.noSuchObject; // Only genErr will abort the GET and be returned as global // error. // return mappedErrorCode; }
Example 16
Source File: SnmpRequestTree.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public static int mapGetException(int errorStatus, int version) throws SnmpStatusException { final int errorCode = errorStatus; if (version == SnmpDefinitions.snmpVersionOne) return errorCode; int mappedErrorCode = errorCode; // Now take care of V2 errorCodes that can be stored // in the varbind itself: if (errorCode == SnmpStatusException.noSuchObject) // noSuchObject => noSuchObject mappedErrorCode = errorCode; else if (errorCode == SnmpStatusException.noSuchInstance) // noSuchInstance => noSuchInstance mappedErrorCode = errorCode; // Now we're going to try to transform every other // global code in either noSuchInstance or noSuchObject, // so that the get can return a partial result. // // Only noSuchInstance or noSuchObject can be stored // in the varbind itself. // // According to RFC 1905: noAccess is emitted when the // the access is denied because it is not in the MIB view... // else if (errorCode == SnmpStatusException.noAccess) // noAccess => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // According to RFC 1905: (my interpretation because it is not // really clear) The specified variable name exists - but the // variable does not exists and cannot be created under the // present circumstances (probably because the request specifies // another variable/value which is incompatible, or because the // value of some other variable in the MIB prevents the creation) // // Note that this error should never be raised in a GET context // but who knows? // else if (errorCode == SnmpStatusException.snmpRspInconsistentName) // inconsistentName => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // All the errors comprised between snmpRspWrongType and // snmpRspInconsistentValue concern values: so we're going // to assume the OID was correct, and reply with noSuchInstance. // // Note that this error should never be raised in a GET context // but who knows? // else if ((errorCode >= SnmpStatusException.snmpRspWrongType) && (errorCode <= SnmpStatusException.snmpRspInconsistentValue)) mappedErrorCode = SnmpStatusException.noSuchInstance; // We're going to assume the OID was correct, and reply // with noSuchInstance. // else if (errorCode == SnmpStatusException.readOnly) mappedErrorCode = SnmpStatusException.noSuchInstance; // For all other errors but genErr, we're going to reply with // noSuchObject // else if (errorCode != SnmpStatusException.snmpRspAuthorizationError && errorCode != SnmpStatusException.snmpRspGenErr) mappedErrorCode = SnmpStatusException.noSuchObject; // Only genErr will abort the GET and be returned as global // error. // return mappedErrorCode; }
Example 17
Source File: SnmpRequestTree.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public static int mapGetException(int errorStatus, int version) throws SnmpStatusException { final int errorCode = errorStatus; if (version == SnmpDefinitions.snmpVersionOne) return errorCode; int mappedErrorCode = errorCode; // Now take care of V2 errorCodes that can be stored // in the varbind itself: if (errorCode == SnmpStatusException.noSuchObject) // noSuchObject => noSuchObject mappedErrorCode = errorCode; else if (errorCode == SnmpStatusException.noSuchInstance) // noSuchInstance => noSuchInstance mappedErrorCode = errorCode; // Now we're going to try to transform every other // global code in either noSuchInstance or noSuchObject, // so that the get can return a partial result. // // Only noSuchInstance or noSuchObject can be stored // in the varbind itself. // // According to RFC 1905: noAccess is emitted when the // the access is denied because it is not in the MIB view... // else if (errorCode == SnmpStatusException.noAccess) // noAccess => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // According to RFC 1905: (my interpretation because it is not // really clear) The specified variable name exists - but the // variable does not exists and cannot be created under the // present circumstances (probably because the request specifies // another variable/value which is incompatible, or because the // value of some other variable in the MIB prevents the creation) // // Note that this error should never be raised in a GET context // but who knows? // else if (errorCode == SnmpStatusException.snmpRspInconsistentName) // inconsistentName => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // All the errors comprised between snmpRspWrongType and // snmpRspInconsistentValue concern values: so we're going // to assume the OID was correct, and reply with noSuchInstance. // // Note that this error should never be raised in a GET context // but who knows? // else if ((errorCode >= SnmpStatusException.snmpRspWrongType) && (errorCode <= SnmpStatusException.snmpRspInconsistentValue)) mappedErrorCode = SnmpStatusException.noSuchInstance; // We're going to assume the OID was correct, and reply // with noSuchInstance. // else if (errorCode == SnmpStatusException.readOnly) mappedErrorCode = SnmpStatusException.noSuchInstance; // For all other errors but genErr, we're going to reply with // noSuchObject // else if (errorCode != SnmpStatusException.snmpRspAuthorizationError && errorCode != SnmpStatusException.snmpRspGenErr) mappedErrorCode = SnmpStatusException.noSuchObject; // Only genErr will abort the GET and be returned as global // error. // return mappedErrorCode; }
Example 18
Source File: SnmpRequestTree.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public static int mapGetException(int errorStatus, int version) throws SnmpStatusException { final int errorCode = errorStatus; if (version == SnmpDefinitions.snmpVersionOne) return errorCode; int mappedErrorCode = errorCode; // Now take care of V2 errorCodes that can be stored // in the varbind itself: if (errorCode == SnmpStatusException.noSuchObject) // noSuchObject => noSuchObject mappedErrorCode = errorCode; else if (errorCode == SnmpStatusException.noSuchInstance) // noSuchInstance => noSuchInstance mappedErrorCode = errorCode; // Now we're going to try to transform every other // global code in either noSuchInstance or noSuchObject, // so that the get can return a partial result. // // Only noSuchInstance or noSuchObject can be stored // in the varbind itself. // // According to RFC 1905: noAccess is emitted when the // the access is denied because it is not in the MIB view... // else if (errorCode == SnmpStatusException.noAccess) // noAccess => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // According to RFC 1905: (my interpretation because it is not // really clear) The specified variable name exists - but the // variable does not exists and cannot be created under the // present circumstances (probably because the request specifies // another variable/value which is incompatible, or because the // value of some other variable in the MIB prevents the creation) // // Note that this error should never be raised in a GET context // but who knows? // else if (errorCode == SnmpStatusException.snmpRspInconsistentName) // inconsistentName => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // All the errors comprised between snmpRspWrongType and // snmpRspInconsistentValue concern values: so we're going // to assume the OID was correct, and reply with noSuchInstance. // // Note that this error should never be raised in a GET context // but who knows? // else if ((errorCode >= SnmpStatusException.snmpRspWrongType) && (errorCode <= SnmpStatusException.snmpRspInconsistentValue)) mappedErrorCode = SnmpStatusException.noSuchInstance; // We're going to assume the OID was correct, and reply // with noSuchInstance. // else if (errorCode == SnmpStatusException.readOnly) mappedErrorCode = SnmpStatusException.noSuchInstance; // For all other errors but genErr, we're going to reply with // noSuchObject // else if (errorCode != SnmpStatusException.snmpRspAuthorizationError && errorCode != SnmpStatusException.snmpRspGenErr) mappedErrorCode = SnmpStatusException.noSuchObject; // Only genErr will abort the GET and be returned as global // error. // return mappedErrorCode; }
Example 19
Source File: SnmpRequestTree.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public static int mapGetException(int errorStatus, int version) throws SnmpStatusException { final int errorCode = errorStatus; if (version == SnmpDefinitions.snmpVersionOne) return errorCode; int mappedErrorCode = errorCode; // Now take care of V2 errorCodes that can be stored // in the varbind itself: if (errorCode == SnmpStatusException.noSuchObject) // noSuchObject => noSuchObject mappedErrorCode = errorCode; else if (errorCode == SnmpStatusException.noSuchInstance) // noSuchInstance => noSuchInstance mappedErrorCode = errorCode; // Now we're going to try to transform every other // global code in either noSuchInstance or noSuchObject, // so that the get can return a partial result. // // Only noSuchInstance or noSuchObject can be stored // in the varbind itself. // // According to RFC 1905: noAccess is emitted when the // the access is denied because it is not in the MIB view... // else if (errorCode == SnmpStatusException.noAccess) // noAccess => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // According to RFC 1905: (my interpretation because it is not // really clear) The specified variable name exists - but the // variable does not exists and cannot be created under the // present circumstances (probably because the request specifies // another variable/value which is incompatible, or because the // value of some other variable in the MIB prevents the creation) // // Note that this error should never be raised in a GET context // but who knows? // else if (errorCode == SnmpStatusException.snmpRspInconsistentName) // inconsistentName => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // All the errors comprised between snmpRspWrongType and // snmpRspInconsistentValue concern values: so we're going // to assume the OID was correct, and reply with noSuchInstance. // // Note that this error should never be raised in a GET context // but who knows? // else if ((errorCode >= SnmpStatusException.snmpRspWrongType) && (errorCode <= SnmpStatusException.snmpRspInconsistentValue)) mappedErrorCode = SnmpStatusException.noSuchInstance; // We're going to assume the OID was correct, and reply // with noSuchInstance. // else if (errorCode == SnmpStatusException.readOnly) mappedErrorCode = SnmpStatusException.noSuchInstance; // For all other errors but genErr, we're going to reply with // noSuchObject // else if (errorCode != SnmpStatusException.snmpRspAuthorizationError && errorCode != SnmpStatusException.snmpRspGenErr) mappedErrorCode = SnmpStatusException.noSuchObject; // Only genErr will abort the GET and be returned as global // error. // return mappedErrorCode; }
Example 20
Source File: SnmpRequestTree.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public static int mapGetException(int errorStatus, int version) throws SnmpStatusException { final int errorCode = errorStatus; if (version == SnmpDefinitions.snmpVersionOne) return errorCode; int mappedErrorCode = errorCode; // Now take care of V2 errorCodes that can be stored // in the varbind itself: if (errorCode == SnmpStatusException.noSuchObject) // noSuchObject => noSuchObject mappedErrorCode = errorCode; else if (errorCode == SnmpStatusException.noSuchInstance) // noSuchInstance => noSuchInstance mappedErrorCode = errorCode; // Now we're going to try to transform every other // global code in either noSuchInstance or noSuchObject, // so that the get can return a partial result. // // Only noSuchInstance or noSuchObject can be stored // in the varbind itself. // // According to RFC 1905: noAccess is emitted when the // the access is denied because it is not in the MIB view... // else if (errorCode == SnmpStatusException.noAccess) // noAccess => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // According to RFC 1905: (my interpretation because it is not // really clear) The specified variable name exists - but the // variable does not exists and cannot be created under the // present circumstances (probably because the request specifies // another variable/value which is incompatible, or because the // value of some other variable in the MIB prevents the creation) // // Note that this error should never be raised in a GET context // but who knows? // else if (errorCode == SnmpStatusException.snmpRspInconsistentName) // inconsistentName => noSuchInstance mappedErrorCode = SnmpStatusException.noSuchInstance; // All the errors comprised between snmpRspWrongType and // snmpRspInconsistentValue concern values: so we're going // to assume the OID was correct, and reply with noSuchInstance. // // Note that this error should never be raised in a GET context // but who knows? // else if ((errorCode >= SnmpStatusException.snmpRspWrongType) && (errorCode <= SnmpStatusException.snmpRspInconsistentValue)) mappedErrorCode = SnmpStatusException.noSuchInstance; // We're going to assume the OID was correct, and reply // with noSuchInstance. // else if (errorCode == SnmpStatusException.readOnly) mappedErrorCode = SnmpStatusException.noSuchInstance; // For all other errors but genErr, we're going to reply with // noSuchObject // else if (errorCode != SnmpStatusException.snmpRspAuthorizationError && errorCode != SnmpStatusException.snmpRspGenErr) mappedErrorCode = SnmpStatusException.noSuchObject; // Only genErr will abort the GET and be returned as global // error. // return mappedErrorCode; }