Skip to content

Commit

Permalink
Merge pull request #635 from asdf2014/dependabot/maven/org.snmp4j-snm…
Browse files Browse the repository at this point in the history
…p4j-3.7.7

Bump org.snmp4j:snmp4j from 1.10.1 to 3.7.7
  • Loading branch information
asdf2014 authored Aug 21, 2023
2 parents 6ce04a2 + a005f77 commit fa03c65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
<cglib.version>3.2.12</cglib.version>

<!-- snmp4j -->
<snmp4j.version>1.10.1</snmp4j.version>
<snmp4j.version>3.7.7</snmp4j.version>
<snmp4j.agent.version>3.6.7</snmp4j.agent.version>

<!-- log -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import org.snmp4j.*;
import org.snmp4j.asn1.BER;
import org.snmp4j.event.ResponseEvent;
import org.snmp4j.log.Log4jLogFactory;
import org.snmp4j.log.LogFactory;
import org.snmp4j.mp.*;
import org.snmp4j.security.*;
Expand Down Expand Up @@ -259,7 +258,7 @@ public void init(String host, String varBind) {
checkTrapVariables(vbs);
}
address = new UdpAddress(host + "/" + _port);
LogFactory.setLogFactory(new Log4jLogFactory());
LogFactory.setLogFactory(new LogFactory());
BER.setCheckSequenceLength(false);
}

Expand Down Expand Up @@ -543,14 +542,19 @@ public void sendAndProcessResponse() {
private void checkTrapVariables(Vector vbs) {
if ((pduType == PDU.INFORM) || (pduType == PDU.TRAP)) {
if ((vbs.size() == 0)
|| ((vbs.size() > 1)
&& (!((VariableBinding) vbs.get(0)).getOid().equals(SnmpConstants.sysUpTime)))) {
|| ((vbs.size() > 1)
&& (!((VariableBinding) vbs.get(0)).getOid().equals(SnmpConstants.sysUpTime)))) {
vbs.add(0, new VariableBinding(SnmpConstants.sysUpTime, _sysUpTime));
}
if ((vbs.size() == 1) || ((vbs.size() > 2)
&& (!((VariableBinding) vbs.get(1)).getOid().equals(SnmpConstants.snmpTrapOID)))) {
&& (!((VariableBinding) vbs.get(1)).getOid().equals(SnmpConstants.snmpTrapOID)))) {
vbs.add(1, new VariableBinding(SnmpConstants.snmpTrapOID, _trapOID));
}
}
}

@Override
public PDU createPDU(MessageProcessingModel messageProcessingModel) {
return null;
}
}

0 comments on commit fa03c65

Please sign in to comment.