Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 410 invoked from network); 28 Jan 2004 02:17:09 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 28 Jan 2004 02:17:09 -0000 Received: (qmail 40774 invoked by uid 500); 28 Jan 2004 02:16:43 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 40736 invoked by uid 500); 28 Jan 2004 02:16:43 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 40684 invoked from network); 28 Jan 2004 02:16:42 -0000 Received: from unknown (HELO unxcoms01.ecnetwork.co.nz) (202.135.116.201) by daedalus.apache.org with SMTP; 28 Jan 2004 02:16:42 -0000 Received: from serpent.ecnetwork.co.nz (serpent [202.135.190.10]) by unxcoms01.ecnetwork.co.nz (8.12.8/8.12.8) with ESMTP id i0RLquIx011473 for ; Wed, 28 Jan 2004 10:52:56 +1300 Received: from pcsimon.ecnnz.ecnetwork.co.nz (unknown [202.135.190.30]) by serpent.ecnetwork.co.nz (Postfix) with ESMTP id 1AC7C1035 for ; Wed, 28 Jan 2004 09:58:06 +1200 (NZST) Subject: Re: [digester] Set attribute in a static class From: Simon Kitching Reply-To: simon@ecnetwork.co.nz To: Jakarta Commons Users List In-Reply-To: <3956B7121A30D411850800508B9A5EE001AE5111@novarrainet1.internalnt.novarra.com> References: <3956B7121A30D411850800508B9A5EE001AE5111@novarrainet1.internalnt.novarra.com> Content-Type: text/plain Organization: The Electronic Commerce Network Ltd. Message-Id: <1075240346.7321.33.camel@pcsimon.ecnnz.ecnetwork.co.nz> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5-2.norlug Date: Wed, 28 Jan 2004 10:52:27 +1300 Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N On Wed, 2004-01-28 at 05:09, Samuel Cheung wrote: > Hi, > > I would like to use Digester to set attribute in my static class. > So I create my own ObjectCreationFactory (child class of > AbstractObjectCreationFactory) to return the static object. > > But when I set the attribute of the Static object by using addCallParam(), I > got exception: > Jan 27, 2004 12:32:49 AM org.apache.commons.digester.Digester peekParams > WARNING: Empty stack (returning null) Digester needs target *objects* on its object stack in order to set their attributes. The error message is indicating that when Digester went to get the top object on the object stack, in order to set its parameter1 value, it found that the object stack was empty. Your approach of using a factory would work with *singleton* objects. However I can't imagine how you would use one with a purely static class - what are you returning from the CreateObject method? If you are returning *null* instead of an object, that would explain the symptoms.. Regardless, Roberts suggestion of a custom rule is probably the best solution provided you don't have too many of these static classes. If you *do* have a lot of these static classes, you may have more serious problems anyway :-) Or you could change to using Singletons instead.... Regards, Simon --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org