SNMP4J 3.11.0 Release

SNMP4J v3.11.0 released 2026-06-04T22:00:00Z with many improvements regarding the org.snmp4j.fluent package to make Target and PDU creation more user and “AI friendly”.
Important fixes are included as well:

  • TargetBuilder.done() causing NPE on deferred localisation
  • Possible deadlock in TaskScheduler.run()

CHANGES

  • Fixed: TargetBuilder.done() caused NPE for targets with deferred localization but null autoritativeEngineID.
  • Fixed: Possible deadlock in TaskScheduler.run() if the underlying ThreadPool is fully busy and additional tasks are added.
  • Added: PduBuilder now implements PDUFactory, so a PduBuilder instance can be passed wherever an SNMP4J API expects a PDUFactory. The new PduBuilder.build(int messageProcessingModel) and PduBuilder.initPdu(PDU) methods allow a PDU to be created for an explicit message processing model and configured with the previously supplied builder parameters (context engine ID, context name, type, variable bindings).
  • Added: SnmpBuilder.targetWithTransport(Address) which inspects the supplied target address and automatically adds a matching transport mapping (udp(), tcp(), tls(), or dtls()) before returning a TargetBuilder.
  • Added: SnmpBuilder.version(String) and TargetBuilder.version(SnmpVersion)/TargetBuilder.version(String) to select the SNMP protocol version (“v1”, “v2c”, “v3”) from a string argument.
  • Added: SnmpBuilder.allowIncrementalConfigAfterBuild() opt-in mode that permits additive configuration calls (transport mappings, message processing models, security models, security protocols) after build() has been called. Operations that replace already-configured state - counterSupport(..), securityProtocols(..), and threads(..) - remain rejected even in incremental mode. SnmpBuilder now throws an IllegalStateException for reconfiguration after build() unless incremental mode has been enabled before that build() call.
  • Added: TargetBuilder.DirectUserBuilder.auth(String) and priv(String) overloads that resolve authentication and privacy protocols from canonical names (case-insensitive, hyphens ignored), e.g. “SHA-256”, “SHA256”, or “hmac192sha256”. An IllegalArgumentException is thrown for unknown names.
  • Added: TargetBuilder.DirectUserBuilder.authKey(byte) and privKey(byte) to configure a DirectUserTarget with pre-localized authentication and privacy keys directly (passphrases still override provided keys).
  • Added: OID.getPrefix(OID suffix) which returns the prefix of this OID if it ends with the given suffix, otherwise null. Useful to derive a column OID from a row instance OID.
  • Added: VariableBinding(String oidOrName, String variableText) constructor that parses the OID from either a dotted string or an object name (when SNMP4JSettings.getOIDTextFormat() is set).
  • Added: SMIConstants.TABLE_ENTRY_SUFFIX (= 1) constant representing the SMI-defined OID suffix of a table entry.
  • Added: TreeUtils.setMaxVariableBindingsToReturn(int) / getMaxVariableBindingsToReturn() to cap the total number of variable bindings returned during a subtree walk. Zero (the default) disables the cap. When the cap is reached the walk is terminated and the TreeListener is signalled finished.
  • Changed: AbstractVariable.getSyntaxFromString(String) now throws IllegalArgumentException for unknown syntax names. The previous behaviour silently returned BER.NULL, which masked configuration mistakes.
  • Improved: JavaDoc typo, grammar, and formatting fixes across Snmp, OID, OctetString, SecretOctetString, AbstractVariable, Variable, VariableBinding, VariantVariable, SimpleOIDTextFormat, TableUtils, TreeEvent, TreeUtils, and VariableTextFormat. AbstractVariable.registerSyntaxes() and VariantVariable use modernised Java idioms (enhanced for-loop, final field).
  • Added: SimpleOIDTextFormatTest unit test that verifies parsing of embedded-string OID indexes (e.g. “‘notify3’”).
1 Like