commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maria Jimena Sanchez <jimesanc...@gmail.com>
Subject Re: test.value=foo
Date Tue, 14 Feb 2012 18:45:46 GMT
that could be.
I'm running linux with java 1.6.
I didn't download java 7 yet, let me try that.

On Tue, Feb 14, 2012 at 3:41 PM, Young Gun <scott_cornwell@hotmail.com>wrote:

>
> Jime,
> Thanks for the quick response but no workie....
> I took code as is, an add values to the user.prooperties file but it still
> does not work but with double periods:
>
>
> user.name=jime
> user.code=1234
>
> Output was---
> user/name=jime
> user/code=1234
> -----------------
>
> If I added double periods (..) then it works..
> user..name=jime
>
> user..code=1234
>
> Output was ---
> user.name=jime
> user.code=1234
> -----------------
>
> I am using Java 7 u1 . I tried commons version 1.7 and 1.8 but I have NOT
> tried with Java 6 yet..
>
> IS THIS A BUG W/ JAVA 7 ???
>
>
> Scott
>
> > Date: Tue, 14 Feb 2012 14:37:20 -0300
> > Subject: Re: test.value=foo
> > From: jimesanchez@gmail.com
> > To: user@commons.apache.org
> >
> > I tested its and it works.
> >
> > Here is my test:
> > the test class
> > public class Testasfd {
> >     @Test
> >     public void test() throws ConfigurationException {
> >         Map<String, String> expectedValues = new HashMap<String,
> String>();
> >         expectedValues.put("user.name", "jime");
> >         expectedValues.put("user.code", "1234");
> >         DefaultConfigurationBuilder defaultConfigurationBuilder = new
> >
> DefaultConfigurationBuilder("/home/jsanchez/wc/tendril.git/paper-reports/workflows/src/test/java/com/tendril/pr/workflows/example.xml");
> >         CombinedConfiguration cc = (CombinedConfiguration)
> > defaultConfigurationBuilder.getConfiguration(true);
> >         Iterator keys = cc.getKeys();
> >         for (Iterator iterator = cc.getKeys(); iterator.hasNext();) {
> >             Object key = iterator.next();
> >             System.out.println(key + "=" + cc.getString((String) key));
> >             assertTrue(expectedValues.containsKey(key));
> >             assertEquals(expectedValues.get(key), cc.getString((String)
> > key));
> >         }
> >     }
> > }
> >
> > with this xml
> > <?xml version="1.0" encoding="ISO-8859-1" ?>
> > <configuration>
> >   <properties fileName="props.properties"/>
> > </configuration>
> >
> > and this properties
> > user.name=jime
> > user.code=1234
> >
> > here is the output
> > user.name=jime
> > user.code=1234
> >
> > Jime
> >
> > On Tue, Feb 14, 2012 at 1:42 PM, Young Gun <scott_cornwell@hotmail.com
> >wrote:
> >
> > >
> > > Ok this is bugging the heck out of me, I have the following (if there
> is a
> > > typo it is because I have to type this by hand from one screen to next,
> > > don't ask) What am I doing wrong??:
> > >
> > > example.xml loads user.properties
> > >
> > > user.proerties has an entry:
> > > dog.type = lab
> > > ....
> > >
> > > dcb=new DefaultConfigurationBuilder("example.xml);
> > > cc = (CombinedConfiguration) dcb.getConfiguration(true);
> > >
> > > .....
> > >
> > > if I get the keys .. cc.getKeys() the key prints out as: dog/type
> > >
> > > if I get the value cc.getString() it returns: null
> > >
> > > IF I PUT the value as dog..type = lab (two periods) in user.properties
> > > then then it prints dog.type as the key and lab as the value.
> > >
> > > I refactor code where some of the property files have xxx.xxx = value
> and
> > > I see example of this in the documentation. I can change all of them to
> > > double periods.
> > >
> > > Any help is greatly appreciated!!
> > >
> > >
> > > Scott
> > >
>
>

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