[
https://issues.apache.org/jira/browse/OFBIZ-7310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jacques Le Roux closed OFBIZ-7310.
----------------------------------
Resolution: Done
Done at revision: 1747976
> Use UtilValidate.isEmpty() instead of length() <= 0
> ----------------------------------------------------
>
> Key: OFBIZ-7310
> URL: https://issues.apache.org/jira/browse/OFBIZ-7310
> Project: OFBiz
> Issue Type: Improvement
> Components: ALL COMPONENTS
> Affects Versions: Trunk
> Reporter: Jacques Le Roux
> Assignee: Jacques Le Roux
> Priority: Trivial
> Fix For: Upcoming Branch
>
>
> While reviewing Wai's patch for OFBIZ-7112 I noticed that he (re)used this
> pattern introduced earlier:
> {code}
> (resource == null || resource.length() <= 0)
> {code}
> From Java spec. a String, Collection, Map or CharSequence can't have a
> negative length, so the pattern above can be reduced to
> {code}
> (resource == null || resource.length() == 0)
> {code}
> which can be replaced using
> {code}
> UtilValidate.isEmpty()
> {code}
> I checked, there are several other occurrences of this pattern (some very
> old, I guess most were routinely copied from an initial occurrence). I
> decided to replace all of them.
> I did that already long ago for the
> {code}
> (resource == null || resource.length() == 0)
> {code}
> pattern. It remains 4 of them. Three are justified (because of the dependency
> on base component or because using isEmpty() on Object is disputable for
> performance reasons). I'll took care of the remaining one right away!
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)