addMOValueValidationListener is no use for DateAndTime

Hi Frank,
Below code are auto-generated with AgenPro.
But I find the validators added are not used.
This is due to the ‘validate’ method in class DateAndTime overrides that in class MOMutableColumn.

Do you have any suggestion for this? I need to add my own validators in ‘PktcEScTapMediationTimeoutValidator()’.

pktcEScTapMediationEntryColumns[idxPktcEScTapMediationTimeout] = new DateAndTime(colPktcEScTapMediationTimeout,
            moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_CREATE), (OctetString) null
        // --AgentGen BEGIN=pktcEScTapMediationTimeout::auxInit
        // --AgentGen END
        ValueConstraint pktcEScTapMediationTimeoutVC = new ConstraintsImpl();
        ((ConstraintsImpl) pktcEScTapMediationTimeoutVC).add(new Constraint(8L, 8L));
        ((ConstraintsImpl) pktcEScTapMediationTimeoutVC).add(new Constraint(11L, 11L));
        ((MOMutableColumn) pktcEScTapMediationEntryColumns[idxPktcEScTapMediationTimeout])
            .addMOValueValidationListener(new ValueConstraintValidator(pktcEScTapMediationTimeoutVC));
        ((MOMutableColumn) pktcEScTapMediationEntryColumns[idxPktcEScTapMediationTimeout])
            .addMOValueValidationListener(new PktcEScTapMediationTimeoutValidator());

     * The <code>PktcEScTapMediationTimeoutValidator</code> implements the value validation for
     * <code>PktcEScTapMediationTimeout</code>.
    static class PktcEScTapMediationTimeoutValidator implements MOValueValidationListener {

        public void validate(MOValueValidationEvent validationEvent) {
            Variable newValue = validationEvent.getNewValue();
            OctetString os = (OctetString) newValue;
            if (!(((os.length() >= 8) && (os.length() <= 8)) || ((os.length() >= 11) && (os.length() <= 11)))) {
            // --AgentGen BEGIN=pktcEScTapMediationTimeout::validate
            OctetString cur = DateAndTime.makeDateAndTime(new GregorianCalendar());
            if (newValue.compareTo(cur) < 0) {
            // --AgentGen END

That the DateAndTime.validate method hides the super class method execution is a bug and will be fixed with SNMP4J-Agent 3.3.0 as follows:

public synchronized int validate(T newValue, T oldValue) {
    int result = validateDateAndTime(newValue);
    if (result == SnmpConstants.SNMP_ERROR_SUCCESS) {
        result = super.validate(newValue, oldValue);
    return result;

Thus, the custom MOValueValidationListener will be called only when the (basic) DateAndTime validation is OK.

SNMP4J-Agent 3.3.0 has been released. Release Notes will follow later at the Announcement catagory…

Get it. Thanks Frank for the update.

Hi Frank,
Will there be Java 8 based version released fort this issue?

Yes, I am working on it…