Author: oheger Date: Sat Sep 28 19:45:24 2013 New Revision: 1527246 URL: http://svn.apache.org/r1527246 Log: Removed some obsolete methods from ConfigurationUtils.
Methods related to URL handling have been moved to FileLocatorUtils. Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationUtils.java Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java?rev=1527246&r1=1527245&r2=1527246&view=diff ============================================================================== --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java Sat Sep 28 19:45:24 2013 @@ -17,22 +17,18 @@ package org.apache.commons.configuration; -import java.io.File; import java.io.PrintStream; import java.io.PrintWriter; import java.io.StringWriter; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Proxy; -import java.net.MalformedURLException; -import java.net.URL; import java.util.Iterator; import org.apache.commons.configuration.event.ConfigurationErrorEvent; import org.apache.commons.configuration.event.ConfigurationErrorListener; import org.apache.commons.configuration.event.ConfigurationListener; import org.apache.commons.configuration.event.EventSource; -import org.apache.commons.configuration.io.FileSystem; import org.apache.commons.configuration.sync.NoOpSynchronizer; import org.apache.commons.configuration.sync.Synchronizer; import org.apache.commons.configuration.tree.ExpressionEngine; @@ -431,36 +427,6 @@ public final class ConfigurationUtils } /** - * Constructs a URL from a base path and a file name. The file name can - * be absolute, relative or a full URL. If necessary the base path URL is - * applied. - * - * @param basePath the base path URL (can be <b>null</b>) - * @param file the file name - * @return the resulting URL - * @throws MalformedURLException if URLs are invalid - */ - public static URL getURL(String basePath, String file) throws MalformedURLException - { - return FileSystem.getDefaultFileSystem().getURL(basePath, file); - } - - /** - * Convert the specified file into an URL. This method is equivalent - * to file.toURI().toURL(). It was used to work around a bug in the JDK - * preventing the transformation of a file into an URL if the file name - * contains a '#' character. See the issue CONFIGURATION-300 for - * more details. Now that we switched to JDK 1.4 we can directly use - * file.toURI().toURL(). - * - * @param file the file to be converted into an URL - */ - public static URL toURL(File file) throws MalformedURLException - { - return file.toURI().toURL(); - } - - /** * Enables runtime exceptions for the specified configuration object. This * method can be used for configuration implementations that may face errors * on normal property access, e.g. {@code DatabaseConfiguration} or Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationUtils.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationUtils.java?rev=1527246&r1=1527245&r2=1527246&view=diff ============================================================================== --- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationUtils.java (original) +++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationUtils.java Sat Sep 28 19:45:24 2013 @@ -25,8 +25,6 @@ import static org.junit.Assert.assertNul import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; -import java.io.File; -import java.net.URL; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -95,53 +93,6 @@ public class TestConfigurationUtils } @Test - public void testGetURL() throws Exception - { - assertEquals( - "http://localhost:8080/webapp/config/config.xml", - ConfigurationUtils - .getURL( - "http://localhost:8080/webapp/config/baseConfig.xml", - "config.xml") - .toString()); - assertEquals( - "http://localhost:8080/webapp/config/config.xml", - ConfigurationUtils - .getURL( - "http://localhost:8080/webapp/baseConfig.xml", - "config/config.xml") - .toString()); - URL url = ConfigurationUtils.getURL(null, "config.xml"); - assertEquals("file", url.getProtocol()); - assertEquals("", url.getHost()); - - assertEquals( - "http://localhost:8080/webapp/config/config.xml", - ConfigurationUtils - .getURL( - "ftp://ftp.server.com/downloads/baseConfig.xml", - "http://localhost:8080/webapp/config/config.xml") - .toString()); - assertEquals( - "http://localhost:8080/webapp/config/config.xml", - ConfigurationUtils - .getURL(null, "http://localhost:8080/webapp/config/config.xml") - .toString()); - File absFile = new File("config.xml").getAbsoluteFile(); - assertEquals( - absFile.toURI().toURL(), - ConfigurationUtils.getURL( - "http://localhost:8080/webapp/config/baseConfig.xml", - absFile.getAbsolutePath())); - assertEquals( - absFile.toURI().toURL(), - ConfigurationUtils.getURL(null, absFile.getAbsolutePath())); - - assertEquals(absFile.toURI().toURL(), - ConfigurationUtils.getURL(absFile.getParent(), "config.xml")); - } - - @Test public void testCopy() { // create the source configuration