Package com.sun.jmx.snmp

Examples of com.sun.jmx.snmp.SnmpStatusException


            if (msg == null) {
                if (isDebugOn()) {
                    debug("sendPdu", "pdu factory returned a null value");
                }
                throw new SnmpStatusException(snmpReqUnknownError);
                // This exception will caught hereafter and reported as an snmpReqUnknownError
                // FIXME: may be it's not the best behaviour ?
            }

            int maxPktSize = adaptor.getBufferSize().intValue();
View Full Code Here


      throws SnmpStatusException {
      // The index in the exception must correspond to
      // the SNMP index ...
      //
      if (version == SnmpDefinitions.snmpVersionOne)
    throw new SnmpStatusException(exception, getVarIndex(var)+1);

      if (var == null)
    throw exception;

      // If we're doing a getnext ==> endOfMibView
      if (getnextflag) {
    var.value = SnmpVarBind.endOfMibView;
    return;
      }

      final int errorCode = mapGetException(exception.getStatus(),
              version);

      // Now take care of V2 errorCodes that can be stored
      // in the varbind itself:
      if (errorCode ==
    SnmpStatusException.noSuchObject)
    // noSuchObject => noSuchObject
    var.value= SnmpVarBind.noSuchObject;

      else if (errorCode ==
         SnmpStatusException.noSuchInstance)
    // noSuchInstance => noSuchInstance
    var.value= SnmpVarBind.noSuchInstance;

      else
    throw new SnmpStatusException(errorCode, getVarIndex(var)+1);

  }
View Full Code Here

      throws SnmpStatusException {
      // The index in the exception must correspond to
      // the SNMP index ...
      //
      if (version == SnmpDefinitions.snmpVersionOne)
    throw new SnmpStatusException(exception, getVarIndex(var)+1);

      // Although the first pass of check() did not fail,
      // the set() phase could not be carried out correctly.
      // Since we don't know how to make an "undo", and some
      // assignation may already have been performed, we're going
      // to throw an snmpRspUndoFailed.
      //
      throw new SnmpStatusException(SnmpDefinitions.snmpRspUndoFailed,
            getVarIndex(var)+1);
  }
View Full Code Here

      final int errorCode = exception.getStatus();
      final int mappedErrorCode = mapSetException(errorCode,
              version);
     
      if (errorCode != mappedErrorCode)
    throw new
        SnmpStatusException(mappedErrorCode, getVarIndex(var)+1);
      else
    throw new SnmpStatusException(exception, getVarIndex(var)+1);
  }
View Full Code Here

        // } else v = entrylists[pos];
    if (statusvb != null) {
        if ((rs != null) && (rs != statusvb) &&
      ((type == SnmpDefinitions.pduWalkRequest) ||
       (type == SnmpDefinitions.pduSetRequestPdu))) {
      throw new SnmpStatusException(
            SnmpStatusException.snmpRspInconsistentValue);
        }
        rowstatus[pos] = statusvb;
    }
      }
View Full Code Here

      bdec = new BerDecoder(data);
      bdec.openSequence();
      version = bdec.fetchInteger();
  }
        catch(BerException x) {
            throw new SnmpStatusException("Invalid encoding") ;
        }
  try {
      bdec.closeSequence();
  }
        catch(BerException x) {
View Full Code Here

        else if (v instanceof SnmpOid) {
            benc.putOid(((SnmpOid)v).longValue()) ;
        }
        else if (v instanceof SnmpCounter64) {
            if (version == snmpVersionOne) {
                throw new SnmpStatusException("Invalid value for SNMP v1 : " + v) ;
           
            benc.putInteger(((SnmpCounter64)v).longValue(), SnmpValue.Counter64Tag) ;
        }
        else if (v instanceof SnmpNull) {
            int tag = ((SnmpNull)v).getTag() ;
            if ((version == snmpVersionOne) && (tag != SnmpValue.NullTag)) {
                throw new SnmpStatusException("Invalid value for SNMP v1 : " + v) ;
            }
            if ((version == snmpVersionTwo) &&
                (tag != SnmpValue.NullTag) &&
                (tag != SnmpVarBind.errNoSuchObjectTag) &&
                (tag != SnmpVarBind.errNoSuchInstanceTag) &&
                (tag != SnmpVarBind.errEndOfMibViewTag)) {
                throw new SnmpStatusException("Invalid value " + v) ;
            }
            benc.putNull(tag) ;
        }
        else {
            throw new SnmpStatusException("Invalid value " + v) ;
        }
   
    }
View Full Code Here

         Object entry, SnmpMibTable meta)
  throws SnmpStatusException {
  try {
      if (entries != null) entries.add(pos,entry);
  } catch (Exception e) {
      throw new SnmpStatusException(SnmpStatusException.noSuchName);
  }
    }
View Full Code Here

 
  for (int j=0; j < i; j++) {
      if (!it.hasNext()) {
    //java.lang.System.out.println(name + "variable[" + j +
    //           "] absent");
    final SnmpStatusException x =
        new SnmpStatusException(errorCode);
    req.registerGetException(varList[j],x);
    continue;
      }

      final Attribute att = (Attribute) it.next();

      while ((j < i) && (! nameList[j].equals(att.getName()))) {
    //java.lang.System.out.println(name + "variable[" +j +
    //           "] not found");
    final SnmpStatusException x =
        new SnmpStatusException(errorCode);
    req.registerGetException(varList[j],x);
    j++;
      }

      if ( j == i) break;
View Full Code Here

      result = server.getAttribute(name,attname);
  } catch (MBeanException m) {
      Exception t = m.getTargetException();
      if (t instanceof SnmpStatusException)
    throw (SnmpStatusException) t;
      throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
  } catch (Exception e) {
      throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
  }

  return meta.buildSnmpValue(id,result);
    }
View Full Code Here

TOP

Related Classes of com.sun.jmx.snmp.SnmpStatusException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.