Re: [SNMP4J] Issue when a PDU contains two SETs for a table row status with a value of 6 to destroy when one row exists and the other row does not exist

2017-08-10 Thread Frank Fock
Hi Don,

This is obviously a bug and will be fixed with the next SNMP4J-Agent release.

Best regards,
Frank


> On 9. Aug 2017, at 16:54, Broderick, Don  wrote:
> 
> SNMP4J version 2.5.6
> SNMP4J-Agent version 2.6.0
> 
> I have discovered the following behavior inconsistency where I would expect 
> no error to be returned in both cases.
> 
> When a PDU is sent containing one SET of a row status to 6 for destroy for a 
> row that exists the row is destroyed and no error is returned.  Performing 
> the same operation in a separate PDU for a row that does not exist again 
> returns no error.  When a PDU containing 2 SETs, one for a row that exists 
> and one for a row that does not exist (both in the same table) a commit 
> failed error is returned and the row that existed is destroyed.
> 
> In the line highlighted below of DefaultMOTable the variable "row" has a null 
> value when this event occurs and causes a null pointer exception.
> 
>  public void commit(SubRequest request) {
>OID cellOID = request.getVariableBinding().getOid();
>MOTableCellInfo cell = getCellInfo(cellOID);
>MOMutableColumn col = (MOMutableColumn) getColumn(cell.getColumn());
>if (logger.isDebugEnabled()) {
>  logger.debug("Committing sub-request ("+
>   request.getVariableBinding()+") for column: "+col);
>}
>// Make sure changes are atomic -> sync whole table model
>synchronized (model) {
>  R row;
>  if (hasNewRows(request.getRequest())) {
>row = getNewRows(request.getRequest()).get(cell.getIndex());
>// check if row has been added already
>if (!model.containsRow(row.getIndex())) {
>  if (!addRow(row)) {
>request.setErrorStatus(PDU.resourceUnavailable);
>return;
>  }
>}
>  }
>  else {
>row = model.getRow(cell.getIndex());
>  }
> 
> -DonB
> ___
> SNMP4J mailing list
> SNMP4J@agentpp.org
> https://oosnmp.net/mailman/listinfo/snmp4j

___
SNMP4J mailing list
SNMP4J@agentpp.org
https://oosnmp.net/mailman/listinfo/snmp4j


[SNMP4J] Issue when a PDU contains two SETs for a table row status with a value of 6 to destroy when one row exists and the other row does not exist

2017-08-10 Thread Broderick, Don
SNMP4J version 2.5.6
SNMP4J-Agent version 2.6.0

I have discovered the following behavior inconsistency where I would expect no 
error to be returned in both cases.

When a PDU is sent containing one SET of a row status to 6 for destroy for a 
row that exists the row is destroyed and no error is returned.  Performing the 
same operation in a separate PDU for a row that does not exist again returns no 
error.  When a PDU containing 2 SETs, one for a row that exists and one for a 
row that does not exist (both in the same table) a commit failed error is 
returned and the row that existed is destroyed.

In the line highlighted below of DefaultMOTable the variable "row" has a null 
value when this event occurs and causes a null pointer exception.

  public void commit(SubRequest request) {
OID cellOID = request.getVariableBinding().getOid();
MOTableCellInfo cell = getCellInfo(cellOID);
MOMutableColumn col = (MOMutableColumn) getColumn(cell.getColumn());
if (logger.isDebugEnabled()) {
  logger.debug("Committing sub-request ("+
   request.getVariableBinding()+") for column: "+col);
}
// Make sure changes are atomic -> sync whole table model
synchronized (model) {
  R row;
  if (hasNewRows(request.getRequest())) {
row = getNewRows(request.getRequest()).get(cell.getIndex());
// check if row has been added already
if (!model.containsRow(row.getIndex())) {
  if (!addRow(row)) {
request.setErrorStatus(PDU.resourceUnavailable);
return;
  }
}
  }
  else {
row = model.getRow(cell.getIndex());
  }

-DonB
___
SNMP4J mailing list
SNMP4J@agentpp.org
https://oosnmp.net/mailman/listinfo/snmp4j