commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <fzli...@omnytex.com>
Subject Re: Digester frustrations
Date Tue, 22 Mar 2005 22:56:21 GMT
Ah, that's two things I didn't try... it wasn't static and I didn't use 
$ (am I not remembering correctly?  Do you not reference inner classes 
with dot notation?).  Why does it need to be static?  Just curious. 
I'll give it a try tomorrow when I get back to the office, it'll make 
this a little easier to distribute (it's a servler filter to deal with 
system availability windows by the way).  Thanks Martin!

Frank

Martin Cooper wrote:
> On Tue, 22 Mar 2005 16:34:35 -0500 (EST), Frank W. Zammetti
> <fzlists@omnytex.com> wrote:
> 
>>One small problem remains...
>>
>>Does Digester not allow you to use inner classes as the target object?  I
>>found that I could only get this to work when I made the inner ConfigData
>>class NOT an inner class.  I realized too I had to fully-qualify the
>>class, but it didn't seem to matter being an inner class, it wouldn't work
>>no matter what I put.
>>
>>Is this a shortcoming?  Is there a reason if it is?  Thanks!
> 
> 
> As long as the inner class is public and static, and you use a '$' as
> the separator, you should be fine. I'm pretty sure I've done this
> myself.
> 
> --
> Martin Cooper
> 
> 
> 
>>--
>>Frank W. Zammetti
>>Founder and Chief Software Architect
>>Omnytex Technologies
>>http://www.omnytex.com
>>
>>On Tue, March 22, 2005 4:11 pm, Frank W. Zammetti said:
>>
>>>Ugh.  I got it...
>>>
>>>The rules were set up wrong.  The root of the XML document is
>>>AppAvailabilityFilterConfig, not AppAvailabilityFilter as I had.
>>>
>>>My head HURTS.
>>>
>>>--
>>>Frank W. Zammetti
>>>Founder and Chief Software Architect
>>>Omnytex Technologies
>>>http://www.omnytex.com
>>>
>>>On Tue, March 22, 2005 3:43 pm, Frank W. Zammetti said:
>>>
>>>>Hey all... I'm trying to use Digester myself for the first time and I'm
>>>>getting very frustrated...  Here's what I have:
>>>>
>>>>Digester digester = new Digester();
>>>>digester.setValidating(false);
>>>>digester.addObjectCreate("AppAvailabilityFilter",
>>>>"AppAvailabilityFilter.ConfigData");
>>>>digester.addBeanPropertySetter("AppAvailabilityFilter/mondayStartTime",
>>>>"mondayStartTime");
>>>>digester.addBeanPropertySetter("AppAvailabilityFilter/mondaEndTime",
>>>>"mondayEndTime");
>>>>// I get InputStream isConfigFile here, I have verified I have it by
>>>>printing out the contents
>>>>configData = (ConfigData)digester.parse(isConfigFile);
>>>>configData.setConfigDataSet();
>>>>
>>>>configData is a static member of the class this code belongs to.
>>>>ConfigData is a inner class.  Here's the relevant snippet:
>>>>
>>>>private int mondayStartTime;
>>>>private int mondayEndTime;
>>>>public void setMondayStartTime(String mondayStartTime) {
>>>>  this.mondayStartTime = Integer.parseInt(mondayStartTime);
>>>>}
>>>>public int getMondayStartTime() {
>>>>  return mondayStartTime;
>>>>}
>>>>
>>>>As you can probably guess, I have the same things for every day of the
>>>>week.  Lastly, here's the XML file:
>>>>
>>>><?xml version="1.0" encoding="UTF-8"?>
>>>><AppAvailabilityFilterConfig>
>>>>  <mondayStartTime>0100</mondayStartTime>
>>>>  <mondayEndTime>2300</mondayEndTime>
>>>></AppAvailabilityFilterConfig>
>>>>
>>>>The problem is that it gets all the way to the line:
>>>>
>>>>configData.setConfigDataSet();
>>>>
>>>>...no exceptions are thrown, no messages from Digester, etc.  But, that
>>>>line causes a NullPointerException, so I can only assume that means
>>>>Digester did not create the object and/or could not populate it properly
>>>>so returned null (or ate an exception and didn't report it?)
>>>>
>>>>Anyone spot a problem here?  I'm getting ready to throw myself out a
>>>>window.  Thanks all!
>>>>
>>>>--
>>>>Frank W. Zammetti
>>>>Founder and Chief Software Architect
>>>>Omnytex Technologies
>>>>http://www.omnytex.com
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>>
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> 
> 
> 

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message