Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 27234 invoked from network); 12 Nov 2007 20:33:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Nov 2007 20:33:17 -0000 Received: (qmail 53335 invoked by uid 500); 12 Nov 2007 20:33:02 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 53245 invoked by uid 500); 12 Nov 2007 20:33:02 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 53107 invoked by uid 99); 12 Nov 2007 20:33:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Nov 2007 12:33:01 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Nov 2007 20:33:58 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id E0ABF714233 for ; Mon, 12 Nov 2007 12:32:50 -0800 (PST) Message-ID: <145807.1194899570918.JavaMail.jira@brutus> Date: Mon, 12 Nov 2007 12:32:50 -0800 (PST) From: "Ben Speakmon (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (LANG-360) Why does appendIdentityToString return null? In-Reply-To: <12224872.1192969370591.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LANG-360?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel#action_12541940 ]=20 Ben Speakmon commented on LANG-360: ----------------------------------- Looks good. +1. > Why does appendIdentityToString return null? > -------------------------------------------- > > Key: LANG-360 > URL: https://issues.apache.org/jira/browse/LANG-360 > Project: Commons Lang > Issue Type: Bug > Reporter: J=C3=B6rg Gottschling > Fix For: 2.4 > > Attachments: LANG-360.patch, LANG-360.patch > > > ObjectUtils is designed to handle null imputs gracefully. But ObjectUtils= .appendIdentityToString does not. It returns null unnessecary if you pass n= ull als second parameter (the object to get the identity from). For example= appendIdentityToString(new StringBuffer(), null) will return null! Which i= s an uncommen behaviour. Think about code like this: > ObjectUtils.appendIdentityToString(buffer, param1) > .appendIdentityToString(buffer, param2) > .appendIdentityToString(buffer, param3); > This will cause an NPE if param1 or param2 ist null. There may be other c= ode where a NPE will not happen, but the code is used for debugging and the= re will be an unexpected or wrong output. > So you shoul return the StringBuffer which is passed in or a new one if n= ull. The harder question is what to do with the object. I think we should a= ppend "null" to the StringBuffer, because this is what I would expect and w= hat the passed reference is. --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.