hi brad

i think that this is a bug which has been fixed since the release.

could you try upgrading to the latest build and see if it fixes your 
problem?

- robert

On Tuesday, July 9, 2002, at 04:46 PM, Brad Jones wrote:

>
> Robert,
>
> Thank you for the suggestion I tried to implement your suggestion and am 
> encountering the following NullPointerException:
>
> java.lang.NullPointerException
>       at 
> org.apache.commons.digester.CallMethodRule.<init>(CallMethodRule.java:229)
>       at 
> org.apache.commons.digester.Digester.addCallMethod(Digester.java:1480)
>       at 
> com.ibm.us.force.xml.DigesterHelperOLD.main(DigesterHelperOLD.java:21)
> Exception in thread "main"
>
> I create a String array of the types for the put method in the hashtable 
> per your suggestion:
>
> String types[] = {"java.lang.Object", "java.lang.Object"};
>
> I then passed the types String array to the addCallMethod per your 
> suggestion:
>
> digester.addCallMethod("toplevel/element", "put", 2, types);
>
> when the addCallMethod is executed I'm getting the NullPointerException 
> that I included above.  The types String array is populated, the digester 
> is not null, Any ideas???
>
> Thanks for your help,
>
> Brad
>
>> From: robert burrell donkin <[EMAIL PROTECTED]>
>> Reply-To: "Jakarta Commons Users List" <[EMAIL PROTECTED]>
>> To: "Jakarta Commons Users List" <[EMAIL PROTECTED]>
>> Subject: Re: [digester] Re: Rules for parsing to a Hashtable
>> Date: Mon, 8 Jul 2002 23:15:55 +0100
>>
>> hi brad
>>
>> i think i have an idea what's going on.
>>
>> CallMethodRule uses only exact matching and so you might need to specify 
>> the exact types before digester will find the method.
>>
>> try specifying the classes that 'put' takes, something like
>>
>> String types = {"java.lang.Object","java.lang.Object"};
>> digester.addCallMethod("toplevel/element", "put", 2, types);
>>
>> and see if it starts working.
>>
>> - robert
>>
>> On Monday, July 8, 2002, at 10:48 PM, Brad Jones wrote:
>>
>>> Robert here's the stack trace you asked for:
>>>
>>> java.lang.NoSuchMethodException: No such accessible method: put() on 
>>> object: java.util.Hashtable
>>>     at 
>>> org.apache.commons.beanutils.MethodUtils.invokeExactMethod(MethodUtils.
>>> java:
>>> 322)
>>>     at 
>>> org.apache.commons.digester.CallMethodRule.end(CallMethodRule.java:421)
>>>     at 
>>> org.apache.commons.digester.Digester.endElement(Digester.java:830)
>>>     at 
>>> org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
>>>     at org.apache.xerces.validators.common.XMLValidator.callEndElement
>>> (XMLValidator.java:1480)
>>>     at 
>>> org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(
>>> XMLDocumentScanner.java:1204)
>>>     at org.apache.xerces.framework.XMLDocumentScanner.parseSome
>>> (XMLDocumentScanner.java:381)
>>>     at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1081)
>>>     at org.apache.commons.digester.Digester.parse(Digester.java:1302)
>>>     at 
>>> com.ibm.us.force.xml.DigesterHelperOLD.main(DigesterHelperOLD.java:30)
>>> [ERROR] Digester - -End event threw exception 
>>> <java.lang.NoSuchMethodException: No such accessible method: put() on 
>>> object: java.util.Hashtable>
>>>
>>> I tried to get the logs for it but I haven't learned how configure the 
>>> logging and retrieve the log file.  If I need to I'll get that to you 
>>> also.  Thanks for any suggestions you might have.
>>>
>>> I'm using digester v 1.2
>>>
>>> Brad
>>>
>>>
>>>> From: robert burrell donkin <[EMAIL PROTECTED]>
>>>> Reply-To: "Jakarta Commons Users List" <commons-
>>>> [EMAIL PROTECTED]>
>>>> To: "Jakarta Commons Users List" <[EMAIL PROTECTED]>
>>>> Subject: [digester] Re: Rules for parsing to a Hashtable
>>>> Date: Mon, 8 Jul 2002 21:21:19 +0100
>>>>
>>>> hi brad
>>>>
>>>> i've given your code a whirl but i don't seem to have a problem.
>>>>
>>>> what version of digester are you using?
>>>>
>>>> BTW i would be useful if you could prefix your question with the 
>>>> component name next time. (there are a lot of components in commons 
>>>> and the prefix makes it easier for the right people to answer the 
>>>> right questions.)
>>>>
>>>> - robert
>>>>
>>>> On Monday, July 8, 2002, at 08:04 PM, Brad Jones wrote:
>>>>
>>>>>
>>>>>
>>>>> I'm currently trying to parse objects from an XML file to a 
>>>>> hashtable.  I'
>>>>> m calling the put from the hashtable in my rule and passing 2 
>>>>> parameters one that represents the key and the other that represents 
>>>>> the value.  For some reason I'm getting a SAXException saying that 
>>>>> the put method does not exist on hashtable.  Here's the code I'm 
>>>>> working with currently.  Any suggestions would be greatly 
>>>>> appreciated:
>>>>>
>>>>>           java.io.FileInputStream fileInputStream = null;
>>>>>           Digester digester = new Digester();
>>>>>
>>>>>           Hashtable ht = new Hashtable();
>>>>>
>>>>>           digester.push(ht);
>>>>>           digester.setValidating(false);
>>>>>
>>>>>
>>>>>           //Sets filed 1 as the key and field 2 as the value
>>>>>           digester.addCallMethod("toplevel/element", "put", 2);
>>>>>           digester.addCallParam("toplevel/element/field1", 0, "field1");
>>>>>           digester.addCallParam("toplevel/element/field2", 1, "field2");
>>>>>
>>>>>           try {
>>>>>                   fileInputStream = new java.io.FileInputStream("C:/test.xml");
>>>>>           } catch (java.io.FileNotFoundException fnfe) {
>>>>>           }
>>>>>
>>>>>           try {
>>>>>                   Object data = digester.parse(fileInputStream);
>>>>>                   fileInputStream.close();
>>>>>
>>>>>           } catch (org.xml.sax.SAXException se) {
>>>>>                   System.out.println(se.getMessage());
>>>>>           } catch (java.io.IOException ie) {
>>>>>           }
>>>>>
>>>>> Here's the XML file that I'm parsing:
>>>>>
>>>>> <toplevel>
>>>>>   <element>
>>>>>           <field1>Value 1</field1>
>>>>>           <field2>Value 2</field2>
>>>>>   </element>
>>>>>   <element>
>>>>>           <field1>Value 3</field1>
>>>>>           <field2>Value 4</field2>
>>>>>   </element>
>>>>> </toplevel>
>>>>>
>>>>> Thank you for any sugestions that you can provide...
>>>>>
>>>>> Brad
>>>>>
>>>>>
>>>>>
>>>>> _________________________________________________________________
>>>>> MSN Photos is the easiest way to share and print your photos: 
>>>>> http://photos.msn.com/support/worldwide.aspx
>>>>>
>>>>>
>>>>> --
>>>>> To unsubscribe, e-mail:   <mailto:commons-user-
>>>>> [EMAIL PROTECTED]
>>>>> org>
>>>>> For additional commands, e-mail: <mailto:commons-user-
>>>>> [EMAIL PROTECTED]
>>>>> org>
>>>>>
>>>>
>>>>
>>>> --
>>>> To unsubscribe, e-mail:   <mailto:commons-user-
>>>> [EMAIL PROTECTED]>
>>>> For additional commands, e-mail: <mailto:commons-user-
>>>> [EMAIL PROTECTED]>
>>>
>>>
>>>
>>>
>>> _________________________________________________________________
>>> Join the world�s largest e-mail service with MSN Hotmail. 
>>> http://www.hotmail.com
>>>
>>>
>>> --
>>> To unsubscribe, e-mail:   <mailto:commons-user-
>>> [EMAIL PROTECTED]
>>> org>
>>> For additional commands, e-mail: <mailto:commons-user-
>>> [EMAIL PROTECTED]
>>> org>
>>>
>>
>>
>> --
>> To unsubscribe, e-mail:   <mailto:commons-user-
>> [EMAIL PROTECTED]>
>> For additional commands, e-mail: <mailto:commons-user-
>> [EMAIL PROTECTED]>
>
>
>
>
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos: 
> http://photos.msn.com/support/worldwide.aspx
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED].
> org>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED].
> org>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to