Description
Hello,
I use a rule to assign disabled date on a membership.
My configuration :
ruleActAsSubjectId admin_grouper
ruleThenEnum assignMembershipDisabledDaysForOwnerGroupId
ruleActAsSubjectSourceId ldapAdmin
ruleThenEnumArg0 365
ruleCheckType membershipAdd
ruleValid T
ruleThenEnumArg1 F
But, when i try this, the disabled date is set to 22/09/2013 and not to 05/09/2014 (+365 days).
I think, the problem is located in RuleElUtils class in the method assignMembershipDisabledDaysForGroupId.
More specifically, this line : membership.setDisabledTime(new Timestamp(System.currentTimeMillis() + (daysInFuture * 24 * 60 * 60 * 1000)));
daysInFuture is an integer, so Java think that the result of daysInFuture * 24 * 60 * 60 * 1000 will be an Integer too. But with daysInFuture = 365, the result is too large for an integer.
i think, the problem can be resolve if we add (long) just before daysInFuture :
membership.setDisabledTime(new Timestamp(System.currentTimeMillis() + ((long)daysInFuture * 24 * 60 * 60 * 1000)));
Am i correct ?
Thanks for your help
Yoann.