logo       

Re: Config constructor ignores ConfigFile contents [BUG]: msg#00002

java.enhydra.general

Subject: Re: Config constructor ignores ConfigFile contents [BUG]

Hi,

It is not bug in Enhydra. The class ConfigFile is actually responsible for
conf file parsing and creating Config instance, then we can obtain it with
ConfigFile.getConfig().
Constructor Config(ConfigFile) just creates empty config that we can fill it
and save it with associated ConfigFile (erasing all previous parameters if
exist).

Sinisa Milosevic,
Together Serbia


----- Original Message -----
From: "Karl Stenerud" <karl@xxxxxxxxxxxxxxx>
To: <enhydra@xxxxxxxxxxx>
Sent: Thursday, May 01, 2003 2:39 AM
Subject: Re: Enhydra: Config constructor ignores ConfigFile contents [BUG]


> I found out how to get around it. Instead of doing:
>
> // Doesn't work
> java.io.File file = new java.io.File("multiserver.conf");
> com.lutris.util.ConfigFile configFile = new
com.lutris.util.ConfigFile(file);
> com.lutris.util.Config conf = new com.lutris.util.Config(configFile);
>
> You can do:
>
> // Works
> java.io.File file = new java.io.File("multiserver.conf");
> com.lutris.util.ConfigFile configFile = new
com.lutris.util.ConfigFile(file);
> com.lutris.util.Config conf = configFile.getConfig();
>
>
> So it's definitely a bug in enhydra.
>
>
> >
> > Once I had problems with the Config() - constuctor too.
> > Maybe that works:
> >
> > ...
> > com.lutris.util.Config conf = configFile.getConfig();
> > conf.set("first","a");
> > ...
> >
> > HTH
> >
> > Thorsten
> >
> > > -----Original Message-----
> > > From: enhydra-admin@xxxxxxxxxxx
> > > [mailto:enhydra-admin@xxxxxxxxxxx] On Behalf Of Karl Stenerud
> > > Sent: Wednesday, April 30, 2003 5:29 AM
> > > To: enhydra@xxxxxxxxxxx
> > > Subject: Enhydra: Config constructor ignores ConfigFile contents
> > >
> > >
> > > I'm trying to get a Config object from a file, but the
> > > constructor for
> > > Config() ignores the file's contents.
> > >
> > > If I run the following code:
> > >
> > > java.io.File file = new java.io.File("multiserver.conf");
> > > com.lutris.util.ConfigFile configFile = new
> > > com.lutris.util.ConfigFile(file);
> > >
> > > java.io.File outFile = new java.io.File("/tmp/conftest");
> > > java.io.FileOutputStream outStream = new
> > > java.io.FileOutputStream(outFile);
> > > configFile.write(outStream);
> > >
> > > com.lutris.util.KeywordValueTable blah = new
> > > com.lutris.util.KeywordValueTable();
> > > blah.set("first", "a");
> > >
> > > com.lutris.util.Config conf = new com.lutris.util.Config(blah,
> > > configFile);
> > >
> > > org.apache.log4j.Logger.getRootLogger().error("Properties: " +
> > > conf.toString());
> > >
> > >
> > > It prints out the following:
> > >
> > > [java] 626 [main] ERROR root - Properties: {first=a}
> > >
> > >
> > > It is completely ignoring the data in multiserver.conf. If I try the
> > > constructor that takes only the config file, it also ignores the file
> > > contents.
> > > I've verified that the ConfigFile is reading the file by
> > > checking the output
> > > file /tmp/conftest.
>
>
> _______________________________________________
> Enhydra mailing list
> Enhydra@xxxxxxxxxxx
> http://www.enhydra.org/mailman/listinfo.cgi/enhydra
>


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise