Uploaded image for project: 'Grouper'
  1. Grouper
  2. GRP-931

Rule : problem with ruleThenEnum assignMembershipDisabledDaysForOwnerGroupId wraps integer limit needs long

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • 2.1.6
    • 2.1.5
    • API
    • None

    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.

      Attachments

        Activity

          People

            chris.hyzer@at.internet2.edu Chris Hyzer (upenn.edu)
            chris.hyzer@at.internet2.edu Chris Hyzer (upenn.edu)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: