commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samuel Cheung <SChe...@Novarra.com>
Subject [digester] Set attribute in a static class
Date Tue, 27 Jan 2004 16:09:14 GMT
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)
Jan 27, 2004 12:32:49 AM org.apache.commons.digester.Digester endElement
SEVERE: End event threw exception
java.lang.NullPointerException
at org.apache.commons.digester.CallParamRule.end(CallParamRule.java:288)
at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source)
at org.apache.crimson.parser.Parser2.content(Unknown Source)
at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source)
at org.apache.crimson.parser.Parser2.content(Unknown Source)
at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source)
at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)

Here is my code to load the config:

    public void loadConfig(File configFile) throws IOException, SAXException
{
        Digester digester = new Digester();
         digester.addFactoryCreate("sysconfig",
sysconfigObjCreationFactory);
        
        digester.addFactoryCreate("sysconfig/comp1",
comp1configObjCreationFactory);
    
        digester.addCallParam( "sysconfig/comp1/parameter1", 0 );
       
        SysConfig sysConfig = (SysConfig) digester.parse(configFile);
    }

I appreciate if anyone can help me on this issue.

Thanks in advance.

Sam

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message