private void sendTrapPdu(InetAddress addr,SnmpPduPacket pdu) throws SnmpStatusException, IOException {
  SnmpMessage msg=null;
  try {
    msg=(SnmpMessage)pduFactory.encodeSnmpPdu(pdu,bufferSize);
    if (msg == null) {
      throw new SnmpStatusException(SnmpDefinitions.snmpRspAuthorizationError);
    }
  }
 catch (  SnmpTooBigException x) {
    if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
      SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,dbgTag,"sendTrapPdu","Trap pdu is too big. " + "Trap hasn't been sent to the specified host.");
    }
    throw new SnmpStatusException(SnmpDefinitions.snmpRspTooBig);
  }
  openTrapSocketIfNeeded();
  if (addr != null) {
    msg.address=addr;
    try {
      sendTrapMessage(msg);
    }
 catch (    SnmpTooBigException x) {
      if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
        SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,dbgTag,"sendTrapPdu","Trap pdu is too big. " + "Trap hasn't been sent to " + msg.address);
      }
    }
  }
  closeTrapSocketIfNeeded();
}

private void sendTrapPdu ( InetAddress addr , SnmpPduPacket pdu ) throws SnmpStatusException , IOException { SnmpMessage msg = null ; try { msg = ( SnmpMessage ) pduFactory . encodeSnmpPdu ( pdu , bufferSize ) ; if ( msg == null ) { throw new SnmpStatusException ( SnmpDefinitions . snmpRspAuthorizationError ) ; } } catch ( SnmpTooBigException x ) { if ( SNMP_ADAPTOR_LOGGER . isLoggable ( Level . FINEST ) ) { SNMP_ADAPTOR_LOGGER . logp ( Level . FINEST , dbgTag , "sendTrapPdu" , "Trap pdu is too big. " + "Trap hasn't been sent to the specified host." ) ; } throw new SnmpStatusException ( SnmpDefinitions . snmpRspTooBig ) ; } openTrapSocketIfNeeded ( ) ; if ( addr != null ) { msg . address = addr ; try { sendTrapMessage ( msg ) ; } catch ( SnmpTooBigException x ) { if ( SNMP_ADAPTOR_LOGGER . isLoggable ( Level . FINEST ) ) { SNMP_ADAPTOR_LOGGER . logp ( Level . FINEST , dbgTag , "sendTrapPdu" , "Trap pdu is too big. " + "Trap hasn't been sent to " + msg . address ) ; } } } closeTrapSocketIfNeeded ( ) ; }
send the specified trap pdu to the specified destination .
