commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <fzli...@omnytex.com>
Subject Digester frustrations
Date Tue, 22 Mar 2005 20:43:22 GMT
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


Mime
View raw message