OpenJDK / jdk7u / jdk7u / jdk
changeset 6870:496c51673dec
7068126: Enhance SNMP statuses
Reviewed-by: dfuchs, hawtin
| author | sjiang |
|---|---|
| date | Mon, 21 Oct 2013 17:47:56 +0200 |
| parents | ac44ec0de12a |
| children | 5348ecf3da7f |
| files | src/share/classes/com/sun/jmx/snmp/agent/SnmpMibEntry.java src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java src/share/classes/com/sun/jmx/snmp/agent/SnmpMibNode.java src/share/classes/com/sun/jmx/snmp/agent/SnmpMibOid.java src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java src/share/classes/com/sun/jmx/snmp/daemon/SnmpRequestHandler.java |
| diffstat | 6 files changed, 38 insertions(+), 60 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibEntry.java Sun Oct 20 06:12:08 2013 -0700 +++ b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibEntry.java Mon Oct 21 17:47:56 2013 +0200 @@ -27,17 +27,9 @@ // java imports // +import com.sun.jmx.snmp.SnmpDefinitions; import java.io.Serializable; -import java.util.Hashtable; -import java.util.Enumeration; - -// jmx imports -// -import com.sun.jmx.snmp.SnmpValue; -import com.sun.jmx.snmp.SnmpVarBind; import com.sun.jmx.snmp.SnmpStatusException; -import com.sun.jmx.snmp.agent.SnmpMibOid; -import com.sun.jmx.snmp.agent.SnmpMibNode; /** * Represents a node in an SNMP MIB which corresponds to a table entry @@ -99,7 +91,7 @@ */ public void validateVarId(long arc, Object userData) throws SnmpStatusException { - if (isVariable(arc) == false) throw noSuchNameException; + if (isVariable(arc) == false) throw new SnmpStatusException(SnmpDefinitions.snmpRspNoSuchName); } /**
--- a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java Sun Oct 20 06:12:08 2013 -0700 +++ b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java Mon Oct 21 17:47:56 2013 +0200 @@ -116,7 +116,7 @@ public void validateVarId(long arc, Object userData) throws SnmpStatusException { if (isVariable(arc) == false) - throw noSuchObjectException; + throw new SnmpStatusException(SnmpStatusException.noSuchObject); } @@ -365,16 +365,16 @@ // The trailing .0 is missing in the OID if (depth+2 > length) - throw noSuchInstanceException; + throw new SnmpStatusException(SnmpStatusException.noSuchInstance); // There are too many arcs left in the OID (there should remain // a single trailing .0) if (depth+2 < length) - throw noSuchInstanceException; + throw new SnmpStatusException(SnmpStatusException.noSuchInstance); // The last trailing arc is not .0 if (oid[depth+1] != 0L) - throw noSuchInstanceException; + throw new SnmpStatusException(SnmpStatusException.noSuchInstance); // It's one of our variable, register this node.