Originally asked by Paul Schmidt on 20 June 2022 (original question)
As per this documentaion entry, the addComment
method should accept a boolean parameter sync
on the second position. When adding this parameter to an existing script, the synchronization fails.
Incomming sync rule
if(!issue.customFields."Rückfrage an Kunden".value.equals(replica.customFields."Rückfrage an Kunden".value)){
issue.comments = commentHelper.addComment("Es liegt eine neue Rückfrage vor.", false, issue.comments)
// follolwing works
// issue.comments = commentHelper.addComment("Es liegt eine neue Rückfrage vor.", issue.comments)
}
Error
No signature of method: com.exalate.node.hubobject.v1_2.CommentHelper.addComment() is applicable for argument types: (String, Boolean, ArrayList) values: [Es liegt eine neue Rückfrage vor., false, [BasicHubComment{@body=`[^InternalAttachment.txt]`, @id=`32736`, @remoteId=`null`, @author=`{ @key : entwicklung}`, @created=`Tue Jan 19 18:26:23 CET 2021`, @updateAuthor=`{ @key : entwicklung}`, @updated=`Tue Jan 19 18:26:23 CET 2021`, @group=`null`, @role=`null`, @internal= `true`, @executor= `null`}, ...]] Possible solutions: addComment(java.lang.String, java.util.List)
Stack Trace
com.exalate.api.exception.script.ScriptException: No signature of method: com.exalate.node.hubobject.v1_2.CommentHelper.addComment() is applicable for argument types: (String, Boolean, ArrayList) values: [Es liegt eine neue Rückfrage vor., false, [BasicHubComment{@body=`[^InternalAttachment.txt]`, @id=`32736`, @remoteId=`null`, @author=`{ @key : entwicklung}`, @created=`Tue Jan 19 18:26:23 CET 2021`, @updateAuthor=`{ @key : entwicklung}`, @updated=`Tue Jan 19 18:26:23 CET 2021`, @group=`null`, @role=`null`, @internal= `true`, @executor= `null`}, ...]] Possible solutions: addComment(java.lang.String, java.util.List) at com.exalate.error.services.ScriptExceptionCategoryService.categorizeProcessorAndIssueTrackerExceptionsIntoScriptExceptions(ScriptExceptionCategoryService.scala:40) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:57) at com.exalate.processor.jira.JiraChangeIssueProcessor.executeChangeProcessor(JiraChangeIssueProcessor.java:288) at com.exalate.processor.jira.JiraChangeIssueProcessor.changeIssue(JiraChangeIssueProcessor.java:180) at com.exalate.replication.request.UpdateIssueSyncRequestState.transition(UpdateIssueSyncRequestState.java:118) at com.exalate.replication.request.UpdateIssueSyncRequestState.transition(UpdateIssueSyncRequestState.java:36) at com.exalate.replication.in.RequestProcessorService.processSyncRequest(RequestProcessorService.java:391) at com.exalate.replication.in.RequestProcessorService.processSyncRequestsWithPriorities(RequestProcessorService.java:186) at com.exalate.replication.in.RequestProcessorService.processSyncRequests(RequestProcessorService.java:136) at com.exalate.replication.in.RequestWorker.runProcessing(RequestWorker.java:32) at com.exalate.replication.ReplicationWorker.lambda$run$0(ReplicationWorker.java:85) at com.exalate.node.util.concurrent.ClusteredSensitiveExecutorService.lambda$executeHandlingLocks$0(ClusteredSensitiveExecutorService.java:31) at com.exalate.node.util.concurrent.ClusteredSensitiveExecutorService.executeHandlingLocks(ClusteredSensitiveExecutorService.java:52) at com.exalate.node.util.concurrent.ClusteredSensitiveExecutorService.executeHandlingLocks(ClusteredSensitiveExecutorService.java:29) at com.exalate.replication.ReplicationWorker.run(ReplicationWorker.java:78) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) Caused by: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.exalate.node.hubobject.v1_2.CommentHelper.addComment() is applicable for argument types: (String, Boolean, ArrayList) values: [Es liegt eine neue Rückfrage vor., false, [BasicHubComment{@body=`[^InternalAttachment.txt]`, @id=`32736`, @remoteId=`null`, @author=`{ @key : entwicklung}`, @created=`Tue Jan 19 18:26:23 CET 2021`, @updateAuthor=`{ @key : entwicklung}`, @updated=`Tue Jan 19 18:26:23 CET 2021`, @group=`null`, @role=`null`, @internal= `true`, @executor= `null`}, ...]] Possible solutions: addComment(java.lang.String, java.util.List) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:158) at java.scripting/javax.script.AbstractScriptEngine.eval(Unknown Source) at com.exalate.processor.ExalateProcessor.execute(ExalateProcessor.java:98) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:55) ... 19 more Caused by: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.exalate.node.hubobject.v1_2.CommentHelper.addComment() is applicable for argument types: (String, Boolean, ArrayList) values: [Es liegt eine neue Rückfrage vor., false, [BasicHubComment{@body=`[^InternalAttachment.txt]`, @id=`32736`, @remoteId=`null`, @author=`{ @key : entwicklung}`, @created=`Tue Jan 19 18:26:23 CET 2021`, @updateAuthor=`{ @key : entwicklung}`, @updated=`Tue Jan 19 18:26:23 CET 2021`, @group=`null`, @role=`null`, @internal= `true`, @executor= `null`}, ...]] Possible solutions: addComment(java.lang.String, java.util.List) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155) ... 22 more Caused by: groovy.lang.MissingMethodException: No signature of method: com.exalate.node.hubobject.v1_2.CommentHelper.addComment() is applicable for argument types: (String, Boolean, ArrayList) values: [Es liegt eine neue Rückfrage vor., false, [BasicHubComment{@body=`[^InternalAttachment.txt]`, @id=`32736`, @remoteId=`null`, @author=`{ @key : entwicklung}`, @created=`Tue Jan 19 18:26:23 CET 2021`, @updateAuthor=`{ @key : entwicklung}`, @updated=`Tue Jan 19 18:26:23 CET 2021`, @group=`null`, @role=`null`, @internal= `true`, @executor= `null`}, ...]] Possible solutions: addComment(java.lang.String, java.util.List) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:70) at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:143) at Script1.updateIssue(Script1.groovy:31) at Script1.run(Script1.groovy:45) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317) ... 23 more
Target Instance
Jira Service Management 4.20.8, Exalate v. 5.3.4 (Core v. 5.3.7)
From my perspective, this seems to be a bug, but I got asked to post the question here again, as “It turns out to be configuration query”. Can anyone confirm this to be a bug, or do I use the method in the wrong way?
Comments:
M. Ashar Iqbal commented on 20 June 2022
Hi Paul Schmidt ,
Could you please try the following alternative code snippet and let me know if the problem persists?
Please replace this line:
issue.comments = commentHelper.addComment("...", issue.comments)
With this following one:
def comment = commentHelper.addComment("...", []).first()
comment.restrictSync = true
//// but you may also add other properties:
//comment.internal = false
//comment.executor = nodeHelper.getUserByEmail("...")
issue.comments += comment
Thank you,
Ashar
Paul Schmidt commented on 22 June 2022
Hi M. Ashar Iqbal,
I can confirm that your suggestion works.
M. Ashar Iqbal commented on 22 June 2022
Thank you for confirming, Paul Schmidt . I am glad that it worked for you.
Happy Exalating!
Regards,
Ashar