commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
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 GMT
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


Mime
View raw message