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 butnullautoritativeEngineID. - Fixed: Possible deadlock in TaskScheduler.run() if the underlying ThreadPool is fully busy and additional tasks are added.
- Added:
PduBuildernow implementsPDUFactory, so aPduBuilderinstance can be passed wherever an SNMP4J API expects aPDUFactory. The newPduBuilder.build(int messageProcessingModel)andPduBuilder.initPdu(PDU)methods allow aPDUto 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(), ordtls()) before returning aTargetBuilder. - Added:
SnmpBuilder.version(String)andTargetBuilder.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) afterbuild()has been called. Operations that replace already-configured state -counterSupport(..),securityProtocols(..), andthreads(..)- remain rejected even in incremental mode.SnmpBuildernow throws anIllegalStateExceptionfor reconfiguration afterbuild()unless incremental mode has been enabled before thatbuild()call. - Added:
TargetBuilder.DirectUserBuilder.auth(String)andpriv(String)overloads that resolve authentication and privacy protocols from canonical names (case-insensitive, hyphens ignored), e.g. “SHA-256”, “SHA256”, or “hmac192sha256”. AnIllegalArgumentExceptionis thrown for unknown names. - Added: TargetBuilder.DirectUserBuilder.authKey(byte) and privKey(byte) to configure a
DirectUserTargetwith pre-localized authentication and privacy keys directly (passphrases still override provided keys). - Added:
OID.getPrefix(OID suffix)which returns the prefix of thisOIDif it ends with the given suffix, otherwise null. Useful to derive a columnOIDfrom a row instanceOID. - Added:
VariableBinding(String oidOrName, String variableText)constructor that parses theOIDfrom either a dotted string or an object name (whenSNMP4JSettings.getOIDTextFormat()is set). - Added:
SMIConstants.TABLE_ENTRY_SUFFIX(= 1) constant representing the SMI-definedOIDsuffix 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 theTreeListeneris signalled finished. - Changed:
AbstractVariable.getSyntaxFromString(String)now throwsIllegalArgumentExceptionfor unknown syntax names. The previous behaviour silently returnedBER.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, andVariableTextFormat.AbstractVariable.registerSyntaxes()andVariantVariableuse modernised Java idioms (enhanced for-loop, final field). - Added:
SimpleOIDTextFormatTestunit test that verifies parsing of embedded-string OID indexes (e.g. “‘notify3’”).