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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-10724?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aditya Sharma updated OFBIZ-10724:
----------------------------------
    Attachment: OFBIZ-10724.patch

> 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)