[ 
https://issues.apache.org/jira/browse/OFBIZ-12801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17713934#comment-17713934
 ] 

Gil Portenseigne commented on OFBIZ-12801:
------------------------------------------

For this case I agree that the fix should be returning success at the end of 
the service implementation.

I personally wondered about success method that can return two different types 
depending of the context (request vs service), and I agree that any groovy 
script implementation using this method are only of one type.

But I think that this particular implementation was intentional to avoid the 
dev to think about being in service or event, and using success() in any 
situation. (same with error method).

Quote of the commit message from Jacopo :
{quote}these helper methods have been enhanced in order to be used by groovy 
method executed as services or events in a transparent way.
{quote}
With that intent in mind, codenarc-disable was set, i'm yet not sure that we 
should remove that intent, that technically do not cause any issue apart from 
having NoDef best practice not respected.

I guess that should be discussed in another Jira / mailing list :)

 

> Error at  CommunicationEventServices.groovy:489 due to OFBIZ-11167
> ------------------------------------------------------------------
>
>                 Key: OFBIZ-12801
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-12801
>             Project: OFBiz
>          Issue Type: Bug
>          Components: projectmgr
>    Affects Versions: Upcoming Branch
>         Environment: 
>            Reporter: Jacques Le Roux
>            Assignee: Jacques Le Roux
>            Priority: Major
>             Fix For: Upcoming Branch
>
>
> I get this error locally:
> The Following Errors Occurred:
> Service dispatcher threw an exception:Error running Groovy method 
> [sendEmailDated] in Groovy file 
> [component://party/groovyScripts/communication/CommunicationEventServices.groovy]:
>  (Cannot cast object '[]' with class 'java.util.ArrayList' to class 
> 'java.util.Map' due to: groovy.lang.GroovyRuntimeException: Could not find 
> matching constructor for: java.util.Map())
> When I replace 
> Map sendEmailDated() {
> by
> def sendEmailDated() {
> The error disappears
> I guess something better can be done, but I have not yet found what :)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to