Return-Path: X-Original-To: apmail-struts-user-archive@www.apache.org Delivered-To: apmail-struts-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 223E37F1A for ; Mon, 19 Dec 2011 21:14:00 +0000 (UTC) Received: (qmail 2860 invoked by uid 500); 19 Dec 2011 21:13:57 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 2824 invoked by uid 500); 19 Dec 2011 21:13:57 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 2816 invoked by uid 99); 19 Dec 2011 21:13:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Dec 2011 21:13:57 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [65.42.26.133] (HELO exfilt6admin.aoins.com) (65.42.26.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Dec 2011 21:13:52 +0000 X-WSS-ID: 0LWGYYD-02-A4Z-02 X-M-MSG: Received: from exfilt4.aoins.com (exfilt4.aoins.com [10.244.15.6]) by exfilt6admin.aoins.com (Postfix) with ESMTP id 2A21D1F98AE3 for ; Mon, 19 Dec 2011 16:13:24 -0500 (EST) Received: from [10.7.3.104] by exfilt4.aoins.com with SMTP (Auto-Owners Insurance SMTP Relay); Mon, 19 Dec 2011 16:15:04 -0500 X-Server-Uuid: 19282996-6C9C-487B-A5E5-630340B352C5 Received: from EXC-HT01.aoins.com ([10.7.3.164]) by ExchMB4.aoins.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 19 Dec 2011 16:12:31 -0500 Received: from EXC-MB02.aoins.com ([::1]) by EXC-HT01.aoins.com ([::1]) with mapi id 14.01.0289.001; Mon, 19 Dec 2011 16:12:31 -0500 From: "Biesbrock, Kevin" To: "'Struts Users Mailing List'" Subject: RE: BigDecimal type conversion Thread-Topic: BigDecimal type conversion Thread-Index: Acy+i+B4UEUtoNE7QIKX1WKkh0i2EwAKkWoAAAmyJlA= Date: Mon, 19 Dec 2011 21:12:31 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.7.13.107] MIME-Version: 1.0 X-OriginalArrivalTime: 19 Dec 2011 21:12:31.0384 (UTC) FILETIME=[EB956180:01CCBE92] X-WSS-ID: 62F176D22LO142377-09-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Excellent! Thank you, Beez P.S. No response on the "bug" comment. Out of curiosity, what is the reason= for overriding such trimming as seen by the parent class? Any idea? -----Original Message----- From: Dave Newton [mailto:davelnewton@gmail.com]=20 Sent: Monday, December 19, 2011 3:25 PM To: Struts Users Mailing List Subject: Re: BigDecimal type conversion Either a type convertor, or an interceptor that trims everything. d. On Dec 19, 2011 3:23 PM, "Biesbrock, Kevin" wrote: > Our application is rolling with Struts 2.2.1. > > One action class implements ModelDriven and in the model we have a=20 > Map; where we rolled a custom type=20 > converter for BusinessObjectA and BusinessObjectB has a BigDecimal.=20 > This model has been in production for well over 4 months with no=20 > issue; that is, until someone recently added a space to the end of the=20 > related input field, e.g., "54 " (quotes added for emphasis). > > This causes=20 > com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter to fail here: > > 402 if (toType =3D=3D BigDecimal.class) { > 403 return new BigDecimal((String) value); > > ...seemingly because it doesn't trim prior to creating a new BigDecimal. > > > 1. I feel like 403 should be calling bigDecValue(value, true) like > the parent in > com.opensymphony.xwork2.conversion.impl.DefaultTypeConverter.convertVa > lue() > > 139 if (toType =3D=3D BigDecimal.class) > 140 result =3D bigDecValue(value); > > If #1 sounds like a candidate for a bug report, I would be happy to=20 > report it if provided the appropriate url to post to. > > > 2. Our temporary solution will be to roll our own BigDecimal type > converter so we can .trim() the string passed into the=20 > constructor(String) > > Does #2 sound like the best solution? Do you have a more efficient or=20 > less "custom" approach? > > Thank you for your time, > Kevin Biesbrock > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org