Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Custom field issue during indexing

Roy Chapman
Contributor
July 28, 2015

We have found this issue during indexing.  It points to a custom field that uses the Groovy Runner.  The field is scripted as follows

 

def templateType = getCustomFieldValue("Template Type").value;
def multiplier = (templateType == "NEQL"
? 500
: (templateType == "N+"
? 100
: 0));

def estimate = multiplier * issue.getOriginalEstimate() / 3600;

return String.format( '%,d', estimate as int);

This is the error generated by the reindex process.  Any pointers?

2015-07-22 12:55:23,775 JiraTaskExectionThread-1 INFO chapmar 775x103x1 mmgxax 127.0.0.1 /secure/admin/IndexReIndex.jspa [jira.util.index.CompositeIndexLifecycleManager] Reindex All starting...
2015-07-22 12:55:23,823 JiraTaskExectionThread-1 INFO chapmar 775x103x1 mmgxax 127.0.0.1 /secure/admin/IndexReIndex.jspa [action.admin.index.IndexAdminImpl] Re-indexing is 0% complete. Current index: Issue
2015-07-22 12:55:23,871 JiraTaskExectionThread-1 INFO chapmar 775x103x1 mmgxax 127.0.0.1 /secure/admin/IndexReIndex.jspa [jira.issue.index.DefaultIndexManager] Reindexing: {indexIssues=true, indexChangeHistory=true, indexComments=true, indexWorklogs=true}
2015-07-22 12:55:49,759 IssueIndexer:thread-2 INFO chapmar 775x103x1 mmgxax 127.0.0.1 /secure/admin/IndexReIndex.jspa [action.admin.index.IndexAdminImpl] Re-indexing is 1% complete. Current index: Issue
2015-07-22 12:55:52,690 IssueIndexer:thread-8 ERROR chapmar 775x103x1 mmgxax 127.0.0.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] *************************************************************************************
2015-07-22 12:55:52,694 IssueIndexer:thread-8 ERROR chapmar 775x103x1 mmgxax 127.0.0.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] Script field failed on issue: UDR-15, field: Estimated Cost
groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.lang.Integer#multiply.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
        [class java.lang.Character]
        [class java.lang.Number]
        at Script2.run(Script2.groovy:8)
.....
2015-07-22 13:31:55,467 IssueIndexer:thread-10 INFO chapmar 775x103x1 mmgxax 127.0.0.1 /secure/admin/IndexReIndex.jspa [action.admin.index.IndexAdminImpl] Re-indexing is 98% complete. Current index: Issue

 

Regards,

 

Roy

2 answers

1 accepted

3 votes
Answer accepted
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 28, 2015

I'd change line 8 (approx) to:

def estimate = multiplier * (issue.getOriginalEstimate() ?: 0 ) / 3600

Your problem is the overloaded operator "*" can be applied to either Characters, Numbers or Strings etc, so if issue.originalEstimate is null groovy doesn't know which to pick.

The pitfalls of dynamic typing... 


0 votes
Roy Chapman
Contributor
July 31, 2015

Perfect, resolved issue

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events