Hello community,
There are lots of places in code where we have used UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue object . GenericValue is never empty. Its always null or not null. So should we use directly null or not null check instead of UtilValidate.isNotEmpty() and UtilValidate.isEmpty() for GenericValue objects ? Basically these validation methods should preferably be used on Strings or Lists and normal Maps. Thanks!! Regards, Ratnesh Upadhyay HotWax Systems | www.hotwaxsystems.com |
I agree, it's easy et native to compare a null value instead of call a
UtilValidate.isEmpty() method Nicolas Le 17/06/2016 16:30, Ratnesh Upadhyay a écrit : > Hello community, > > There are lots of places in code where we have used > UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue object > . GenericValue is never empty. Its always null or not null. So should we > use directly null or not null check instead of UtilValidate.isNotEmpty() > and UtilValidate.isEmpty() for GenericValue objects ? > > Basically these validation methods should preferably be used on Strings or > Lists and normal Maps. > > Thanks!! > > Regards, > Ratnesh Upadhyay > HotWax Systems | www.hotwaxsystems.com > |
In reply to this post by Ratnesh Upadhyay-2
+1
Best regards, Pranay Pandey HotWax Systems http://www.hotwaxsystems.com/ On Fri, Jun 17, 2016 at 8:00 PM, Ratnesh Upadhyay < [hidden email]> wrote: > Hello community, > > There are lots of places in code where we have used > UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue object > . GenericValue is never empty. Its always null or not null. So should we > use directly null or not null check instead of UtilValidate.isNotEmpty() > and UtilValidate.isEmpty() for GenericValue objects ? > > Basically these validation methods should preferably be used on Strings or > Lists and normal Maps. > > Thanks!! > > Regards, > Ratnesh Upadhyay > HotWax Systems | www.hotwaxsystems.com > |
Makes sense to me. If we can simply do the null check, then we should not
use UtilValidate.isNotEmpty() and increase the overhead. +1 On Sat, Jun 18, 2016 at 10:13 AM, Pranay Pandey < [hidden email]> wrote: > +1 > > Best regards, > > Pranay Pandey > HotWax Systems > http://www.hotwaxsystems.com/ > > On Fri, Jun 17, 2016 at 8:00 PM, Ratnesh Upadhyay < > [hidden email]> wrote: > > > Hello community, > > > > There are lots of places in code where we have used > > UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue > object > > . GenericValue is never empty. Its always null or not null. So should we > > use directly null or not null check instead of UtilValidate.isNotEmpty() > > and UtilValidate.isEmpty() for GenericValue objects ? > > > > Basically these validation methods should preferably be used on Strings > or > > Lists and normal Maps. > > > > Thanks!! > > > > Regards, > > Ratnesh Upadhyay > > HotWax Systems | www.hotwaxsystems.com > > > -- Regards, Mohammad Kathawala Technical Consultant / Team Lead, Hotwax Systems, [hidden email] <[hidden email]> |
In reply to this post by Ratnesh Upadhyay-2
+1
Thanks & Regards, -- Amardeep Singh Jhajj On Fri, Jun 17, 2016 at 8:00 PM, Ratnesh Upadhyay < [hidden email]> wrote: > Hello community, > > There are lots of places in code where we have used > UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue object > . GenericValue is never empty. Its always null or not null. So should we > use directly null or not null check instead of UtilValidate.isNotEmpty() > and UtilValidate.isEmpty() for GenericValue objects ? > > Basically these validation methods should preferably be used on Strings or > Lists and normal Maps. > > Thanks!! > > Regards, > Ratnesh Upadhyay > HotWax Systems | www.hotwaxsystems.com > |
In reply to this post by Ratnesh Upadhyay-2
Completely makes sense.
+1 -- Thanks and Regards, Devanshu Vyas HotWax Systems *https://www.hotwaxsystems.com <https://www.hotwaxsystems.com>* On Fri, Jun 17, 2016 at 8:00 PM, Ratnesh Upadhyay < [hidden email]> wrote: > Hello community, > > There are lots of places in code where we have used > UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue object > . GenericValue is never empty. Its always null or not null. So should we > use directly null or not null check instead of UtilValidate.isNotEmpty() > and UtilValidate.isEmpty() for GenericValue objects ? > > Basically these validation methods should preferably be used on Strings or > Lists and normal Maps. > > Thanks!! > > Regards, > Ratnesh Upadhyay > HotWax Systems | www.hotwaxsystems.com > |
I agree, we have to start using null check for generic value.
Thanks & Regards -- Deepak Dixit www.hotwaxsystems.com On Sat, Jun 18, 2016 at 11:16 AM, Devanshu Vyas < [hidden email]> wrote: > Completely makes sense. > > +1 > > > -- > Thanks and Regards, > Devanshu Vyas > > HotWax Systems > *https://www.hotwaxsystems.com <https://www.hotwaxsystems.com>* > > On Fri, Jun 17, 2016 at 8:00 PM, Ratnesh Upadhyay < > [hidden email]> wrote: > > > Hello community, > > > > There are lots of places in code where we have used > > UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue > object > > . GenericValue is never empty. Its always null or not null. So should we > > use directly null or not null check instead of UtilValidate.isNotEmpty() > > and UtilValidate.isEmpty() for GenericValue objects ? > > > > Basically these validation methods should preferably be used on Strings > or > > Lists and normal Maps. > > > > Thanks!! > > > > Regards, > > Ratnesh Upadhyay > > HotWax Systems | www.hotwaxsystems.com > > > |
In reply to this post by Ratnesh Upadhyay-2
+1
Michael Brohl ecomify GmbH www.ecomify.de Am 17.06.16 um 16:30 schrieb Ratnesh Upadhyay: > Hello community, > > There are lots of places in code where we have used > UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue object > . GenericValue is never empty. Its always null or not null. So should we > use directly null or not null check instead of UtilValidate.isNotEmpty() > and UtilValidate.isEmpty() for GenericValue objects ? > > Basically these validation methods should preferably be used on Strings or > Lists and normal Maps. > > Thanks!! > > Regards, > Ratnesh Upadhyay > HotWax Systems | www.hotwaxsystems.com > smime.p7s (5K) Download Attachment |
I think we can make it part of best practice and use for new code.
For old code, Do we need to change existing code? Thanks & Regards -- Deepak Dixit www.hotwaxsystems.com On Sat, Jun 18, 2016 at 1:36 PM, Michael Brohl <[hidden email]> wrote: > +1 > > Michael Brohl > ecomify GmbH > www.ecomify.de > > > Am 17.06.16 um 16:30 schrieb Ratnesh Upadhyay: > > Hello community, >> >> There are lots of places in code where we have used >> UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue >> object >> . GenericValue is never empty. Its always null or not null. So should we >> use directly null or not null check instead of UtilValidate.isNotEmpty() >> and UtilValidate.isEmpty() for GenericValue objects ? >> >> Basically these validation methods should preferably be used on Strings or >> Lists and normal Maps. >> >> Thanks!! >> >> Regards, >> Ratnesh Upadhyay >> HotWax Systems | www.hotwaxsystems.com >> >> > > |
Yes Deepak, IMO we should change it for existing code as well, because this
type of checks some times cause functional issues on null checks on GenericValue. My vote will be to go for it. Best regards, Pranay Pandey HotWax Systems http://www.hotwaxsystems.com/ On Sat, Jun 18, 2016 at 3:09 PM, Deepak Dixit < [hidden email]> wrote: > I think we can make it part of best practice and use for new code. > For old code, Do we need to change existing code? > > Thanks & Regards > -- > Deepak Dixit > www.hotwaxsystems.com > > On Sat, Jun 18, 2016 at 1:36 PM, Michael Brohl <[hidden email]> > wrote: > > > +1 > > > > Michael Brohl > > ecomify GmbH > > www.ecomify.de > > > > > > Am 17.06.16 um 16:30 schrieb Ratnesh Upadhyay: > > > > Hello community, > >> > >> There are lots of places in code where we have used > >> UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue > >> object > >> . GenericValue is never empty. Its always null or not null. So should we > >> use directly null or not null check instead of UtilValidate.isNotEmpty() > >> and UtilValidate.isEmpty() for GenericValue objects ? > >> > >> Basically these validation methods should preferably be used on Strings > or > >> Lists and normal Maps. > >> > >> Thanks!! > >> > >> Regards, > >> Ratnesh Upadhyay > >> HotWax Systems | www.hotwaxsystems.com > >> > >> > > > > > |
Administrator
|
And also because else people tends to reproduce by C/P blocks of code
Jacques Le 18/06/2016 à 12:21, Pranay Pandey a écrit : > Yes Deepak, IMO we should change it for existing code as well, because this > type of checks some times cause functional issues on null checks on > GenericValue. > > My vote will be to go for it. > > Best regards, > > Pranay Pandey > HotWax Systems > http://www.hotwaxsystems.com/ > > On Sat, Jun 18, 2016 at 3:09 PM, Deepak Dixit < > [hidden email]> wrote: > >> I think we can make it part of best practice and use for new code. >> For old code, Do we need to change existing code? >> >> Thanks & Regards >> -- >> Deepak Dixit >> www.hotwaxsystems.com >> >> On Sat, Jun 18, 2016 at 1:36 PM, Michael Brohl <[hidden email]> >> wrote: >> >>> +1 >>> >>> Michael Brohl >>> ecomify GmbH >>> www.ecomify.de >>> >>> >>> Am 17.06.16 um 16:30 schrieb Ratnesh Upadhyay: >>> >>> Hello community, >>>> There are lots of places in code where we have used >>>> UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue >>>> object >>>> . GenericValue is never empty. Its always null or not null. So should we >>>> use directly null or not null check instead of UtilValidate.isNotEmpty() >>>> and UtilValidate.isEmpty() for GenericValue objects ? >>>> >>>> Basically these validation methods should preferably be used on Strings >> or >>>> Lists and normal Maps. >>>> >>>> Thanks!! >>>> >>>> Regards, >>>> Ratnesh Upadhyay >>>> HotWax Systems | www.hotwaxsystems.com >>>> >>>> >>> |
In reply to this post by Ratnesh Upadhyay-2
+1
-- Kind Regards Ashish Vijaywargiya HotWax Systems - est. 1997 On Fri, Jun 17, 2016 at 8:00 PM, Ratnesh Upadhyay < [hidden email]> wrote: > Hello community, > > There are lots of places in code where we have used > UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue object > . GenericValue is never empty. Its always null or not null. So should we > use directly null or not null check instead of UtilValidate.isNotEmpty() > and UtilValidate.isEmpty() for GenericValue objects ? > > Basically these validation methods should preferably be used on Strings or > Lists and normal Maps. > > Thanks!! > > Regards, > Ratnesh Upadhyay > HotWax Systems | www.hotwaxsystems.com > |
In reply to this post by Pranay Pandey-3
+1
-- Kind Regards Ashish Vijaywargiya HotWax Systems - est. 1997 On Sat, Jun 18, 2016 at 3:51 PM, Pranay Pandey < [hidden email]> wrote: > Yes Deepak, IMO we should change it for existing code as well, because this > type of checks some times cause functional issues on null checks on > GenericValue. > > My vote will be to go for it. > > Best regards, > > Pranay Pandey > HotWax Systems > http://www.hotwaxsystems.com/ > > On Sat, Jun 18, 2016 at 3:09 PM, Deepak Dixit < > [hidden email]> wrote: > > > I think we can make it part of best practice and use for new code. > > For old code, Do we need to change existing code? > > > > Thanks & Regards > > -- > > Deepak Dixit > > www.hotwaxsystems.com > > > > On Sat, Jun 18, 2016 at 1:36 PM, Michael Brohl <[hidden email] > > > > wrote: > > > > > +1 > > > > > > Michael Brohl > > > ecomify GmbH > > > www.ecomify.de > > > > > > > > > Am 17.06.16 um 16:30 schrieb Ratnesh Upadhyay: > > > > > > Hello community, > > >> > > >> There are lots of places in code where we have used > > >> UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue > > >> object > > >> . GenericValue is never empty. Its always null or not null. So should > we > > >> use directly null or not null check instead of > UtilValidate.isNotEmpty() > > >> and UtilValidate.isEmpty() for GenericValue objects ? > > >> > > >> Basically these validation methods should preferably be used on > Strings > > or > > >> Lists and normal Maps. > > >> > > >> Thanks!! > > >> > > >> Regards, > > >> Ratnesh Upadhyay > > >> HotWax Systems | www.hotwaxsystems.com > > >> > > >> > > > > > > > > > |
In reply to this post by Jacques Le Roux
Big +1 :-)
-- Kind Regards Ashish Vijaywargiya HotWax Systems - est. 1997 On Sat, Jun 18, 2016 at 5:19 PM, Jacques Le Roux < [hidden email]> wrote: > And also because else people tends to reproduce by C/P blocks of code > > Jacques > > > > Le 18/06/2016 à 12:21, Pranay Pandey a écrit : > >> Yes Deepak, IMO we should change it for existing code as well, because >> this >> type of checks some times cause functional issues on null checks on >> GenericValue. >> >> My vote will be to go for it. >> >> Best regards, >> >> Pranay Pandey >> HotWax Systems >> http://www.hotwaxsystems.com/ >> >> On Sat, Jun 18, 2016 at 3:09 PM, Deepak Dixit < >> [hidden email]> wrote: >> >> I think we can make it part of best practice and use for new code. >>> For old code, Do we need to change existing code? >>> >>> Thanks & Regards >>> -- >>> Deepak Dixit >>> www.hotwaxsystems.com >>> >>> On Sat, Jun 18, 2016 at 1:36 PM, Michael Brohl <[hidden email] >>> > >>> wrote: >>> >>> +1 >>>> >>>> Michael Brohl >>>> ecomify GmbH >>>> www.ecomify.de >>>> >>>> >>>> Am 17.06.16 um 16:30 schrieb Ratnesh Upadhyay: >>>> >>>> Hello community, >>>> >>>>> There are lots of places in code where we have used >>>>> UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue >>>>> object >>>>> . GenericValue is never empty. Its always null or not null. So should >>>>> we >>>>> use directly null or not null check instead of >>>>> UtilValidate.isNotEmpty() >>>>> and UtilValidate.isEmpty() for GenericValue objects ? >>>>> >>>>> Basically these validation methods should preferably be used on Strings >>>>> >>>> or >>> >>>> Lists and normal Maps. >>>>> >>>>> Thanks!! >>>>> >>>>> Regards, >>>>> Ratnesh Upadhyay >>>>> HotWax Systems | www.hotwaxsystems.com >>>>> >>>>> >>>>> >>>> > |
In reply to this post by Jacques Le Roux
+ Jacques.
Best regards, Pranay Pandey HotWax Systems http://www.hotwaxsystems.com/ On Sat, Jun 18, 2016 at 5:19 PM, Jacques Le Roux < [hidden email]> wrote: > And also because else people tends to reproduce by C/P blocks of code > > Jacques > > > > Le 18/06/2016 à 12:21, Pranay Pandey a écrit : > >> Yes Deepak, IMO we should change it for existing code as well, because >> this >> type of checks some times cause functional issues on null checks on >> GenericValue. >> >> My vote will be to go for it. >> >> Best regards, >> >> Pranay Pandey >> HotWax Systems >> http://www.hotwaxsystems.com/ >> >> On Sat, Jun 18, 2016 at 3:09 PM, Deepak Dixit < >> [hidden email]> wrote: >> >> I think we can make it part of best practice and use for new code. >>> For old code, Do we need to change existing code? >>> >>> Thanks & Regards >>> -- >>> Deepak Dixit >>> www.hotwaxsystems.com >>> >>> On Sat, Jun 18, 2016 at 1:36 PM, Michael Brohl <[hidden email] >>> > >>> wrote: >>> >>> +1 >>>> >>>> Michael Brohl >>>> ecomify GmbH >>>> www.ecomify.de >>>> >>>> >>>> Am 17.06.16 um 16:30 schrieb Ratnesh Upadhyay: >>>> >>>> Hello community, >>>> >>>>> There are lots of places in code where we have used >>>>> UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue >>>>> object >>>>> . GenericValue is never empty. Its always null or not null. So should >>>>> we >>>>> use directly null or not null check instead of >>>>> UtilValidate.isNotEmpty() >>>>> and UtilValidate.isEmpty() for GenericValue objects ? >>>>> >>>>> Basically these validation methods should preferably be used on Strings >>>>> >>>> or >>> >>>> Lists and normal Maps. >>>>> >>>>> Thanks!! >>>>> >>>>> Regards, >>>>> Ratnesh Upadhyay >>>>> HotWax Systems | www.hotwaxsystems.com >>>>> >>>>> >>>>> >>>> > |
+1 Jacques.
Best regards, Pranay Pandey HotWax Systems http://www.hotwaxsystems.com/ On Mon, Jun 20, 2016 at 11:35 AM, Pranay Pandey < [hidden email]> wrote: > + Jacques. > > Best regards, > > Pranay Pandey > HotWax Systems > http://www.hotwaxsystems.com/ > > On Sat, Jun 18, 2016 at 5:19 PM, Jacques Le Roux < > [hidden email]> wrote: > >> And also because else people tends to reproduce by C/P blocks of code >> >> Jacques >> >> >> >> Le 18/06/2016 à 12:21, Pranay Pandey a écrit : >> >>> Yes Deepak, IMO we should change it for existing code as well, because >>> this >>> type of checks some times cause functional issues on null checks on >>> GenericValue. >>> >>> My vote will be to go for it. >>> >>> Best regards, >>> >>> Pranay Pandey >>> HotWax Systems >>> http://www.hotwaxsystems.com/ >>> >>> On Sat, Jun 18, 2016 at 3:09 PM, Deepak Dixit < >>> [hidden email]> wrote: >>> >>> I think we can make it part of best practice and use for new code. >>>> For old code, Do we need to change existing code? >>>> >>>> Thanks & Regards >>>> -- >>>> Deepak Dixit >>>> www.hotwaxsystems.com >>>> >>>> On Sat, Jun 18, 2016 at 1:36 PM, Michael Brohl < >>>> [hidden email]> >>>> wrote: >>>> >>>> +1 >>>>> >>>>> Michael Brohl >>>>> ecomify GmbH >>>>> www.ecomify.de >>>>> >>>>> >>>>> Am 17.06.16 um 16:30 schrieb Ratnesh Upadhyay: >>>>> >>>>> Hello community, >>>>> >>>>>> There are lots of places in code where we have used >>>>>> UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue >>>>>> object >>>>>> . GenericValue is never empty. Its always null or not null. So should >>>>>> we >>>>>> use directly null or not null check instead of >>>>>> UtilValidate.isNotEmpty() >>>>>> and UtilValidate.isEmpty() for GenericValue objects ? >>>>>> >>>>>> Basically these validation methods should preferably be used on >>>>>> Strings >>>>>> >>>>> or >>>> >>>>> Lists and normal Maps. >>>>>> >>>>>> Thanks!! >>>>>> >>>>>> Regards, >>>>>> Ratnesh Upadhyay >>>>>> HotWax Systems | www.hotwaxsystems.com >>>>>> >>>>>> >>>>>> >>>>> >> > |
In reply to this post by Ratnesh Upadhyay-2
+1, good idea thanks Ratnesh
Regards Scott On 18 June 2016 at 02:30, Ratnesh Upadhyay <[hidden email]> wrote: > Hello community, > > There are lots of places in code where we have used > UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue object > . GenericValue is never empty. Its always null or not null. So should we > use directly null or not null check instead of UtilValidate.isNotEmpty() > and UtilValidate.isEmpty() for GenericValue objects ? > > Basically these validation methods should preferably be used on Strings or > Lists and normal Maps. > > Thanks!! > > Regards, > Ratnesh Upadhyay > HotWax Systems | www.hotwaxsystems.com > |
Thanks everyone for your valuable inputs on it. I'll create logical sub
tickets to establish this practice in OFBiz. Regards, Ratnesh Upadhyay HotWax Systems | www.hotwaxsystems.com On Mon, Jun 20, 2016 at 3:04 PM, Scott Gray <[hidden email]> wrote: > +1, good idea thanks Ratnesh > > Regards > Scott > > On 18 June 2016 at 02:30, Ratnesh Upadhyay <[hidden email]> > wrote: > > > Hello community, > > > > There are lots of places in code where we have used > > UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue > object > > . GenericValue is never empty. Its always null or not null. So should we > > use directly null or not null check instead of UtilValidate.isNotEmpty() > > and UtilValidate.isEmpty() for GenericValue objects ? > > > > Basically these validation methods should preferably be used on Strings > or > > Lists and normal Maps. > > > > Thanks!! > > > > Regards, > > Ratnesh Upadhyay > > HotWax Systems | www.hotwaxsystems.com > > > |
See Jira issue OFBIZ-4427 https://issues.apache.org/jira/browse/OFBIZ-4427.
Ratnesh is absolutely right. UtilValidate.isEmpty and ...isNotEmpty should only be used in places where "emptiness" is relevant. They should not be used when all that is needed is == null or != null . The issue has a patch that is now quite old, and a couple of unresolved questions. On 24 June 2016 at 00:24, Ratnesh Upadhyay <[hidden email]> wrote: > Thanks everyone for your valuable inputs on it. I'll create logical sub > tickets to establish this practice in OFBiz. > > Regards, > Ratnesh Upadhyay > HotWax Systems | www.hotwaxsystems.com > > On Mon, Jun 20, 2016 at 3:04 PM, Scott Gray <[hidden email]> > wrote: > > > +1, good idea thanks Ratnesh > > > > Regards > > Scott > > > > On 18 June 2016 at 02:30, Ratnesh Upadhyay <[hidden email]> > > wrote: > > > > > Hello community, > > > > > > There are lots of places in code where we have used > > > UtilValidate.isNotEmpty() or UtilValidate.isEmpty() for GenericValue > > object > > > . GenericValue is never empty. Its always null or not null. So should > we > > > use directly null or not null check instead of > UtilValidate.isNotEmpty() > > > and UtilValidate.isEmpty() for GenericValue objects ? > > > > > > Basically these validation methods should preferably be used on Strings > > or > > > Lists and normal Maps. > > > > > > Thanks!! > > > > > > Regards, > > > Ratnesh Upadhyay > > > HotWax Systems | www.hotwaxsystems.com > > > > > > -- Coherent Software Australia Pty Ltd PO Box 2773 Cheltenham Vic 3192 Australia Phone: +61 3 9585 6788 Web: http://www.coherentsoftware.com.au/ Email: [hidden email]
--
Coherent Software Australia Pty Ltd http://www.coherentsoftware.com.au/ Bonsai ERP, the all-inclusive ERP system http://www.bonsaierp.com.au/ |
Free forum by Nabble | Edit this page |