Konstantinos Pachopoulos wrote:
> Hi,
> Given a properties file, which contains this:
> -------------------
> b = asd
> a = ${b}safk
> -------------------
> I -when reading property 'a'- get "${b}safk".
>
> This is the program i use for reading the properties:
> ---------------------
> import java.io.*;
> import org.apache.commons.configuration.*;
>
> public class PropsTest
> {
> public static void main(String[] args)
> {
> PropertiesConfiguration props_=new
> PropertiesConfiguration();
> try {
> props_.load(new FileReader("C:/Documents
> and Settings/paxosk/My Documents/a.props"));
> }
> catch(Exception e) {
> System.err.println("failed to parser
> properties file... exiting/n"+
> e.getMessage());
> System.exit(-1);
> }
>
>
> System.out.println((String)props_.getProperty("a"));
>
> }//main
> }
> --------------------
>
> What's the problem?
>
> Thanks
>
The getProperty() method does not do any variable substituation as is
pointed out in its javadocs [1]. Use the getString() method instead.
Oliver
[1]
http://commons.apache.org/configuration/apidocs/org/apache/commons/configuration/Configuration.html#getProperty(java.lang.String)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]