[jboss-cvs] JBossAS SVN: r110474 - branches/snmp4j-int/varia/src/main/java/org/jboss/jmx/adaptor/snmp/agent.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 27 16:37:27 EST 2011


Author: thauser at redhat.com
Date: 2011-01-27 16:37:27 -0500 (Thu, 27 Jan 2011)
New Revision: 110474

Modified:
   branches/snmp4j-int/varia/src/main/java/org/jboss/jmx/adaptor/snmp/agent/RequestHandlerImpl.java
Log:
fixed GetNext to properly indicate endOfMibView indications upon leaving the MIB (attributes.xml). added comments indicating the source of method behavior

Modified: branches/snmp4j-int/varia/src/main/java/org/jboss/jmx/adaptor/snmp/agent/RequestHandlerImpl.java
===================================================================
--- branches/snmp4j-int/varia/src/main/java/org/jboss/jmx/adaptor/snmp/agent/RequestHandlerImpl.java	2011-01-27 21:36:11 UTC (rev 110473)
+++ branches/snmp4j-int/varia/src/main/java/org/jboss/jmx/adaptor/snmp/agent/RequestHandlerImpl.java	2011-01-27 21:37:27 UTC (rev 110474)
@@ -69,6 +69,7 @@
  *
  * @author <a href="mailto:hwr at pilhuhn.de>">Heiko W. Rupp</a>
  * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
+ * @author <a href="mailto:thauser at redhat.com"> or <a href="mailto:tom.hauser at gmail.com">Thomas Hauser</a>
  * @version $Revision$
  */
 public class RequestHandlerImpl extends RequestHandlerSupport
@@ -82,8 +83,9 @@
 
 	/** Bindings from oid to mbean */
 	protected SortedMap bindings = new TreeMap();
-
+	
 	private SortedSet oidKeys = null;
+	/** keep track of the objects created **/
 	private SortedSet objectKeys = null;
 
 	/** Has this RequestHandler instance been initialized? */
@@ -163,6 +165,7 @@
     * The remaining (size - nonRepeaters) elements in the VariableBinding list have maxRepetitions GETNEXT calls
     * upon them. All of these VariableBindings are added into the response. 
     * The resultant response will have N + (M*R) VariableBindings
+    * This method functions according to the protocol definition in RFC-3416
     * 
     * </P>
     * @param pdu
@@ -266,18 +269,17 @@
 					continue;
 				}
 								
-				//FIXME: returns null when maxReptitions goes into OIDs that don't exist. 
 				for (int j = 0; j < maxRepetitions; j++){
 					try {
 						var = getValueFor(noid);
 					} 
 					// since we're using getNext to retrieve the OIDs, this can't happen. we'll always have an instance.
 					catch (NoSuchInstanceException e) {
-						var = Null.noSuchObject;						
+						var = Null.noSuchInstance;						
 					} 
 					catch (VariableTypeException e) {
 						makeErrorPdu(response, pdu, counter, PDU.genErr);
-						var = Null.noSuchInstance;						
+						var = Null.instance;						
 					}
 					
 					response.add(new VariableBinding(noid,var));
@@ -301,6 +303,7 @@
 	 * This method is defined to handle SNMP Get requests that are received by
 	 * the session. The request has already been validated by the system. This
 	 * routine will build a response and pass it back to the caller.
+	 * The behaviour is defined in RFC-3416
 	 * </P>
 	 * 
 	 * @param pdu
@@ -358,10 +361,13 @@
 						//makeErrorPdu(oid,PDU.noAccess, counter,response);
 
 					}
-					newVB = new VariableBinding(noid);
-					if (endOfMib)
+					
+					if (endOfMib){
+						newVB = new VariableBinding(oid);
 						var = Null.endOfMibView;
+					}
 					else{
+						newVB = new VariableBinding(noid);
 						try {
 							var = getValueFor(noid);
 						}
@@ -375,7 +381,6 @@
 							log.debug("snmpReceivedGet: GETNEXT operation could not convert the returned value for " + noid + " into an appropriate type.");
 							makeErrorPdu(response, pdu, counter, PDU.genErr);
 							return response;
-							
 						}
 					}
 				}
@@ -421,6 +426,7 @@
 	 * This method is defined to handle SNMP Set requests that are received by
 	 * the session. The request has already been validated by the system. This
 	 * routine will build a response and pass it back to the caller.
+	 * The behaviour is defined in RFC-3416
 	 * </P>
 	 * 
 	 * @param pdu



More information about the jboss-cvs-commits mailing list