Uploaded image for project: 'Jira Platform Cloud'
  1. Jira Platform Cloud
  2. JRACLOUD-66261

Ofbiz and business layer piercing: manipulating directly the ofbiz GenericValue on time-tracking.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Low Low
    • None

      I don't know if this is a bug or a feature (thanks for the FUG thing!) but we found recently something quite disturbing to us.

      DefaultTimeTrackingIssueUpdater manipulates the 'timespent' at the issue generic value level, e.g.

      issueGV.set("timespent", totalTimeSpent); 
      

      (line 66, line 100, etc)

      In the same time, at the issue level, 'timespent' eludes the normal updates from the issue generic value, as it can be easily seen here, in the IssueImpl:

          public Long getTimeSpent()
          {
              return timespent;
          }
      
          public void setTimeSpent(Long timespent)
          {
              this.timespent = timespent;
              updateGV(IssueFieldConstants.TIME_SPENT, timespent);
          }
      

      This allows very easily to have 'unsynchronized' issue fields and time-tracking information in the worklogs. The normal way would be for the issue to receive updates directly from the TimeTrackingIssueUpdater implementation.

      In our opinion this is wrong since this layer piercing (this is how I call it, don't know if it's the proper term) represents a potential source of many bugs.

      ===
      If you need a test case, let us know.

      ===
      Edit: The test case.

      Place the postfunctions as seen in the attached image: the one that adds to the WL first and the one that only prints the issue field last (choose a transition, my favorite is 'Start Progress').

      Execute 1 1/2 cycles on a newly created issue: Start->Stop->Start

      Output in the logs:

      [jira.plugins.tests.AddWL] BEFORE ADDING THE WORKLOG: TimeSpent = 0 [1]
      [jira.plugins.tests.AddWL] ADDED THE WORKLOG: TimeSpent = 0, compare with remTSpent=0 [2]
      [jira.plugins.tests.ShowWL] LATE POST-FUNCTION: TimeSpent = 0 [3]
      [jira.plugins.tests.AddWL] BEFORE ADDING THE WORKLOG: TimeSpent = 3600 [1]
      [jira.plugins.tests.AddWL] ADDED THE WORKLOG: TimeSpent = 3600, compare with remTSpent=3600 [2]
      [jira.plugins.tests.ShowWL] LATE POST-FUNCTION: TimeSpent = 3600 [3]
      

      Now, the problem is that it remains the same... [2] should add already 3600 seconds on each cycle, i.e. should be:

      [jira.plugins.tests.AddWL] BEFORE ADDING THE WORKLOG: TimeSpent = 0 [1]
      [jira.plugins.tests.AddWL] ADDED THE WORKLOG: TimeSpent = 3600, compare with remTSpent=0 [2]
      [jira.plugins.tests.ShowWL] LATE POST-FUNCTION: TimeSpent = 3600 [3]
      [jira.plugins.tests.AddWL] BEFORE ADDING THE WORKLOG: TimeSpent = 3600 [1]
      [jira.plugins.tests.AddWL] ADDED THE WORKLOG: TimeSpent = 7200, compare with remTSpent=3600 [2]
      [jira.plugins.tests.ShowWL] LATE POST-FUNCTION: TimeSpent = 7200 [3]
      

        1. tests_postfunctionorder.png
          tests_postfunctionorder.png
          45 kB
        2. tests.tar.gz
          540 kB
        3. tests-1.0.jar
          7 kB

              Unassigned Unassigned
              6a61a34ba2d6 Radu Dumitriu
              Votes:
              2 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: