You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Aditya Sharma (JIRA)" <ji...@apache.org> on 2018/12/21 10:38:00 UTC

[jira] [Commented] (OFBIZ-10724) Refactor ServiceUtil.isSuccess(), isError() and isFailure() methods

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

Aditya Sharma commented on OFBIZ-10724:
---------------------------------------

Updated the patch with instances of ServiceUtil methods. Handle other instances in separate tickets if any.

> Refactor ServiceUtil.isSuccess(), isError() and isFailure() methods
> -------------------------------------------------------------------
>
>                 Key: OFBIZ-10724
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10724
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: Trunk
>            Reporter: Aditya Sharma
>            Assignee: Aditya Sharma
>            Priority: Minor
>         Attachments: OFBIZ-10724.patch, OFBIZ-10724.patch
>
>
> Following lines for isSuccess():
> {code:java}
> if (ServiceUtil.isError(results) || ServiceUtil.isFailure(results)) { 
> return false; 
> } 
> return true;
> {code}
> can be changed to
> {code:java}
> return !(ServiceUtil.isError(results) || ServiceUtil.isFailure(results));
> {code}
> Following lines for isFailure():
> {code:java}
> if (results == null || results.get(ModelService.RESPONSE_MESSAGE) == null) {
>     return false;
> }
> return ModelService.RESPOND_FAIL.equals(results.get(ModelService.RESPONSE_MESSAGE));
> {code}
> can be changed to
> {code:java}
> return !(results == null || results.get(ModelService.RESPONSE_MESSAGE) == null) &&
>         ModelService.RESPOND_FAIL.equals(results.get(ModelService.RESPONSE_MESSAGE));{code}
> Following lines for isError():
>  
> {code:java}
> if (results == null || results.get(ModelService.RESPONSE_MESSAGE) == null) {
>     return false;
> }
> return ModelService.RESPOND_ERROR.equals(results.get(ModelService.RESPONSE_MESSAGE));
> {code}
> can be changed to
> {code:java}
> return !(results == null || results.get(ModelService.RESPONSE_MESSAGE) == null) &&
>         ModelService.RESPOND_ERROR.equals(results.get(ModelService.RESPONSE_MESSAGE));
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)