Multiplication operation overflows for ISO8601 week durations >3

XMLWordPrintable

    • Type: Bug Report
    • Resolution: Fixed
    • Priority: L3 - Default
    • 7.15.0-alpha3, 7.15.0
    • Affects Version/s: 7.14.0
    • Component/s: engine
    • None
    • Environment:
      Camunda Tomcat 7.14 Docker image (running on Windows)

      Steps to reproduce

      1. Deploy a BPMN model with a timer duration start event with the definition P4W
      2. Check the due date of the timer job

      Observed behavior

      The due date is wrong.

      Expected behavior

      The due date is exactly 4 weeks in the future from the creation date.

      Root cause

      1. {DurationHelper}} has a constant MS_PER_WEEK which is an int: 7 * 24 * 60 * 60 * 1000 = 604.800.000
      2. The weeks from the expression are parsed into an int
      3. The weeks are multiplied with the MS_PER_WEEK
        • 604.800.000 * 3 Weeks = 1.814.400.000 => fits into an int
        • 604.800.000 * 4 Weeks = 2.419.200.000 => does not fit into an int (>2.147.483.647)
      4. The multiplication operation overflows and a negative value is returned which is passed to DatatypeFactory#newDuration

      Solution

      Force multiplication to result in a long by converting at least one factor into a long.

            Assignee:
            Tassilo Weidner-Mühl
            Reporter:
            Michael Martinsen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: