Author: oheger
Date: Sat Sep 28 19:42:10 2013
New Revision: 1527239

URL: http://svn.apache.org/r1527239
Log:
Removed obsolete method and reduced method visibility.

The old, hard-coded locate() method is no longer used; it has been fully
replaced by the new one which uses the customizable location strategy.
The method obtainFileSystem() is only used within the io package, so its
visibility could be reduced.

Modified:
    
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/FileLocatorUtils.java

Modified: 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/FileLocatorUtils.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/FileLocatorUtils.java?rev=1527239&r1=1527238&r2=1527239&view=diff
==============================================================================
--- 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/FileLocatorUtils.java
 (original)
+++ 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/FileLocatorUtils.java
 Sat Sep 28 19:42:10 2013
@@ -151,22 +151,6 @@ public final class FileLocatorUtils
     }
 
     /**
-     * Obtains a non-<b>null</b> {@code FileSystem} object from the passed in
-     * {@code FileLocator}. If the passed in {@code FileLocator} has a
-     * {@code FileSystem} object, it is returned. Otherwise, result is the
-     * default {@code FileSystem}.
-     *
-     * @param locator the {@code FileLocator} (may be <b>null</b>)
-     * @return the {@code FileSystem} to be used for this {@code FileLocator}
-     */
-    public static FileSystem obtainFileSystem(FileLocator locator)
-    {
-        return (locator != null) ? ObjectUtils.defaultIfNull(
-                locator.getFileSystem(), DEFAULT_FILE_SYSTEM)
-                : DEFAULT_FILE_SYSTEM;
-    }
-
-    /**
      * Checks whether the specified {@code FileLocator} contains enough
      * information to locate a file. This is the case if a file name or a URL 
is
      * defined. If the passed in {@code FileLocator} is <b>null</b>, result is
@@ -245,107 +229,6 @@ public final class FileLocatorUtils
     }
 
     /**
-     * Return the location of the specified resource by searching the user home
-     * directory, the current classpath and the system classpath.
-     *
-     * @param fileSystem the FileSystem to use.
-     * @param base the base path of the resource
-     * @param name the name of the resource
-     *
-     * @return the location of the resource
-     */
-    public static URL locate(FileSystem fileSystem, String base, String name)
-    {
-        if (LOG.isDebugEnabled())
-        {
-            StringBuilder buf = new StringBuilder();
-            buf.append("ConfigurationUtils.locate(): base is ").append(base);
-            buf.append(", name is ").append(name);
-            LOG.debug(buf.toString());
-        }
-
-        if (name == null)
-        {
-            // undefined, always return null
-            return null;
-        }
-
-        // attempt to create an URL directly
-
-        URL url = fileSystem.locateFromURL(base, name);
-
-        // attempt to load from an absolute path
-        if (url == null)
-        {
-            File file = new File(name);
-            if (file.isAbsolute() && file.exists()) // already absolute?
-            {
-                try
-                {
-                    url = toURL(file);
-                    LOG.debug("Loading configuration from the absolute path " 
+ name);
-                }
-                catch (MalformedURLException e)
-                {
-                    LOG.warn("Could not obtain URL from file", e);
-                }
-            }
-        }
-
-        // attempt to load from the base directory
-        if (url == null)
-        {
-            try
-            {
-                File file = constructFile(base, name);
-                if (file != null && file.exists())
-                {
-                    url = toURL(file);
-                }
-
-                if (url != null)
-                {
-                    LOG.debug("Loading configuration from the path " + file);
-                }
-            }
-            catch (MalformedURLException e)
-            {
-                LOG.warn("Could not obtain URL from file", e);
-            }
-        }
-
-        // attempt to load from the user home directory
-        if (url == null)
-        {
-            try
-            {
-                File file = constructFile(System.getProperty("user.home"), 
name);
-                if (file != null && file.exists())
-                {
-                    url = toURL(file);
-                }
-
-                if (url != null)
-                {
-                    LOG.debug("Loading configuration from the home path " + 
file);
-                }
-
-            }
-            catch (MalformedURLException e)
-            {
-                LOG.warn("Could not obtain URL from file", e);
-            }
-        }
-
-        // attempt to load from classpath
-        if (url == null)
-        {
-            url = locateFromClasspath(name);
-        }
-        return url;
-    }
-
-    /**
      * Locates the provided {@code FileLocator}, returning a URL for accessing
      * the referenced file. This method uses a {@link FileLocationStrategy} to
      * locate the file the passed in {@code FileLocator} points to. If the
@@ -656,6 +539,22 @@ public final class FileLocatorUtils
     }
 
     /**
+     * Obtains a non-<b>null</b> {@code FileSystem} object from the passed in
+     * {@code FileLocator}. If the passed in {@code FileLocator} has a
+     * {@code FileSystem} object, it is returned. Otherwise, result is the
+     * default {@code FileSystem}.
+     *
+     * @param locator the {@code FileLocator} (may be <b>null</b>)
+     * @return the {@code FileSystem} to be used for this {@code FileLocator}
+     */
+    static FileSystem obtainFileSystem(FileLocator locator)
+    {
+        return (locator != null) ? ObjectUtils.defaultIfNull(
+                locator.getFileSystem(), DEFAULT_FILE_SYSTEM)
+                : DEFAULT_FILE_SYSTEM;
+    }
+
+    /**
      * Obtains a non <b>null</b> {@code FileLocationStrategy} object from the
      * passed in {@code FileLocator}. If the {@code FileLocator} is not
      * <b>null</b> and has a {@code FileLocationStrategy} defined, this 
strategy


Reply via email to