• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Beginnerquestion about if (personName==null || personName.equals(""))
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Beginnerquestion about if (personName==null || personName.equals(""))


  • Subject: Re: Beginnerquestion about if (personName==null || personName.equals(""))
  • From: James Cicenia <email@hidden>
  • Date: Sat, 8 Sep 2007 07:24:19 -0500

Just saying...

But nulls are truly a PITA for me as at least 80% of the bugs I write ;-)
have to do with missing a null check.


You would just think in 2007 myString.equals("something") wouldn't throw
a null pointer and just return false.


I know, I know... "something".equals(myString) doesn't. Yet my fingers
just seem to have a hard time typing it in that way.

c'est la java.

james


On Sep 7, 2007, at 4:27 PM, Cornelius Jaeger wrote:

More precisely

def z = null
z?.doIt()

does not throw a nullpointer, just returns null.
don't know if this is what you got for objective-c but it's still pretty nice.


regards

cornelius


On 07.09.2007, at 22:57, Cornelius Jaeger wrote:

Or use WOGroovy and do it the groovy way:

Groovy has a safe dereference operator ?.
http://groovy.codehaus.org/Null+Object+Pattern

many regards

Cornelius

On 07.09.2007, at 22:00, Kieran Kelleher wrote:

And if you want to save yourself the PITA, just throw in apache commons lang jar into your own foundation framework and use the many useful standardized utilities that are in there:
http://commons.apache.org/lang/


For example check out StringUtilis.isBlank(...) and StringUtils.isEmpty(...) at
http://commons.apache.org/lang/api-release/index.html


regards, Kieran


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40visualfood.ch


This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40jimijon.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Beginnerquestion about if (personName==null || personName.equals(""))
      • From: Mike Schrag <email@hidden>
References: 
 >Beginnerquestion about if (personName==null || personName.equals("")) (From: Rainer User <email@hidden>)
 >Re: Beginnerquestion about if (personName==null || personName.equals("")) (From: Lachlan Deck <email@hidden>)
 >Re: Beginnerquestion about if (personName==null || personName.equals("")) (From: Kieran Kelleher <email@hidden>)
 >Re: Beginnerquestion about if (personName==null || personName.equals("")) (From: Cornelius Jaeger <email@hidden>)
 >Re: Beginnerquestion about if (personName==null || personName.equals("")) (From: Cornelius Jaeger <email@hidden>)

  • Prev by Date: [OT] WebObjects UI designer recommendation
  • Next by Date: Re: Beginnerquestion about if (personName==null || personName.equals(""))
  • Previous by thread: Re: Beginnerquestion about if (personName==null || personName.equals(""))
  • Next by thread: Re: Beginnerquestion about if (personName==null || personName.equals(""))
  • Index(es):
    • Date
    • Thread