Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D5723200BCB for ; Wed, 9 Nov 2016 15:16:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id D4101160AEE; Wed, 9 Nov 2016 14:16:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 28222160AF7 for ; Wed, 9 Nov 2016 15:16:00 +0100 (CET) Received: (qmail 70953 invoked by uid 500); 9 Nov 2016 14:15:59 -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 70928 invoked by uid 99); 9 Nov 2016 14:15:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2016 14:15:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 8EC802C1F54 for ; Wed, 9 Nov 2016 14:15:58 +0000 (UTC) Date: Wed, 9 Nov 2016 14:15:58 +0000 (UTC) From: "Dominik Stadler (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (LANG-1283) RecursiveToStringStyle does not handle nested Maps correctly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 09 Nov 2016 14:16:01 -0000 [ https://issues.apache.org/jira/browse/LANG-1283?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dominik Stadler updated LANG-1283: ---------------------------------- Flags: Patch > RecursiveToStringStyle does not handle nested Maps correctly > ------------------------------------------------------------ > > Key: LANG-1283 > URL: https://issues.apache.org/jira/browse/LANG-1283 > Project: Commons Lang > Issue Type: Bug > Components: lang.builder.* > Affects Versions: 3.4 > Reporter: Dominik Stadler > Attachments: RecursiveToStringTest.java > > > When using {{RecursiveToStringStyle}} to include all member fields of all nested objects, it works for simple Maps, but as soon as I have Maps as values inside another Map, the contents is not included any more, but only a Object.toString() seems to be appended for the objects instead. > A possible fix would be to add the following to RecursiveToStringStyle, although there might be a better way to fix this: > {code} > @Override > protected void appendDetail(StringBuffer buffer, String fieldName, Map map) { > appendClassName(buffer, map); > appendIdentityHashCode(buffer, map); > appendDetail(buffer, fieldName, map.entrySet()); > } > {code} > See the attached unit-test for a reproducer. > Please also note that {{RecursiveToStringStyleTest}} in commons-lang seems to mostly work on the DefaultStyle instead, see https://github.com/apache/commons-lang/blob/master/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java#L38, only one method, {{testPerson()}}, seems to actually do a real test here! -- This message was sent by Atlassian JIRA (v6.3.4#6332)