DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34362>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34362





------- Additional Comments From [EMAIL PROTECTED]  2005-04-12 22:12 -------
Ok .. took me a bit to figure out a test case that would work for 99% of the 
people out there...

   /***
     * Test loading using URL and saving ...
     * This is a test to prove an obscure but none abnormal bug
     * that occurs when i file is loaded from a classpath... 
     * due to how we "search" for files 
     * (see bug 34362) 
     * @author JMGuillemette
     */
    public void testLoadAndSaveURL()throws Exception
        {
        Properties sysProps = System.getProperties();
        String path = sysProps.getProperty("user.home");
                File file1 = new File(path+"/file1.properties");
        Properties p = new Properties();
        p.put("Prop1","value");
        FileOutputStream fos = new FileOutputStream(file1);
        p.store(fos,"test file");
        fos.close();
        FileConfiguration config = new PropertiesConfiguration
("file1.properties");
        config.setProperty("Prop1","newValue");
        config.save();
        Properties props = new Properties();// independant checking of save 
feature
        props.load(new FileInputStream(file1));
        assertTrue("Should contain new value",props.containsKey("Prop1"));
        assertTrue("Value should be updated","newValue".equals(props.get
("Prop1")));
   }

This code will fail due to the existing bug.
Basically .. we create a file within the realm of our load()'s search area
in this cause user.home .. but when we save the file.. it will end up save it 
to <executionpath>/ thus .. manual reading the props will find that the new 
values dont exists and the test fails.

J.



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to