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

UnsupportedOperationException with hasPermissionToCreate when called with DocumentIssueImpl

    XMLWordPrintable

Details

    Description

      Extending the SearchRequestPortlet for Kaamelot Portlet, I use WorklogService.hasPermissionToCreate(JiraServiceContext jiraServiceContext, Issue issue) .
      As SearchRequestPortlet provides through its SearchProvider a list of Issue based on class DocumentIssueImpl, the hasPermissionToCreate() fails with follow stacktrace.

      2007-07-11 11:28:24,944 http-8080-Processor24 ERROR [com.atlassian.velocity.DefaultVelocityManager] MethodInvocationException occurred getting message body from Velocity: java.lang.UnsupportedOperationException: This code or velocity template expects a GenericValue, but received an Issue.  We need to recode
      java.lang.UnsupportedOperationException: This code or velocity template expects a GenericValue, but received an Issue.  We need to recode
      	at com.atlassian.jira.issue.DocumentIssueImpl.getString(DocumentIssueImpl.java:306)
      	at com.atlassian.jira.workflow.SimpleWorkflowManager.isEditable(SimpleWorkflowManager.java:482)
      	at com.atlassian.jira.issue.managers.DefaultIssueManager.isEditable(DefaultIssueManager.java:348)
      	at sun.reflect.GeneratedMethodAccessor149.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:585)
      	at com.atlassian.util.profiling.object.ObjectProfiler.profiledInvoke(ObjectProfiler.java:71)
      	at com.atlassian.jira.config.component.SwitchingInvocationHandler.invoke(SwitchingInvocationHandler.java:28)
      	at $Proxy3.isEditable(Unknown Source)
      	at com.atlassian.jira.bc.issue.worklog.DefaultWorklogService.isIssueInEditableWorkflowState(DefaultWorklogService.java:514)
      	at com.atlassian.jira.bc.issue.worklog.DefaultWorklogService.hasPermissionToCreate(DefaultWorklogService.java:342)
      

      DocumentIssueImpl throws UnsupportedOperationException on getString() call done by SimpleWorkflowManager.isEditable(Issue issue).

      In SimpleWorkflowManager.isEditable(Issue issue), the retrieve of StatusId ..

      final String status = issue.getString("status");

      should be done as follow :

      final String status = issue.getStatusObject().getId();

      Attachments

        Activity

          People

            Unassigned Unassigned
            5d77aaa81033 Vincent Thoulé
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

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