[jira] [Commented] (OFBIZ-11064) Use Groovy Truth instead of UtilValidate Class in Groovy
[ https://issues.apache.org/jira/browse/OFBIZ-11064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16848923#comment-16848923 ] Pawan Verma commented on OFBIZ-11064: - Thanks, [~jacques.le.roux]! > Use Groovy Truth instead of UtilValidate Class in Groovy > > > Key: OFBIZ-11064 > URL: https://issues.apache.org/jira/browse/OFBIZ-11064 > Project: OFBiz > Issue Type: Improvement > Components: ALL COMPONENTS >Affects Versions: Trunk >Reporter: Pawan Verma >Assignee: Jacques Le Roux >Priority: Minor > Fix For: Upcoming Branch > > Attachments: OFBIZ-11064-plugins.patch, OFBIZ-11064.patch, > OFBIZ-11064.patch > > > As we all know, Groovy is a powerful language with great built-in functions. > Groovy Truth[1] is one of them, which is not used properly in our code base. > We have used UtilValidate Class to validate arguments for Empty or NotEmpty, > which can easily be done in groovy with built-in functionality. > > Current Code: if (UtilValidate.isNotEmpty(locations)) \{ ... } > > Groovy Built-in Code: if (locations) \{ ... } > > IMO, We should use this Groovy Truth feature instead of UtilValidate Class. > Please let me know your thoughts on this. Thanks! > [1] - [http://groovy-lang.org/semantics.html#Groovy-Truth] > > We need to careful for some points while we change this: > Like: > maxRetry = 0 > if (!maxRetry) { > // Not set, use a default > maxRetry = -1 > } > Because groovy evaluates zero to be false, it wouldn't be possible to set > maxRetry to zero. So it's best not to use groovy truth for null-checks on > numbers in some cases. > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OFBIZ-11064) Use Groovy Truth instead of UtilValidate Class in Groovy
[ https://issues.apache.org/jira/browse/OFBIZ-11064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16848384#comment-16848384 ] Pawan Verma commented on OFBIZ-11064: - Thanks, [~jacques.le.roux] for the review. My bad! I have updated the patch. Thanks! > Use Groovy Truth instead of UtilValidate Class in Groovy > > > Key: OFBIZ-11064 > URL: https://issues.apache.org/jira/browse/OFBIZ-11064 > Project: OFBiz > Issue Type: Improvement > Components: ALL COMPONENTS >Affects Versions: Trunk >Reporter: Pawan Verma >Assignee: Pawan Verma >Priority: Minor > Attachments: OFBIZ-11064-plugins.patch, OFBIZ-11064.patch, > OFBIZ-11064.patch > > > As we all know, Groovy is a powerful language with great built-in functions. > Groovy Truth[1] is one of them, which is not used properly in our code base. > We have used UtilValidate Class to validate arguments for Empty or NotEmpty, > which can easily be done in groovy with built-in functionality. > > Current Code: if (UtilValidate.isNotEmpty(locations)) \{ ... } > > Groovy Built-in Code: if (locations) \{ ... } > > IMO, We should use this Groovy Truth feature instead of UtilValidate Class. > Please let me know your thoughts on this. Thanks! > [1] - [http://groovy-lang.org/semantics.html#Groovy-Truth] > > We need to careful for some points while we change this: > Like: > maxRetry = 0 > if (!maxRetry) { > // Not set, use a default > maxRetry = -1 > } > Because groovy evaluates zero to be false, it wouldn't be possible to set > maxRetry to zero. So it's best not to use groovy truth for null-checks on > numbers in some cases. > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OFBIZ-11064) Use Groovy Truth instead of UtilValidate Class in Groovy
[ https://issues.apache.org/jira/browse/OFBIZ-11064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16848223#comment-16848223 ] Jacques Le Roux commented on OFBIZ-11064: - Thanks Pawan, Only spotted in [^OFBIZ-11064.patch] {code:java} - if (UtilValidate.isEmpty(webApps)) { + if (webApps) { {code} > Use Groovy Truth instead of UtilValidate Class in Groovy > > > Key: OFBIZ-11064 > URL: https://issues.apache.org/jira/browse/OFBIZ-11064 > Project: OFBiz > Issue Type: Improvement > Components: ALL COMPONENTS >Affects Versions: Trunk >Reporter: Pawan Verma >Assignee: Pawan Verma >Priority: Minor > Attachments: OFBIZ-11064-plugins.patch, OFBIZ-11064.patch > > > As we all know, Groovy is a powerful language with great built-in functions. > Groovy Truth[1] is one of them, which is not used properly in our code base. > We have used UtilValidate Class to validate arguments for Empty or NotEmpty, > which can easily be done in groovy with built-in functionality. > > Current Code: if (UtilValidate.isNotEmpty(locations)) \{ ... } > > Groovy Built-in Code: if (locations) \{ ... } > > IMO, We should use this Groovy Truth feature instead of UtilValidate Class. > Please let me know your thoughts on this. Thanks! > [1] - [http://groovy-lang.org/semantics.html#Groovy-Truth] > > We need to careful for some points while we change this: > Like: > maxRetry = 0 > if (!maxRetry) { > // Not set, use a default > maxRetry = -1 > } > Because groovy evaluates zero to be false, it wouldn't be possible to set > maxRetry to zero. So it's best not to use groovy truth for null-checks on > numbers in some cases. > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OFBIZ-11064) Use Groovy Truth instead of UtilValidate Class in Groovy
[ https://issues.apache.org/jira/browse/OFBIZ-11064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16848130#comment-16848130 ] Pawan Verma commented on OFBIZ-11064: - Attached patch for this improvement. I have kept precaution while doing this work. Please have a look into the patch. Thanks! > Use Groovy Truth instead of UtilValidate Class in Groovy > > > Key: OFBIZ-11064 > URL: https://issues.apache.org/jira/browse/OFBIZ-11064 > Project: OFBiz > Issue Type: Improvement > Components: ALL COMPONENTS >Affects Versions: Trunk >Reporter: Pawan Verma >Assignee: Pawan Verma >Priority: Minor > Attachments: OFBIZ-11064-plugins.patch, OFBIZ-11064.patch > > > As we all know, Groovy is a powerful language with great built-in functions. > Groovy Truth[1] is one of them, which is not used properly in our code base. > We have used UtilValidate Class to validate arguments for Empty or NotEmpty, > which can easily be done in groovy with built-in functionality. > > Current Code: if (UtilValidate.isNotEmpty(locations)) \{ ... } > > Groovy Built-in Code: if (locations) \{ ... } > > IMO, We should use this Groovy Truth feature instead of UtilValidate Class. > Please let me know your thoughts on this. Thanks! > [1] - [http://groovy-lang.org/semantics.html#Groovy-Truth] > > We need to careful for some points while we change this: > Like: > maxRetry = 0 > if (!maxRetry) { > // Not set, use a default > maxRetry = -1 > } > Because groovy evaluates zero to be false, it wouldn't be possible to set > maxRetry to zero. So it's best not to use groovy truth for null-checks on > numbers in some cases. > -- This message was sent by Atlassian JIRA (v7.6.3#76005)