jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java
changeset 22331 f65a493da643
parent 14677 1607f4cfc506
child 22336 a5de9b85e983
--- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java	Thu Oct 17 09:23:49 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java	Mon Oct 21 09:56:06 2013 +0200
@@ -108,8 +108,9 @@
      */
     public void validateVarId(long arc, Object userData)
         throws SnmpStatusException {
-        if (isVariable(arc) == false)
-            throw noSuchObjectException;
+        if (isVariable(arc) == false) {
+            throw new SnmpStatusException(SnmpStatusException.noSuchObject);
+        }
     }
 
 
@@ -360,17 +361,20 @@
             validateVarId(arc, data);
 
             // The trailing .0 is missing in the OID
-            if (depth+2 > length)
-                throw noSuchInstanceException;
+            if (depth+2 > length) {
+                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;
+            if (depth+2 < length) {
+                throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
+            }
 
             // The last trailing arc is not .0
-            if (oid[depth+1] != 0L)
-                throw noSuchInstanceException;
+            if (oid[depth+1] != 0L) {
+                throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
+            }
 
             // It's one of our variable, register this node.
             handlers.add(this,depth,varbind);
@@ -389,12 +393,13 @@
         int length = oid.length;
         SnmpMibNode node = null;
 
-        if (handlers == null)
+        if (handlers == null) {
             // This should be considered as a genErr, but we do not want to
             // abort the whole request, so we're going to throw
             // a noSuchObject...
             //
-            throw noSuchObjectException;
+            throw new SnmpStatusException(SnmpStatusException.noSuchObject);
+        }
 
         final Object data = handlers.getUserData();
         final int pduVersion = handlers.getRequestPduVersion();
@@ -430,7 +435,7 @@
                                                         depth+1,handlers,
                                                         checker);
                 }catch(SnmpStatusException ex) {
-                    throw noSuchObjectException;
+                    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
                 } finally {
                     checker.remove(depth);
                 }
@@ -455,7 +460,7 @@
                     try {
                         checker.checkCurrentOid();
                     } catch(SnmpStatusException e) {
-                        throw noSuchObjectException;
+                        throw new SnmpStatusException(SnmpStatusException.noSuchObject);
                     } finally {
                         checker.remove(depth,2);
                     }
@@ -500,7 +505,7 @@
             // The oid is not valid, we will throw an exception in order
             // to try with the next valid identifier...
             //
-            throw noSuchObjectException;
+            throw new SnmpStatusException(SnmpStatusException.noSuchObject);
 
         } catch (SnmpStatusException e) {
             // We didn't find anything at the given arc, so we're going