Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-13085

Worklog Service should not allow lightweight issues to be passed in and persistened. It wrecks the index view of the world

    XMLWordPrintable

Details

    Description

      While tested code for this issue

      http://jira.atlassian.com/browse/JRA-13057

      I found that if I pass in a DocumentIssueImpl to the worklog service, it readily takes it and updates the backend issue however the side effect is that the indexes get wrecked. The Issue is light weight and does not have the information that the index needs is missing.

      The Worklog service should either "convert the light weight issue" into a real one. OR throw a runtime / validation exception because its not a real MutableIssue.

      User user = context.getUser();
              try
              {
                  searchResults = searchProvider.search(request, user, pagerFilter);
                  List issues = searchResults.getIssues();
                  for (Iterator it = issues.iterator(); it.hasNext();)
                  {
                      Issue issue = (Issue) it.next();
      
      
                      JiraServiceContext jiraServiceContext = new JiraServiceContextImpl(user);
                      WorklogService worklogService = (WorklogService) ComponentManager.getComponentInstanceOfType(WorklogService.class);
                      worklogService.hasPermissionToCreate(jiraServiceContext, issue);
                      
                      Worklog worklog = worklogService.validateCreate(jiraServiceContext, issue, "1h", new Date(), "Comment", null, null);
                      worklogService.createAndRetainRemainingEstimate(jiraServiceContext, worklog, true);
      
                  }
              }
              catch (Throwable e)
              {
                  e.printStackTrace();
                  throw new RuntimeException(e);
              }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            bbaker ɹǝʞɐq pɐɹq
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified