Return-Path: Delivered-To: apmail-commons-dev-archive@www.apache.org Received: (qmail 27205 invoked from network); 9 Apr 2009 08:44:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Apr 2009 08:44:12 -0000 Received: (qmail 92841 invoked by uid 500); 9 Apr 2009 08:44:12 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 92720 invoked by uid 500); 9 Apr 2009 08:44:11 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 92710 invoked by uid 99); 9 Apr 2009 08:44:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Apr 2009 08:44:11 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of flamefew@gmail.com designates 209.85.218.167 as permitted sender) Received: from [209.85.218.167] (HELO mail-bw0-f167.google.com) (209.85.218.167) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Apr 2009 08:44:03 +0000 Received: by bwz11 with SMTP id 11so513220bwz.42 for ; Thu, 09 Apr 2009 01:43:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=ft3DTGg5RvLWtWPnbdeX0umG5Fo1N338FSeMSLyVOW8=; b=tjcN1Wql3g9y+Pb1PgmyRNZEf7aIhqZuk36pCB9ozOQbacg431tVK3acwZ0Yhp2Wni mFEDpsLTMnHMlyxtggOFTaDyy6fs5WAKDFk/Bk4DJk8u9Ncw26MrHuIxKifkJlp4nhcE q091HhgXeYXfruCuspLgfTcVr7WhoGAG7qE/M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=s6oEyNXbqUxYvB4VjjQ/nzpNrhvC5uqu27Fox6dDzrBxHJjOeslvJMFTd0CocwNIrr 5AmzVimZ/3BBnz2HIw7JSmM0nFOWW/XinexJaEthvPRIfD9SdAuQoB+QglMnDiKd24/M Mt48b9ol6suY8P/4E0cbIzBiCsW45N0aQ9mIA= MIME-Version: 1.0 Received: by 10.223.105.16 with SMTP id r16mr654173fao.24.1239266623153; Thu, 09 Apr 2009 01:43:43 -0700 (PDT) Date: Thu, 9 Apr 2009 01:43:43 -0700 Message-ID: <31cc37360904090143x43975f41qecf40d4f6bbdeef5@mail.gmail.com> Subject: [LANG] Null-protection methods From: Henri Yandell To: Commons Developers List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Is the following worth keeping in Lang? public Foo someJdkMethod(Object input) { if(input == null) { handleAccordingly(); } return input.jdkMethod(); } I feel that we've bloated up with these methods, and is it really worth it? I still have lots of if(x != null && x.callFoo()) type invocations, having a small handful of methods available in Lang to let me say if(FooUtils.callFoo(x)) isn't enough to hide all of the other times when I might have to worry about it. Personally I'd like to see these methods removed from Lang [especially given Stephen's blogging about null protected setting in some future JVM]. An example: public static String trim(String str) { return str == null ? null : str.trim(); } Given that I'm likely to do N things to the string, chances are I'll check for null up front and then invoke methods rather than repeatedly writing ugly code by using StringUtils. Any thoughts in favour of these methods? Hen --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org