From user-return-216063-apmail-struts-user-archive=struts.apache.org@struts.apache.org Fri Apr 4 06:58:58 2014 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 E0F44103F8 for ; Fri, 4 Apr 2014 06:58:57 +0000 (UTC) Received: (qmail 92545 invoked by uid 500); 4 Apr 2014 06:58:55 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 92323 invoked by uid 500); 4 Apr 2014 06:58:55 -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 92314 invoked by uid 99); 4 Apr 2014 06:58:53 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Apr 2014 06:58:53 +0000 Received: from localhost (HELO mail-yk0-f177.google.com) (127.0.0.1) (smtp-auth username lukaszlenart, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Apr 2014 06:58:52 +0000 Received: by mail-yk0-f177.google.com with SMTP id q200so2539393ykb.8 for ; Thu, 03 Apr 2014 23:58:51 -0700 (PDT) X-Received: by 10.236.116.131 with SMTP id g3mr8822859yhh.110.1396594731519; Thu, 03 Apr 2014 23:58:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.170.75.131 with HTTP; Thu, 3 Apr 2014 23:58:31 -0700 (PDT) In-Reply-To: <533E556D.50405@mtg.de> References: <533D279C.90807@mtg.de> <533E556D.50405@mtg.de> From: Lukasz Lenart Date: Fri, 4 Apr 2014 08:58:31 +0200 Message-ID: Subject: Re: Not calling setters when callchaining into fields and using complex type, bug or feature? To: Struts Users Mailing List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable You mean in EnumTypeConverter? Or in DefaultTypeConverter? 2014-04-04 8:47 GMT+02:00 Fabian Richter : > Yeah, I was having Converters for both types, AND DifferentComplexType is= an > enum. > > The problem was, in the converters convertFromString method the > enum.valueOf() should have thrown an IllegalArgumentException when callin= g > it with an emtpy String "" but instead, just the conversion silently fail= ed > and the value didnt get set. > > Not sure this is "as designed" thats up to you guys, but I solved it by > handling "" explicitly. > > Thanks for your support! > > Am 04.04.2014 07:16, schrieb Lukasz Lenart: >> >> Do you have converters for ComplexType and DifferentComplexType >> registered? >> >> 2014-04-03 11:19 GMT+02:00 Fabian Richter : >>> >>> Hey, >>> >>> not sure this is a Bug or a Feature, but I ran into the following >>> troubles, >>> someone might be able to explain: >>> >>> class ComplexType { >>> private DifferentComplexType test; >>> >>> public void setTest(DifferentComplexType test){ >>> this.test =3D test; >>> } >>> public DifferentComplexType getTest(){ >>> return this.test; >>> } >>> } >>> >>> In an action class I have >>> >>> private ComplexType field; >>> >>> public ComplexType getField(){ >>> return this.field; >>> } >>> >>> public void setField(ComplexType field){ >>> this.field =3D field; >>> } >>> >>> Now in this Action, I am setting "test" with a >> key=3D"field.test" headerKey=3D"" headerValue=3D"Undefined" /> >>> >>> But when I want to null it, by selecting the header entry "Undefined", >>> Struts is not calling getField().setTest() its not changing "test" in >>> "field" at all. >>> >>> When I add to my action >>> >>> public DifferentComplexType getTest(){ >>> return this.field.getTest(); >>> } >>> >>> public void setTest(DifferentComplexType test){ >>> this.field.setTest(test); >>> } >>> >>> and change the to use key=3D"test" it works like a charm. >>> >>> Is that how its supposed to be? If so, why? >>> >>> Thank you for explaining! >>> >>> Best >>> Fabian >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org >> For additional commands, e-mail: user-help@struts.apache.org >> > > -- > media transfer AG > > Fabian Richter, M.Sc. > Softwareentwickler > > Mail: frichter@mtg.de > Telefon: +49 6151 8193-24 > Telefax: +49 6151 8193-43 > Web: http://www.mtg.de > > Firmensitz: Dolivostra=C3=9Fe 11, 64293 Darmstadt > Registergericht: Amtsgericht Darmstadt, HRB 8901 > Vorstand: J=C3=BCrgen Ruf (Vors.), Tamer Kemer=C3=B6z > Aufsichtsratsvorsitzender: Dr. Thomas Milde > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org