Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 36632 invoked from network); 5 Jun 2002 21:25:41 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 5 Jun 2002 21:25:41 -0000 Received: (qmail 4913 invoked by uid 97); 5 Jun 2002 21:25:45 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 4886 invoked by uid 97); 5 Jun 2002 21:25:45 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 4872 invoked by uid 98); 5 Jun 2002 21:25:44 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Date: Wed, 5 Jun 2002 22:26:24 +0100 Subject: [Digester] Re: NullPointerException when performing addCallMethod Content-Type: text/plain; charset=ISO-8859-1; format=flowed Mime-Version: 1.0 (Apple Message framework v481) From: robert burrell donkin To: "Jakarta Commons Developers List" Content-Transfer-Encoding: quoted-printable In-Reply-To: <3CFE5200.2080907@germinus.com> Message-Id: X-Mailer: Apple Mail (2.481) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N i've just committed a fix for this. if you have access to cvs, then = maybe=20 you could give the latest version a try. - robert On Wednesday, June 5, 2002, at 07:01 PM, =C1lvaro Barge wrote: > Hi > > I am trying to parse an XML document that has a numeric attribute = (size)=20 > in one of its elements. I was trying to invoke a setNumber(int value)=20= > method in the bean by adding a CallMethodRule and a CallParamRule: > > digester.addCallMethod("result/stats", > "setNumber", 1, new String[] = {"java.lang.Integer"}); > digester.addCallParam("result/stats", 0, "size"); > > > This code throws a NullPointerException in the CallMethodRule(String=20= > methodName,int paramCount, String paramTypes[]) constructor (in line = 229) > . (I am using digester 1.2 over Linux with the Sun Java 1.3.1).I have=20= > been looking for the error cause, and I have found that the = constructor=20 > uses a "digester.getClassLoader().load..." method when the paramTypes=20= > array specified is not empty. > > Well, looking at the digester source code, it seems that the=20 > CallMethodRule is created in the addCallMethod method, so in that=20 > constructor the digester object has not been set (the setDigester = method=20 > is invoked in the addRule method of the Digester class, after creating=20= > the CallMethodRule). So, IMHO, the NullPointerException will appear=20 > whenever a non-empty paramTypes array is specified in the = CallMethodRule=20 > creation, because the Digester object will never be set in that point = of=20 > the program. Do you think that this is correct? > > I have been also looking at the RuleTestCase, and there are no tests=20= > checking this constructor with a non-empty paramTypes array, so this=20= > situation is not tested. > > In my opinion, the ClassLoader must be obtained using another object = and=20 > a new test line should be added in the TestCase. > > What do you think about this? Is this correct? Has anybody had this=20 > problem before? > > Thanks, > > =C1lvaro Barge > > > -- > To unsubscribe, e-mail: = org> > For additional commands, e-mail: = org> > -- To unsubscribe, e-mail: For additional commands, e-mail: