• Community
  • Products
  • Jira
  • Questions
  • No signature of method: com.atlassian.jira.issue.managers.DefaultIssueManager.getIssue() is applicable for argument types: (com.atlassian.jira.issue.IssueImpl) values: [CT-31]

No signature of method: com.atlassian.jira.issue.managers.DefaultIssueManager.getIssue() is applicable for argument types: (com.atlassian.jira.issue.IssueImpl) values: [CT-31]

I'm working on a Script Runner Listener and having problems pulling in the issue key.  What am I missing?

The error is coming from the 

def getIssue=issueManager.getIssue(issueNum)

 

package com.onresolve.jira.groovy.listeners
import com.atlassian.jira.event.issue.AbstractIssueEventListener
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import org.apache.log4j.Category
class myTestListener extends AbstractIssueEventListener {
    Category log = Category.getInstance(myTestListener.class)
    //Set the logging level
    //log.setLevel(org.apache.log4j.Level.DEBUG)
    //log.setLevel(org.apache.log4j.Level.ERROR)
    
    ComponentManager componentManager = ComponentManager.getInstance()
    def customFieldManager = ComponentAccessor.getCustomFieldManager()
    def issueFactory = componentManager.getIssueFactory()
    def issueManager = componentManager.getIssueManager()   
    def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
    @Override
    void workflowEvent(IssueEvent event) {
        Map eventTypes = ComponentManager.getInstance().getEventTypeManager().getEventTypesMap()
        log.debug "Event: \"${eventTypes[event.getEventTypeId()].name}\" fired for ${event.issue} and caught by myTestListener"
        //log.debug "Event issue ${event.issue} ${${event.issue}.getClass()}"
        log.debug "Event type ID - \"${eventTypes[event.getEventTypeId()]}\" fired for ${event.issue} and caught by myTestListener"
        if (eventTypes[event.getEventTypeId()].name == "Issue Assigned"){
            log.debug "Inside if statement" 
            log.debug "Event.Issue = $event.issue"
            
            def issueAssigneeHistory = changeHistoryManager.getChangeItemsForField(event.issue, "Assignee")
            log.debug "issueAssigneeHistory $issueAssigneeHistory"
            def issueNum = event.issue
            def getIssue = issueManager.getIssue(issueNum)
            log.debug "getIssue $getIssue "
            
            log.debug "Before nested if"
            if (issueAssigneeHistory.size() == 0) 
            {
                log.debug ("There have been no assignees")        
                def updateDate = event.issue.getUpdated()
                def assignDate = customFieldManager.getCustomFieldObjectByName("Assigned Date")
                
                def updateValue = updateDate.getValue(getIssue)
                log.debug "updateValue $updateValue"
                if(updateValue) {
                    def timeStamp = updateValue.toTimestamp()
                    getIssue.assignDate = timeStamp   
                    indexManager.reIndex(getIssue)
                    getIssue.store()
                    log.debug "Updated issue $getIssue "                
                }            
            }            
            else
                log.debug "Issue ${event.issue} has already been assigned previously."
            
        }
        else
            log.debug "Not an Issue Assigned Event."
    }
}

Here is the full error minus the stack.  You can see at the end that the issue key is being referenced, but I've obviously missed something.

2014-12-16 16:52:08,009 http-bio-8157-exec-25 ERROR req85518 1012x606x1 1wt3vzf 10.9.96.140,10.8.172.91 /secure/IssueAction.jspa [atlassian.event.internal.AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch event 'com.atlassian.jira.event.issue.IssueEvent@2cce2c2c[issue=CT-31,comment=<null>,worklog=<null>,changelog=[GenericEntity:ChangeGroup][id,30303][author,req*****][created,2014-12-16 16:52:05.933][issue,25033],eventTypeId=3,sendMail=true,params={event=com.atlassian.jira.event.issue.IssueEvent@13b613af[issue=CT-31,comment=<null>,worklog=<null>,changelog=[GenericEntity:ChangeGroup][id,30303][author,req*****][created,2014-12-16 16:52:05.932][issue,25033],eventTypeId=2,sendMail=true,params={eventsource=action, baseurl=https://webcat5.{company}.com/jira},subtasksUpdated=true], issue=CT-31, FIELD_CONDITION=changeItems.any{
    it.get('field')=='assignee'
}, baseurl=https://webcat5.{company}.com/jira, FIELD_EVENT_ID=3},subtasksUpdated=false]' from the invoker 'SingleParameterMethodListenerInvoker{method=public void com.onresolve.jira.groovy.listener.ScriptRunnerUberListener.workflowEvent(com.atlassian.jira.event.issue.IssueEvent), listener=com.onresolve.jira.groovy.listener.ScriptRunnerUberListener@3908bcc5}'.
java.lang.RuntimeException: No signature of method: com.atlassian.jira.issue.managers.DefaultIssueManager.getIssue() is applicable for argument types: (com.atlassian.jira.issue.IssueImpl) values: [CT-31]
Possible solutions: getIssue(java.lang.Long), getIssue(java.lang.String), getIssues(java.util.Collection)

1 answer

1 accepted

1 vote

"No signature of method" means you are passing a variable into a function that does not accept the type of variable you've put in.

In this case, getIssue() is expecting a long (issue's id in the database), a string (the key of the issue), or a collection (I think that's a collection of longs or strings) representing a set of issues.

You're effectively passing in event.issue, which is an issue object, not an ID or Key.

 

What Nic said. You don't need to get the issue, you already have it.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,189 views 13 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot