Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1581119AEE for ; Fri, 25 Mar 2016 20:37:26 +0000 (UTC) Received: (qmail 76290 invoked by uid 500); 25 Mar 2016 20:37:25 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 76198 invoked by uid 500); 25 Mar 2016 20:37:25 -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 76186 invoked by uid 99); 25 Mar 2016 20:37:25 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Mar 2016 20:37:25 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 694292C14DC for ; Fri, 25 Mar 2016 20:37:25 +0000 (UTC) Date: Fri, 25 Mar 2016 20:37:25 +0000 (UTC) From: "Mauricio (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (BEANUTILS-485) BeanUtils.setProperty set wrong newValue for a DynaBean with a Map Property MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Mauricio created BEANUTILS-485: ---------------------------------- Summary: BeanUtils.setProperty set wrong newValue for a DynaBean with a Map Property Key: BEANUTILS-485 URL: https://issues.apache.org/jira/browse/BEANUTILS-485 Project: Commons BeanUtils Issue Type: Bug Components: Bean / Property Utils Affects Versions: 1.9.2, 1.9.1, 1.9.0 Reporter: Mauricio After 1.8.3 this stop to work and my legacy Struts 1.x application starting to have bugs... :( Before was String.... now is String array ? Why ? public class BeanUtilsTest { @Test public void testSetPropertyBeanUtils183_ok_butFailOn192() throws Exception { String[] value = { "odd" }; DynaBean dynaForm = createForm(); String propertyName = "mapProperty(one)"; BeanUtils.setProperty(dynaForm, propertyName, value); @SuppressWarnings("unchecked") Map retrived = (Map) dynaForm .get("mapProperty"); // on bean utils 1.7.0, 1.8.0 ... 1.8.3 is OK assertThat(retrived.get("one"), instanceOf(String.class)); assertThat(retrived.get("one"), equalTo((Object) "odd")); // after 1.9.0 ... 1.9.2 is the problem... // assertThat(retrived.get("one"), instanceOf(String[].class)); } private static DynaBean createForm() { DynaClass dynaClass = new BasicDynaClass("MyForm", null, new DynaProperty[] { new DynaProperty("mapProperty", java.util.HashMap.class) }); try { DynaBean p = dynaClass.newInstance(); // initialize p.set("mapProperty", new HashMap<>()); return p; } catch (IllegalAccessException | InstantiationException ex) { throw new RuntimeException(ex); } } -- This message was sent by Atlassian JIRA (v6.3.4#6332)