Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 2907 invoked from network); 14 Dec 2005 19:59:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Dec 2005 19:59:52 -0000 Received: (qmail 83431 invoked by uid 500); 14 Dec 2005 19:59:45 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 83371 invoked by uid 500); 14 Dec 2005 19:59:45 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 83360 invoked by uid 500); 14 Dec 2005 19:59:45 -0000 Received: (qmail 83356 invoked by uid 99); 14 Dec 2005 19:59:45 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Dec 2005 11:59:45 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 14 Dec 2005 11:59:44 -0800 Received: (qmail 2691 invoked by uid 65534); 14 Dec 2005 19:59:24 -0000 Message-ID: <20051214195924.2684.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r356839 - in /jakarta/commons/proper/configuration/trunk/src: java/org/apache/commons/configuration/AbstractFileConfiguration.java test/org/apache/commons/configuration/TestFileConfiguration.java Date: Wed, 14 Dec 2005 19:59:23 -0000 To: commons-cvs@jakarta.apache.org From: oheger@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: oheger Date: Wed Dec 14 11:59:07 2005 New Revision: 356839 URL: http://svn.apache.org/viewcvs?rev=356839&view=rev Log: AbstractFileConfiguration.setURL() now stores the passed in URL directly so that it need not be derived from base path and file name; fixes issue 37886 Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/AbstractFileConfiguration.java jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestFileConfiguration.java Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/AbstractFileConfiguration.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/AbstractFileConfiguration.java?rev=356839&r1=356838&r2=356839&view=diff ============================================================================== --- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/AbstractFileConfiguration.java (original) +++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/AbstractFileConfiguration.java Wed Dec 14 11:59:07 2005 @@ -641,6 +641,7 @@ { setBasePath(ConfigurationUtils.getBasePath(url)); setFileName(ConfigurationUtils.getFileName(url)); + sourceURL = url; } public void setAutoSave(boolean autoSave) Modified: jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestFileConfiguration.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestFileConfiguration.java?rev=356839&r1=356838&r2=356839&view=diff ============================================================================== --- jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestFileConfiguration.java (original) +++ jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestFileConfiguration.java Wed Dec 14 11:59:07 2005 @@ -36,7 +36,7 @@ public class TestFileConfiguration extends TestCase { private static final File TARGET_DIR = new File("target"); - + public void testSetURL() throws Exception { // http URL @@ -53,6 +53,19 @@ assertEquals("file name", "test.properties", config.getFileName()); } + public void testSetURLWithParams() throws Exception + { + FileConfiguration config = new PropertiesConfiguration(); + URL url = new URL( + "http://issues.apache.org/bugzilla/show_bug.cgi?id=37886"); + config.setURL(url); + assertEquals("Base path incorrect", + "http://issues.apache.org/bugzilla/", config.getBasePath()); + assertEquals("File name incorrect", "show_bug.cgi", config + .getFileName()); + assertEquals("URL was not correctly stored", url, config.getURL()); + } + public void testLocations() throws Exception { PropertiesConfiguration config = new PropertiesConfiguration(); @@ -131,7 +144,7 @@ /** * Tests collaboration with ConfigurationFactory: Is the base path set on * loading is valid in file based configurations? - * + * * @throws Exception if an error occurs */ public void testWithConfigurationFactory() throws Exception @@ -176,7 +189,7 @@ } } } - + /** * Tests if invalid URLs cause an exception. */ @@ -203,7 +216,7 @@ //fine } } - + /** * Tests if the URL used by the load() method is also used by save(). */ @@ -266,7 +279,7 @@ } } } - + /** * Tests setting a file changed reloading strategy together with the auto * save feature. @@ -304,7 +317,7 @@ } } } - + /** * Tests loading and saving a configuration file with a complicated path * name including spaces. (related to issue 35210) @@ -355,7 +368,7 @@ } } } - + /** * Tests the getFile() method. */ @@ -369,7 +382,7 @@ config.load(); assertEquals(file, config.getFile()); } - + /** * Tests to invoke save() without explicitely setting a file name. This * will cause an exception. @@ -388,7 +401,7 @@ { //ok } - + config = new PropertiesConfiguration(); config.load("conf/test.properties"); try @@ -400,7 +413,7 @@ { //ok } - + config = new PropertiesConfiguration(); config.load(file.toURL()); try --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org