You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2018/09/27 22:24:26 UTC
svn commit: r1842194 [11/34] - in /commons/proper/configuration/trunk/src:
main/java/org/apache/commons/configuration2/
main/java/org/apache/commons/configuration2/beanutils/
main/java/org/apache/commons/configuration2/builder/
main/java/org/apache/com...
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/FileLocatorUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/FileLocatorUtils.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/FileLocatorUtils.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/FileLocatorUtils.java Thu Sep 27 22:24:23 2018
@@ -125,7 +125,7 @@ public final class FileLocatorUtils
* @param url the URL
* @return the resulting file object
*/
- public static File fileFromURL(URL url)
+ public static File fileFromURL(final URL url)
{
return FileUtils.toFile(url);
}
@@ -163,7 +163,7 @@ public final class FileLocatorUtils
* @param src the source {@code FileLocator} (may be <b>null</b>)
* @return an initialized builder object for defining a {@code FileLocator}
*/
- public static FileLocator.FileLocatorBuilder fileLocator(FileLocator src)
+ public static FileLocator.FileLocatorBuilder fileLocator(final FileLocator src)
{
return new FileLocator.FileLocatorBuilder(src);
}
@@ -179,9 +179,9 @@ public final class FileLocatorUtils
* @return the new {@code FileLocator}
* @throws ClassCastException if the map contains invalid data
*/
- public static FileLocator fromMap(Map<String, ?> map)
+ public static FileLocator fromMap(final Map<String, ?> map)
{
- FileLocator.FileLocatorBuilder builder = fileLocator();
+ final FileLocator.FileLocatorBuilder builder = fileLocator();
if (map != null)
{
builder.basePath((String) map.get(PROP_BASE_PATH))
@@ -205,7 +205,7 @@ public final class FileLocatorUtils
* <b>null</b>)
* @throws IllegalArgumentException if the map is <b>null</b>
*/
- public static void put(FileLocator locator, Map<String, Object> map)
+ public static void put(final FileLocator locator, final Map<String, Object> map)
{
if (map == null)
{
@@ -233,7 +233,7 @@ public final class FileLocatorUtils
* @return a flag whether a file location is defined by this
* {@code FileLocator}
*/
- public static boolean isLocationDefined(FileLocator locator)
+ public static boolean isLocationDefined(final FileLocator locator)
{
return (locator != null)
&& (locator.getFileName() != null || locator.getSourceURL() != null);
@@ -258,7 +258,7 @@ public final class FileLocatorUtils
* @return a flag whether all components describing the referenced file are
* initialized
*/
- public static boolean isFullyInitialized(FileLocator locator)
+ public static boolean isFullyInitialized(final FileLocator locator)
{
if (locator == null)
{
@@ -288,7 +288,7 @@ public final class FileLocatorUtils
* @return a {@code FileLocator} with a fully initialized location if
* possible or <b>null</b>
*/
- public static FileLocator fullyInitializedLocator(FileLocator locator)
+ public static FileLocator fullyInitializedLocator(final FileLocator locator)
{
if (isFullyInitialized(locator))
{
@@ -296,7 +296,7 @@ public final class FileLocatorUtils
return locator;
}
- URL url = locate(locator);
+ final URL url = locate(locator);
return (url != null) ? createFullyInitializedLocatorFromURL(locator,
url) : null;
}
@@ -316,7 +316,7 @@ public final class FileLocatorUtils
* {@code FileLocator} could not be resolved
* @see #DEFAULT_LOCATION_STRATEGY
*/
- public static URL locate(FileLocator locator)
+ public static URL locate(final FileLocator locator)
{
if (locator == null)
{
@@ -337,10 +337,10 @@ public final class FileLocatorUtils
* @return the URL pointing to the referenced file
* @throws ConfigurationException if the file cannot be resolved
*/
- public static URL locateOrThrow(FileLocator locator)
+ public static URL locateOrThrow(final FileLocator locator)
throws ConfigurationException
{
- URL url = locate(locator);
+ final URL url = locate(locator);
if (url == null)
{
throw new ConfigurationException("Could not locate: " + locator);
@@ -355,7 +355,7 @@ public final class FileLocatorUtils
* @param url the URL from which to extract the path
* @return the path component of the passed in URL
*/
- static String getBasePath(URL url)
+ static String getBasePath(final URL url)
{
if (url == null)
{
@@ -381,14 +381,14 @@ public final class FileLocatorUtils
* @param url the URL from which to extract the file name
* @return the extracted file name
*/
- static String getFileName(URL url)
+ static String getFileName(final URL url)
{
if (url == null)
{
return null;
}
- String path = url.getPath();
+ final String path = url.getPath();
if (path.endsWith("/") || StringUtils.isEmpty(path))
{
@@ -422,10 +422,10 @@ public final class FileLocatorUtils
* @param fileName the file name (must not be <b>null</b>)
* @return the file object (<b>null</b> if no file can be obtained)
*/
- static File getFile(String basePath, String fileName)
+ static File getFile(final String basePath, final String fileName)
{
// Check if the file name is absolute
- File f = new File(fileName);
+ final File f = new File(fileName);
if (f.isAbsolute())
{
return f;
@@ -437,13 +437,13 @@ public final class FileLocatorUtils
{
url = new URL(new URL(basePath), fileName);
}
- catch (MalformedURLException mex1)
+ catch (final MalformedURLException mex1)
{
try
{
url = new URL(fileName);
}
- catch (MalformedURLException mex2)
+ catch (final MalformedURLException mex2)
{
url = null;
}
@@ -467,7 +467,7 @@ public final class FileLocatorUtils
*
* @param file the file to be converted into an URL
*/
- static URL toURL(File file) throws MalformedURLException
+ static URL toURL(final File file) throws MalformedURLException
{
return file.toURI().toURL();
}
@@ -479,13 +479,13 @@ public final class FileLocatorUtils
* @param uri the URI to be converted
* @return the resulting URL or <b>null</b>
*/
- static URL convertURIToURL(URI uri)
+ static URL convertURIToURL(final URI uri)
{
try
{
return uri.toURL();
}
- catch (MalformedURLException e)
+ catch (final MalformedURLException e)
{
return null;
}
@@ -498,7 +498,7 @@ public final class FileLocatorUtils
* @param file the file to be converted
* @return the resulting URL or <b>null</b>
*/
- static URL convertFileToURL(File file)
+ static URL convertFileToURL(final File file)
{
return convertURIToURL(file.toURI());
}
@@ -510,11 +510,11 @@ public final class FileLocatorUtils
* @return the URL to the found resource or <b>null</b> if the resource
* cannot be found
*/
- static URL locateFromClasspath(String resourceName)
+ static URL locateFromClasspath(final String resourceName)
{
URL url = null;
// attempt to load from the context classpath
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ final ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader != null)
{
url = loader.getResource(resourceName);
@@ -547,11 +547,11 @@ public final class FileLocatorUtils
* @param fileName the file name (must not be <b>null</b>)
* @return the resulting file
*/
- static File constructFile(String basePath, String fileName)
+ static File constructFile(final String basePath, final String fileName)
{
File file;
- File absolute = new File(fileName);
+ final File absolute = new File(fileName);
if (StringUtils.isEmpty(basePath) || absolute.isAbsolute())
{
file = absolute;
@@ -572,9 +572,9 @@ public final class FileLocatorUtils
* @param ext the extension of the path
* @return the extended path
*/
- static String appendPath(String path, String ext)
+ static String appendPath(final String path, final String ext)
{
- StringBuilder fName = new StringBuilder();
+ final StringBuilder fName = new StringBuilder();
fName.append(path);
// My best friend. Paranoia.
@@ -609,7 +609,7 @@ public final class FileLocatorUtils
* @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)
+ static FileSystem obtainFileSystem(final FileLocator locator)
{
return (locator != null) ? ObjectUtils.defaultIfNull(
locator.getFileSystem(), DEFAULT_FILE_SYSTEM)
@@ -626,7 +626,7 @@ public final class FileLocatorUtils
* @param locator the {@code FileLocator}
* @return the {@code FileLocationStrategy} for this {@code FileLocator}
*/
- static FileLocationStrategy obtainLocationStrategy(FileLocator locator)
+ static FileLocationStrategy obtainLocationStrategy(final FileLocator locator)
{
return (locator != null) ? ObjectUtils.defaultIfNull(
locator.getLocationStrategy(), DEFAULT_LOCATION_STRATEGY)
@@ -641,10 +641,10 @@ public final class FileLocatorUtils
* @param url the URL
* @return the fully initialized {@code FileLocator}
*/
- private static FileLocator createFullyInitializedLocatorFromURL(FileLocator src,
- URL url)
+ private static FileLocator createFullyInitializedLocatorFromURL(final FileLocator src,
+ final URL url)
{
- FileLocator.FileLocatorBuilder fileLocatorBuilder = fileLocator(src);
+ final FileLocator.FileLocatorBuilder fileLocatorBuilder = fileLocator(src);
if (src.getSourceURL() == null)
{
fileLocatorBuilder.sourceURL(url);
@@ -669,7 +669,7 @@ public final class FileLocatorUtils
*/
private static FileLocationStrategy initDefaultLocationStrategy()
{
- FileLocationStrategy[] subStrategies =
+ final FileLocationStrategy[] subStrategies =
new FileLocationStrategy[] {
new ProvidedURLLocationStrategy(),
new FileSystemLocationStrategy(),
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/FileSystem.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/FileSystem.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/FileSystem.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/FileSystem.java Thu Sep 27 22:24:23 2018
@@ -49,7 +49,7 @@ public abstract class FileSystem
*/
public ConfigurationLogger getLogger()
{
- ConfigurationLogger result = log;
+ final ConfigurationLogger result = log;
return (result != null) ? result : DEFAULT_LOG;
}
@@ -63,7 +63,7 @@ public abstract class FileSystem
*
* @param log the new logger
*/
- public void setLogger(ConfigurationLogger log)
+ public void setLogger(final ConfigurationLogger log)
{
this.log = log;
}
@@ -72,7 +72,7 @@ public abstract class FileSystem
* Set the FileOptionsProvider
* @param provider The FileOptionsProvider
*/
- public void setFileOptionsProvider(FileOptionsProvider provider)
+ public void setFileOptionsProvider(final FileOptionsProvider provider)
{
this.optionsProvider = provider;
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/FileSystemLocationStrategy.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/FileSystemLocationStrategy.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/FileSystemLocationStrategy.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/FileSystemLocationStrategy.java Thu Sep 27 22:24:23 2018
@@ -40,7 +40,7 @@ public class FileSystemLocationStrategy
* {@inheritDoc} This implementation delegates to the {@code FileSystem}.
*/
@Override
- public URL locate(FileSystem fileSystem, FileLocator locator)
+ public URL locate(final FileSystem fileSystem, final FileLocator locator)
{
return fileSystem.locateFromURL(locator.getBasePath(),
locator.getFileName());
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/HomeDirectoryLocationStrategy.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/HomeDirectoryLocationStrategy.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/HomeDirectoryLocationStrategy.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/HomeDirectoryLocationStrategy.java Thu Sep 27 22:24:23 2018
@@ -63,7 +63,7 @@ public class HomeDirectoryLocationStrate
* @param homeDir the path to the home directory (can be <b>null</b>)
* @param withBasePath a flag whether the base path should be evaluated
*/
- public HomeDirectoryLocationStrategy(String homeDir, boolean withBasePath)
+ public HomeDirectoryLocationStrategy(final String homeDir, final boolean withBasePath)
{
homeDirectory = fetchHomeDirectory(homeDir);
evaluateBasePath = withBasePath;
@@ -76,7 +76,7 @@ public class HomeDirectoryLocationStrate
*
* @param withBasePath a flag whether the base path should be evaluated
*/
- public HomeDirectoryLocationStrategy(boolean withBasePath)
+ public HomeDirectoryLocationStrategy(final boolean withBasePath)
{
this(null, withBasePath);
}
@@ -121,12 +121,12 @@ public class HomeDirectoryLocationStrate
* <b>true</b>, a sub directory of the home directory is searched.
*/
@Override
- public URL locate(FileSystem fileSystem, FileLocator locator)
+ public URL locate(final FileSystem fileSystem, final FileLocator locator)
{
if (StringUtils.isNotEmpty(locator.getFileName()))
{
- String basePath = fetchBasePath(locator);
- File file =
+ final String basePath = fetchBasePath(locator);
+ final File file =
FileLocatorUtils.constructFile(basePath,
locator.getFileName());
if (file.isFile())
@@ -144,7 +144,7 @@ public class HomeDirectoryLocationStrate
* @param locator the {@code FileLocator}
* @return the base path to be used
*/
- private String fetchBasePath(FileLocator locator)
+ private String fetchBasePath(final FileLocator locator)
{
if (isEvaluateBasePath()
&& StringUtils.isNotEmpty(locator.getBasePath()))
@@ -163,7 +163,7 @@ public class HomeDirectoryLocationStrate
* @param homeDir the passed in home directory
* @return the directory to be used
*/
- private static String fetchHomeDirectory(String homeDir)
+ private static String fetchHomeDirectory(final String homeDir)
{
return (homeDir != null) ? homeDir : System.getProperty(PROP_HOME);
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/ProvidedURLLocationStrategy.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/ProvidedURLLocationStrategy.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/ProvidedURLLocationStrategy.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/ProvidedURLLocationStrategy.java Thu Sep 27 22:24:23 2018
@@ -41,7 +41,7 @@ public class ProvidedURLLocationStrategy
* given {@code FileLocator}.
*/
@Override
- public URL locate(FileSystem fileSystem, FileLocator locator)
+ public URL locate(final FileSystem fileSystem, final FileLocator locator)
{
return locator.getSourceURL();
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/VFSFileSystem.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/VFSFileSystem.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/VFSFileSystem.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/VFSFileSystem.java Thu Sep 27 22:24:23 2018
@@ -59,48 +59,48 @@ public class VFSFileSystem extends Defau
}
@Override
- public InputStream getInputStream(URL url) throws ConfigurationException
+ public InputStream getInputStream(final URL url) throws ConfigurationException
{
FileObject file;
try
{
- FileSystemOptions opts = getOptions(url.getProtocol());
+ final FileSystemOptions opts = getOptions(url.getProtocol());
file = (opts == null) ? VFS.getManager().resolveFile(url.toString())
: VFS.getManager().resolveFile(url.toString(), opts);
if (file.getType() != FileType.FILE)
{
throw new ConfigurationException("Cannot load a configuration from a directory");
}
- FileContent content = file.getContent();
+ final FileContent content = file.getContent();
if (content == null)
{
- String msg = "Cannot access content of " + file.getName().getFriendlyURI();
+ final String msg = "Cannot access content of " + file.getName().getFriendlyURI();
throw new ConfigurationException(msg);
}
return content.getInputStream();
}
- catch (FileSystemException fse)
+ catch (final FileSystemException fse)
{
- String msg = "Unable to access " + url.toString();
+ final String msg = "Unable to access " + url.toString();
throw new ConfigurationException(msg, fse);
}
}
@Override
- public OutputStream getOutputStream(URL url) throws ConfigurationException
+ public OutputStream getOutputStream(final URL url) throws ConfigurationException
{
try
{
- FileSystemOptions opts = getOptions(url.getProtocol());
- FileSystemManager fsManager = VFS.getManager();
- FileObject file = (opts == null) ? fsManager.resolveFile(url.toString())
+ final FileSystemOptions opts = getOptions(url.getProtocol());
+ final FileSystemManager fsManager = VFS.getManager();
+ final FileObject file = (opts == null) ? fsManager.resolveFile(url.toString())
: fsManager.resolveFile(url.toString(), opts);
// throw an exception if the target URL is a directory
if (file == null || file.getType() == FileType.FOLDER)
{
throw new ConfigurationException("Cannot save a configuration to a directory");
}
- FileContent content = file.getContent();
+ final FileContent content = file.getContent();
if (content == null)
{
@@ -108,14 +108,14 @@ public class VFSFileSystem extends Defau
}
return content.getOutputStream();
}
- catch (FileSystemException fse)
+ catch (final FileSystemException fse)
{
throw new ConfigurationException("Unable to access " + url, fse);
}
}
@Override
- public String getPath(File file, URL url, String basePath, String fileName)
+ public String getPath(final File file, final URL url, final String basePath, final String fileName)
{
if (file != null)
{
@@ -123,10 +123,10 @@ public class VFSFileSystem extends Defau
}
try
{
- FileSystemManager fsManager = VFS.getManager();
+ final FileSystemManager fsManager = VFS.getManager();
if (url != null)
{
- FileName name = fsManager.resolveURI(url.toString());
+ final FileName name = fsManager.resolveURI(url.toString());
if (name != null)
{
return name.toString();
@@ -139,17 +139,17 @@ public class VFSFileSystem extends Defau
}
else if (basePath != null)
{
- FileName base = fsManager.resolveURI(basePath);
+ final FileName base = fsManager.resolveURI(basePath);
return fsManager.resolveName(base, fileName).getURI();
}
else
{
- FileName name = fsManager.resolveURI(fileName);
- FileName base = name.getParent();
+ final FileName name = fsManager.resolveURI(fileName);
+ final FileName base = name.getParent();
return fsManager.resolveName(base, name.getBaseName()).getURI();
}
}
- catch (FileSystemException fse)
+ catch (final FileSystemException fse)
{
fse.printStackTrace();
return null;
@@ -157,7 +157,7 @@ public class VFSFileSystem extends Defau
}
@Override
- public String getBasePath(String path)
+ public String getBasePath(final String path)
{
if (UriParser.extractScheme(path) == null)
{
@@ -165,11 +165,11 @@ public class VFSFileSystem extends Defau
}
try
{
- FileSystemManager fsManager = VFS.getManager();
- FileName name = fsManager.resolveURI(path);
+ final FileSystemManager fsManager = VFS.getManager();
+ final FileName name = fsManager.resolveURI(path);
return name.getParent().getURI();
}
- catch (FileSystemException fse)
+ catch (final FileSystemException fse)
{
fse.printStackTrace();
return null;
@@ -177,7 +177,7 @@ public class VFSFileSystem extends Defau
}
@Override
- public String getFileName(String path)
+ public String getFileName(final String path)
{
if (UriParser.extractScheme(path) == null)
{
@@ -185,11 +185,11 @@ public class VFSFileSystem extends Defau
}
try
{
- FileSystemManager fsManager = VFS.getManager();
- FileName name = fsManager.resolveURI(path);
+ final FileSystemManager fsManager = VFS.getManager();
+ final FileName name = fsManager.resolveURI(path);
return name.getBaseName();
}
- catch (FileSystemException fse)
+ catch (final FileSystemException fse)
{
fse.printStackTrace();
return null;
@@ -197,7 +197,7 @@ public class VFSFileSystem extends Defau
}
@Override
- public URL getURL(String basePath, String file) throws MalformedURLException
+ public URL getURL(final String basePath, final String file) throws MalformedURLException
{
if ((basePath != null && UriParser.extractScheme(basePath) == null)
|| (basePath == null && UriParser.extractScheme(file) == null))
@@ -206,12 +206,12 @@ public class VFSFileSystem extends Defau
}
try
{
- FileSystemManager fsManager = VFS.getManager();
+ final FileSystemManager fsManager = VFS.getManager();
FileName path;
if (basePath != null && UriParser.extractScheme(file) == null)
{
- FileName base = fsManager.resolveURI(basePath);
+ final FileName base = fsManager.resolveURI(basePath);
path = fsManager.resolveName(base, file);
}
else
@@ -219,10 +219,10 @@ public class VFSFileSystem extends Defau
path = fsManager.resolveURI(file);
}
- URLStreamHandler handler = new VFSURLStreamHandler(path);
+ final URLStreamHandler handler = new VFSURLStreamHandler(path);
return new URL(null, path.getURI(), handler);
}
- catch (FileSystemException fse)
+ catch (final FileSystemException fse)
{
throw new ConfigurationRuntimeException("Could not parse basePath: " + basePath
+ " and fileName: " + file, fse);
@@ -230,9 +230,9 @@ public class VFSFileSystem extends Defau
}
@Override
- public URL locateFromURL(String basePath, String fileName)
+ public URL locateFromURL(final String basePath, final String fileName)
{
- String fileScheme = UriParser.extractScheme(fileName);
+ final String fileScheme = UriParser.extractScheme(fileName);
// Use DefaultFileSystem if basePath and fileName don't have a scheme.
if ((basePath == null || UriParser.extractScheme(basePath) == null) && fileScheme == null)
@@ -241,14 +241,14 @@ public class VFSFileSystem extends Defau
}
try
{
- FileSystemManager fsManager = VFS.getManager();
+ final FileSystemManager fsManager = VFS.getManager();
FileObject file;
// Only use the base path if the file name doesn't have a scheme.
if (basePath != null && fileScheme == null)
{
- String scheme = UriParser.extractScheme(basePath);
- FileSystemOptions opts = (scheme != null) ? getOptions(scheme) : null;
+ final String scheme = UriParser.extractScheme(basePath);
+ final FileSystemOptions opts = (scheme != null) ? getOptions(scheme) : null;
FileObject base = (opts == null) ? fsManager.resolveFile(basePath)
: fsManager.resolveFile(basePath, opts);
if (base.getType() == FileType.FILE)
@@ -260,7 +260,7 @@ public class VFSFileSystem extends Defau
}
else
{
- FileSystemOptions opts = (fileScheme != null) ? getOptions(fileScheme) : null;
+ final FileSystemOptions opts = (fileScheme != null) ? getOptions(fileScheme) : null;
file = (opts == null) ? fsManager.resolveFile(fileName)
: fsManager.resolveFile(fileName, opts);
}
@@ -269,42 +269,42 @@ public class VFSFileSystem extends Defau
{
return null;
}
- FileName path = file.getName();
- URLStreamHandler handler = new VFSURLStreamHandler(path);
+ final FileName path = file.getName();
+ final URLStreamHandler handler = new VFSURLStreamHandler(path);
return new URL(null, path.getURI(), handler);
}
- catch (FileSystemException fse)
+ catch (final FileSystemException fse)
{
return null;
}
- catch (MalformedURLException ex)
+ catch (final MalformedURLException ex)
{
return null;
}
}
- private FileSystemOptions getOptions(String scheme)
+ private FileSystemOptions getOptions(final String scheme)
{
- FileSystemOptions opts = new FileSystemOptions();
+ final FileSystemOptions opts = new FileSystemOptions();
FileSystemConfigBuilder builder;
try
{
builder = VFS.getManager().getFileSystemConfigBuilder(scheme);
}
- catch (Exception ex)
+ catch (final Exception ex)
{
return null;
}
- FileOptionsProvider provider = getFileOptionsProvider();
+ final FileOptionsProvider provider = getFileOptionsProvider();
if (provider != null)
{
- Map<String, Object> map = provider.getOptions();
+ final Map<String, Object> map = provider.getOptions();
if (map == null)
{
return null;
}
int count = 0;
- for (Map.Entry<String, Object> entry : map.entrySet())
+ for (final Map.Entry<String, Object> entry : map.entrySet())
{
try
{
@@ -316,7 +316,7 @@ public class VFSFileSystem extends Defau
setProperty(builder, opts, key, entry.getValue());
++count;
}
- catch (Exception ex)
+ catch (final Exception ex)
{
// Ignore an incorrect property.
continue;
@@ -331,23 +331,23 @@ public class VFSFileSystem extends Defau
}
- private void setProperty(FileSystemConfigBuilder builder, FileSystemOptions options,
- String key, Object value)
+ private void setProperty(final FileSystemConfigBuilder builder, final FileSystemOptions options,
+ final String key, final Object value)
{
- String methodName = "set" + key.substring(0, 1).toUpperCase() + key.substring(1);
- Class<?>[] paramTypes = new Class<?>[2];
+ final String methodName = "set" + key.substring(0, 1).toUpperCase() + key.substring(1);
+ final Class<?>[] paramTypes = new Class<?>[2];
paramTypes[0] = FileSystemOptions.class;
paramTypes[1] = value.getClass();
try
{
- Method method = builder.getClass().getMethod(methodName, paramTypes);
- Object[] params = new Object[2];
+ final Method method = builder.getClass().getMethod(methodName, paramTypes);
+ final Object[] params = new Object[2];
params[0] = options;
params[1] = value;
method.invoke(builder, params);
}
- catch (Exception ex)
+ catch (final Exception ex)
{
log.warn("Cannot access property '" + key + "'! Ignoring.", ex);
}
@@ -362,13 +362,13 @@ public class VFSFileSystem extends Defau
/** The Protocol used */
private final String protocol;
- public VFSURLStreamHandler(FileName file)
+ public VFSURLStreamHandler(final FileName file)
{
this.protocol = file.getScheme();
}
@Override
- protected URLConnection openConnection(URL url) throws IOException
+ protected URLConnection openConnection(final URL url) throws IOException
{
throw new IOException("VFS URLs can only be used with VFS APIs");
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java Thu Sep 27 22:24:23 2018
@@ -145,7 +145,7 @@ public class PropertyListConfiguration e
* @param c the configuration to copy
* @since 1.4
*/
- public PropertyListConfiguration(HierarchicalConfiguration<ImmutableNode> c)
+ public PropertyListConfiguration(final HierarchicalConfiguration<ImmutableNode> c)
{
super(c);
}
@@ -156,13 +156,13 @@ public class PropertyListConfiguration e
*
* @param root the root node
*/
- PropertyListConfiguration(ImmutableNode root)
+ PropertyListConfiguration(final ImmutableNode root)
{
super(new InMemoryNodeModel(root));
}
@Override
- protected void setPropertyInternal(String key, Object value)
+ protected void setPropertyInternal(final String key, final Object value)
{
// special case for byte arrays, they must be stored as is in the configuration
if (value instanceof byte[])
@@ -185,7 +185,7 @@ public class PropertyListConfiguration e
}
@Override
- protected void addPropertyInternal(String key, Object value)
+ protected void addPropertyInternal(final String key, final Object value)
{
if (value instanceof byte[])
{
@@ -198,26 +198,26 @@ public class PropertyListConfiguration e
}
@Override
- public void read(Reader in) throws ConfigurationException
+ public void read(final Reader in) throws ConfigurationException
{
- PropertyListParser parser = new PropertyListParser(in);
+ final PropertyListParser parser = new PropertyListParser(in);
try
{
- PropertyListConfiguration config = parser.parse();
+ final PropertyListConfiguration config = parser.parse();
getModel().setRootNode(
config.getNodeModel().getNodeHandler().getRootNode());
}
- catch (ParseException e)
+ catch (final ParseException e)
{
throw new ConfigurationException(e);
}
}
@Override
- public void write(Writer out) throws ConfigurationException
+ public void write(final Writer out) throws ConfigurationException
{
- PrintWriter writer = new PrintWriter(out);
- NodeHandler<ImmutableNode> handler = getModel().getNodeHandler();
+ final PrintWriter writer = new PrintWriter(out);
+ final NodeHandler<ImmutableNode> handler = getModel().getNodeHandler();
printNode(writer, 0, handler.getRootNode(), handler);
writer.flush();
}
@@ -225,17 +225,17 @@ public class PropertyListConfiguration e
/**
* Append a node to the writer, indented according to a specific level.
*/
- private void printNode(PrintWriter out, int indentLevel,
- ImmutableNode node, NodeHandler<ImmutableNode> handler)
+ private void printNode(final PrintWriter out, final int indentLevel,
+ final ImmutableNode node, final NodeHandler<ImmutableNode> handler)
{
- String padding = StringUtils.repeat(" ", indentLevel * INDENT_SIZE);
+ final String padding = StringUtils.repeat(" ", indentLevel * INDENT_SIZE);
if (node.getNodeName() != null)
{
out.print(padding + quoteString(node.getNodeName()) + " = ");
}
- List<ImmutableNode> children = new ArrayList<>(node.getChildren());
+ final List<ImmutableNode> children = new ArrayList<>(node.getChildren());
if (!children.isEmpty())
{
// skip a line, except for the root dictionary
@@ -247,15 +247,15 @@ public class PropertyListConfiguration e
out.println(padding + "{");
// display the children
- Iterator<ImmutableNode> it = children.iterator();
+ final Iterator<ImmutableNode> it = children.iterator();
while (it.hasNext())
{
- ImmutableNode child = it.next();
+ final ImmutableNode child = it.next();
printNode(out, indentLevel + 1, child, handler);
// add a semi colon for elements that are not dictionaries
- Object value = child.getValue();
+ final Object value = child.getValue();
if (value != null && !(value instanceof Map) && !(value instanceof Configuration))
{
out.println(";");
@@ -290,7 +290,7 @@ public class PropertyListConfiguration e
else
{
// display the leaf value
- Object value = node.getValue();
+ final Object value = node.getValue();
printValue(out, indentLevel, value);
}
}
@@ -298,14 +298,14 @@ public class PropertyListConfiguration e
/**
* Append a value to the writer, indented according to a specific level.
*/
- private void printValue(PrintWriter out, int indentLevel, Object value)
+ private void printValue(final PrintWriter out, final int indentLevel, final Object value)
{
- String padding = StringUtils.repeat(" ", indentLevel * INDENT_SIZE);
+ final String padding = StringUtils.repeat(" ", indentLevel * INDENT_SIZE);
if (value instanceof List)
{
out.print("( ");
- Iterator<?> it = ((List<?>) value).iterator();
+ final Iterator<?> it = ((List<?>) value).iterator();
while (it.hasNext())
{
printValue(out, indentLevel + 1, it.next());
@@ -318,7 +318,7 @@ public class PropertyListConfiguration e
}
else if (value instanceof PropertyListConfiguration)
{
- NodeHandler<ImmutableNode> handler =
+ final NodeHandler<ImmutableNode> handler =
((PropertyListConfiguration) value).getModel()
.getNodeHandler();
printNode(out, indentLevel, handler.getRootNode(), handler);
@@ -329,15 +329,15 @@ public class PropertyListConfiguration e
out.println();
out.println(padding + "{");
- ImmutableConfiguration config = (ImmutableConfiguration) value;
- Iterator<String> it = config.getKeys();
+ final ImmutableConfiguration config = (ImmutableConfiguration) value;
+ final Iterator<String> it = config.getKeys();
while (it.hasNext())
{
- String key = it.next();
- ImmutableNode node =
+ final String key = it.next();
+ final ImmutableNode node =
new ImmutableNode.Builder().name(key)
.value(config.getProperty(key)).create();
- InMemoryNodeModel tempModel = new InMemoryNodeModel(node);
+ final InMemoryNodeModel tempModel = new InMemoryNodeModel(node);
printNode(out, indentLevel + 1, node, tempModel.getNodeHandler());
out.println(";");
}
@@ -346,7 +346,7 @@ public class PropertyListConfiguration e
else if (value instanceof Map)
{
// display a Map as a dictionary
- Map<String, Object> map = transformMap((Map<?, ?>) value);
+ final Map<String, Object> map = transformMap((Map<?, ?>) value);
printValue(out, indentLevel, new MapConfiguration(map));
}
else if (value instanceof byte[])
@@ -415,13 +415,13 @@ public class PropertyListConfiguration e
* @return the parsed date
* @throws ParseException if an error occurred while parsing the string
*/
- static Date parseDate(String s) throws ParseException
+ static Date parseDate(final String s) throws ParseException
{
- Calendar cal = Calendar.getInstance();
+ final Calendar cal = Calendar.getInstance();
cal.clear();
int index = 0;
- for (DateComponentParser parser : DATE_PARSERS)
+ for (final DateComponentParser parser : DATE_PARSERS)
{
index += parser.parseComponent(s, index, cal);
}
@@ -436,11 +436,11 @@ public class PropertyListConfiguration e
* @param cal the calendar with the initialized date
* @return a string for this date
*/
- static String formatDate(Calendar cal)
+ static String formatDate(final Calendar cal)
{
- StringBuilder buf = new StringBuilder();
+ final StringBuilder buf = new StringBuilder();
- for (DateComponentParser element : DATE_PARSERS)
+ for (final DateComponentParser element : DATE_PARSERS)
{
element.formatComponent(buf, cal);
}
@@ -454,9 +454,9 @@ public class PropertyListConfiguration e
* @param date the date
* @return a string for this date
*/
- static String formatDate(Date date)
+ static String formatDate(final Date date)
{
- Calendar cal = Calendar.getInstance();
+ final Calendar cal = Calendar.getInstance();
cal.setTime(date);
return formatDate(cal);
}
@@ -469,10 +469,10 @@ public class PropertyListConfiguration e
* @param src the map to be converted
* @return the resulting map
*/
- private static Map<String, Object> transformMap(Map<?, ?> src)
+ private static Map<String, Object> transformMap(final Map<?, ?> src)
{
- Map<String, Object> dest = new HashMap<>();
- for (Map.Entry<?, ?> e : src.entrySet())
+ final Map<String, Object> dest = new HashMap<>();
+ for (final Map.Entry<?, ?> e : src.entrySet())
{
if (e.getKey() instanceof String)
{
@@ -522,10 +522,10 @@ public class PropertyListConfiguration e
* @param length the minimum length after the index
* @throws ParseException if the string is too short
*/
- protected void checkLength(String s, int index, int length)
+ protected void checkLength(final String s, final int index, final int length)
throws ParseException
{
- int len = (s == null) ? 0 : s.length();
+ final int len = (s == null) ? 0 : s.length();
if (index + length > len)
{
throw new ParseException("Input string too short: " + s
@@ -541,7 +541,7 @@ public class PropertyListConfiguration e
* @param num the number to add
* @param length the required length
*/
- protected void padNum(StringBuilder buf, int num, int length)
+ protected void padNum(final StringBuilder buf, final int num, final int length)
{
buf.append(StringUtils.leftPad(String.valueOf(num), length,
PAD_CHAR));
@@ -570,7 +570,7 @@ public class PropertyListConfiguration e
* @param calFld the calendar field code
* @param len the length of this field
*/
- public DateFieldParser(int calFld, int len)
+ public DateFieldParser(final int calFld, final int len)
{
this(calFld, len, 0);
}
@@ -583,7 +583,7 @@ public class PropertyListConfiguration e
* @param len the length of this field
* @param ofs an offset to add to the calendar field
*/
- public DateFieldParser(int calFld, int len, int ofs)
+ public DateFieldParser(final int calFld, final int len, final int ofs)
{
calendarField = calFld;
length = len;
@@ -591,13 +591,13 @@ public class PropertyListConfiguration e
}
@Override
- public void formatComponent(StringBuilder buf, Calendar cal)
+ public void formatComponent(final StringBuilder buf, final Calendar cal)
{
padNum(buf, cal.get(calendarField) + offset, length);
}
@Override
- public int parseComponent(String s, int index, Calendar cal)
+ public int parseComponent(final String s, final int index, final Calendar cal)
throws ParseException
{
checkLength(s, index, length);
@@ -608,7 +608,7 @@ public class PropertyListConfiguration e
- offset);
return length;
}
- catch (NumberFormatException nfex)
+ catch (final NumberFormatException nfex)
{
throw new ParseException("Invalid number: " + s + ", index "
+ index);
@@ -631,19 +631,19 @@ public class PropertyListConfiguration e
*
* @param sep the separator string
*/
- public DateSeparatorParser(String sep)
+ public DateSeparatorParser(final String sep)
{
separator = sep;
}
@Override
- public void formatComponent(StringBuilder buf, Calendar cal)
+ public void formatComponent(final StringBuilder buf, final Calendar cal)
{
buf.append(separator);
}
@Override
- public int parseComponent(String s, int index, Calendar cal)
+ public int parseComponent(final String s, final int index, final Calendar cal)
throws ParseException
{
checkLength(s, index, separator.length());
@@ -663,9 +663,9 @@ public class PropertyListConfiguration e
private static class DateTimeZoneParser extends DateComponentParser
{
@Override
- public void formatComponent(StringBuilder buf, Calendar cal)
+ public void formatComponent(final StringBuilder buf, final Calendar cal)
{
- TimeZone tz = cal.getTimeZone();
+ final TimeZone tz = cal.getTimeZone();
int ofs = tz.getRawOffset() / MILLIS_PER_MINUTE;
if (ofs < 0)
{
@@ -676,18 +676,18 @@ public class PropertyListConfiguration e
{
buf.append('+');
}
- int hour = ofs / MINUTES_PER_HOUR;
- int min = ofs % MINUTES_PER_HOUR;
+ final int hour = ofs / MINUTES_PER_HOUR;
+ final int min = ofs % MINUTES_PER_HOUR;
padNum(buf, hour, 2);
padNum(buf, min, 2);
}
@Override
- public int parseComponent(String s, int index, Calendar cal)
+ public int parseComponent(final String s, final int index, final Calendar cal)
throws ParseException
{
checkLength(s, index, TIME_ZONE_LENGTH);
- TimeZone tz = TimeZone.getTimeZone(TIME_ZONE_PREFIX
+ final TimeZone tz = TimeZone.getTimeZone(TIME_ZONE_PREFIX
+ s.substring(index, index + TIME_ZONE_LENGTH));
cal.setTimeZone(tz);
return TIME_ZONE_LENGTH;
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java Thu Sep 27 22:24:23 2018
@@ -155,7 +155,7 @@ public class XMLPropertyListConfiguratio
* @param configuration the configuration to copy
* @since 1.4
*/
- public XMLPropertyListConfiguration(HierarchicalConfiguration<ImmutableNode> configuration)
+ public XMLPropertyListConfiguration(final HierarchicalConfiguration<ImmutableNode> configuration)
{
super(configuration);
}
@@ -166,13 +166,13 @@ public class XMLPropertyListConfiguratio
*
* @param root the root node
*/
- XMLPropertyListConfiguration(ImmutableNode root)
+ XMLPropertyListConfiguration(final ImmutableNode root)
{
super(new InMemoryNodeModel(root));
}
@Override
- protected void setPropertyInternal(String key, Object value)
+ protected void setPropertyInternal(final String key, final Object value)
{
// special case for byte arrays, they must be stored as is in the configuration
if (value instanceof byte[])
@@ -195,7 +195,7 @@ public class XMLPropertyListConfiguratio
}
@Override
- protected void addPropertyInternal(String key, Object value)
+ protected void addPropertyInternal(final String key, final Object value)
{
if (value instanceof byte[] || value instanceof List)
{
@@ -218,19 +218,19 @@ public class XMLPropertyListConfiguratio
* @param locator the current {@code FileLocator}
*/
@Override
- public void initFileLocator(FileLocator locator)
+ public void initFileLocator(final FileLocator locator)
{
this.locator = locator;
}
@Override
- public void read(Reader in) throws ConfigurationException
+ public void read(final Reader in) throws ConfigurationException
{
// set up the DTD validation
- EntityResolver resolver = new EntityResolver()
+ final EntityResolver resolver = new EntityResolver()
{
@Override
- public InputSource resolveEntity(String publicId, String systemId)
+ public InputSource resolveEntity(final String publicId, final String systemId)
{
return new InputSource(getClass().getClassLoader()
.getResourceAsStream("PropertyList-1.0.dtd"));
@@ -238,13 +238,13 @@ public class XMLPropertyListConfiguratio
};
// parse the file
- XMLPropertyListHandler handler = new XMLPropertyListHandler();
+ final XMLPropertyListHandler handler = new XMLPropertyListHandler();
try
{
- SAXParserFactory factory = SAXParserFactory.newInstance();
+ final SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(true);
- SAXParser parser = factory.newSAXParser();
+ final SAXParser parser = factory.newSAXParser();
parser.getXMLReader().setEntityResolver(resolver);
parser.getXMLReader().setContentHandler(handler);
parser.getXMLReader().parse(new InputSource(in));
@@ -252,7 +252,7 @@ public class XMLPropertyListConfiguratio
getNodeModel().mergeRoot(handler.getResultBuilder().createNode(),
null, null, null, this);
}
- catch (Exception e)
+ catch (final Exception e)
{
throw new ConfigurationException(
"Unable to parse the configuration file", e);
@@ -260,7 +260,7 @@ public class XMLPropertyListConfiguratio
}
@Override
- public void write(Writer out) throws ConfigurationException
+ public void write(final Writer out) throws ConfigurationException
{
if (locator == null)
{
@@ -268,7 +268,7 @@ public class XMLPropertyListConfiguratio
+ "initialized! Do not call write(Writer) directly,"
+ " but use a FileHandler to save a configuration.");
}
- PrintWriter writer = new PrintWriter(out);
+ final PrintWriter writer = new PrintWriter(out);
if (locator.getEncoding() != null)
{
@@ -291,24 +291,24 @@ public class XMLPropertyListConfiguratio
/**
* Append a node to the writer, indented according to a specific level.
*/
- private void printNode(PrintWriter out, int indentLevel, ImmutableNode node)
+ private void printNode(final PrintWriter out, final int indentLevel, final ImmutableNode node)
{
- String padding = StringUtils.repeat(" ", indentLevel * INDENT_SIZE);
+ final String padding = StringUtils.repeat(" ", indentLevel * INDENT_SIZE);
if (node.getNodeName() != null)
{
out.println(padding + "<key>" + StringEscapeUtils.escapeXml10(node.getNodeName()) + "</key>");
}
- List<ImmutableNode> children = node.getChildren();
+ final List<ImmutableNode> children = node.getChildren();
if (!children.isEmpty())
{
out.println(padding + "<dict>");
- Iterator<ImmutableNode> it = children.iterator();
+ final Iterator<ImmutableNode> it = children.iterator();
while (it.hasNext())
{
- ImmutableNode child = it.next();
+ final ImmutableNode child = it.next();
printNode(out, indentLevel + 1, child);
if (it.hasNext())
@@ -325,7 +325,7 @@ public class XMLPropertyListConfiguratio
}
else
{
- Object value = node.getValue();
+ final Object value = node.getValue();
printValue(out, indentLevel, value);
}
}
@@ -333,9 +333,9 @@ public class XMLPropertyListConfiguratio
/**
* Append a value to the writer, indented according to a specific level.
*/
- private void printValue(PrintWriter out, int indentLevel, Object value)
+ private void printValue(final PrintWriter out, final int indentLevel, final Object value)
{
- String padding = StringUtils.repeat(" ", indentLevel * INDENT_SIZE);
+ final String padding = StringUtils.repeat(" ", indentLevel * INDENT_SIZE);
if (value instanceof Date)
{
@@ -373,7 +373,7 @@ public class XMLPropertyListConfiguratio
else if (value instanceof List)
{
out.println(padding + "<array>");
- for (Object o : (List<?>) value)
+ for (final Object o : (List<?>) value)
{
printValue(out, indentLevel + 1, o);
}
@@ -383,6 +383,7 @@ public class XMLPropertyListConfiguratio
{
// This is safe because we have created this configuration
@SuppressWarnings("unchecked")
+ final
HierarchicalConfiguration<ImmutableNode> config =
(HierarchicalConfiguration<ImmutableNode>) value;
printNode(out, indentLevel, config.getNodeModel().getNodeHandler()
@@ -393,13 +394,13 @@ public class XMLPropertyListConfiguratio
// display a flat Configuration as a dictionary
out.println(padding + "<dict>");
- ImmutableConfiguration config = (ImmutableConfiguration) value;
- Iterator<String> it = config.getKeys();
+ final ImmutableConfiguration config = (ImmutableConfiguration) value;
+ final Iterator<String> it = config.getKeys();
while (it.hasNext())
{
// create a node for each property
- String key = it.next();
- ImmutableNode node =
+ final String key = it.next();
+ final ImmutableNode node =
new ImmutableNode.Builder().name(key)
.value(config.getProperty(key)).create();
@@ -416,7 +417,7 @@ public class XMLPropertyListConfiguratio
else if (value instanceof Map)
{
// display a Map as a dictionary
- Map<String, Object> map = transformMap((Map<?, ?>) value);
+ final Map<String, Object> map = transformMap((Map<?, ?>) value);
printValue(out, indentLevel, new MapConfiguration(map));
}
else if (value instanceof byte[])
@@ -426,7 +427,7 @@ public class XMLPropertyListConfiguratio
{
base64 = new String(Base64.encodeBase64((byte[]) value), DATA_ENCODING);
}
- catch (UnsupportedEncodingException e)
+ catch (final UnsupportedEncodingException e)
{
// Cannot happen as UTF-8 is a standard encoding
throw new AssertionError(e);
@@ -451,10 +452,10 @@ public class XMLPropertyListConfiguratio
* @param src the map to be converted
* @return the resulting map
*/
- private static Map<String, Object> transformMap(Map<?, ?> src)
+ private static Map<String, Object> transformMap(final Map<?, ?> src)
{
- Map<String, Object> dest = new HashMap<>();
- for (Map.Entry<?, ?> e : src.entrySet())
+ final Map<String, Object> dest = new HashMap<>();
+ for (final Map.Entry<?, ?> e : src.entrySet())
{
if (e.getKey() instanceof String)
{
@@ -515,7 +516,7 @@ public class XMLPropertyListConfiguratio
*/
private PListNodeBuilder peekNE()
{
- PListNodeBuilder result = peek();
+ final PListNodeBuilder result = peek();
if (result == null)
{
throw new ConfigurationRuntimeException("Access to empty stack!");
@@ -538,13 +539,13 @@ public class XMLPropertyListConfiguratio
/**
* Put a node on the top of the stack.
*/
- private void push(PListNodeBuilder node)
+ private void push(final PListNodeBuilder node)
{
stack.add(node);
}
@Override
- public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
+ public void startElement(final String uri, final String localName, final String qName, final Attributes attributes) throws SAXException
{
if ("array".equals(qName))
{
@@ -561,12 +562,12 @@ public class XMLPropertyListConfiguratio
}
@Override
- public void endElement(String uri, String localName, String qName) throws SAXException
+ public void endElement(final String uri, final String localName, final String qName) throws SAXException
{
if ("key".equals(qName))
{
// create a new node, link it to its parent and push it on the stack
- PListNodeBuilder node = new PListNodeBuilder();
+ final PListNodeBuilder node = new PListNodeBuilder();
node.setName(buffer.toString());
peekNE().addChild(node);
push(node);
@@ -574,15 +575,15 @@ public class XMLPropertyListConfiguratio
else if ("dict".equals(qName))
{
// remove the root of the XMLPropertyListConfiguration previously pushed on the stack
- PListNodeBuilder builder = pop();
+ final PListNodeBuilder builder = pop();
assert builder != null : "Stack was empty!";
if (peek() instanceof ArrayNodeBuilder)
{
// create the configuration
- XMLPropertyListConfiguration config = new XMLPropertyListConfiguration(builder.createNode());
+ final XMLPropertyListConfiguration config = new XMLPropertyListConfiguration(builder.createNode());
// add it to the ArrayNodeBuilder
- ArrayNodeBuilder node = (ArrayNodeBuilder) peekNE();
+ final ArrayNodeBuilder node = (ArrayNodeBuilder) peekNE();
node.addValue(config);
}
}
@@ -618,7 +619,7 @@ public class XMLPropertyListConfiguratio
{
peekNE().addDateValue(buffer.toString());
}
- catch (IllegalArgumentException iex)
+ catch (final IllegalArgumentException iex)
{
getLogger().warn(
"Ignoring invalid date property " + buffer);
@@ -626,7 +627,7 @@ public class XMLPropertyListConfiguratio
}
else if ("array".equals(qName))
{
- ArrayNodeBuilder array = (ArrayNodeBuilder) pop();
+ final ArrayNodeBuilder array = (ArrayNodeBuilder) pop();
peekNE().addList(array);
}
@@ -642,7 +643,7 @@ public class XMLPropertyListConfiguratio
}
@Override
- public void characters(char[] ch, int start, int length) throws SAXException
+ public void characters(final char[] ch, final int start, final int length) throws SAXException
{
buffer.append(ch, start, length);
}
@@ -690,7 +691,7 @@ public class XMLPropertyListConfiguratio
*
* @param v the value to be added
*/
- public void addValue(Object v)
+ public void addValue(final Object v)
{
if (value == null)
{
@@ -700,12 +701,13 @@ public class XMLPropertyListConfiguratio
{
// This is safe because we create the collections ourselves
@SuppressWarnings("unchecked")
+ final
Collection<Object> collection = (Collection<Object>) value;
collection.add(v);
}
else
{
- List<Object> list = new ArrayList<>();
+ final List<Object> list = new ArrayList<>();
list.add(value);
list.add(v);
value = list;
@@ -718,7 +720,7 @@ public class XMLPropertyListConfiguratio
* @param value the value to be added
* @throws IllegalArgumentException if the date string cannot be parsed
*/
- public void addDateValue(String value)
+ public void addDateValue(final String value)
{
try
{
@@ -739,7 +741,7 @@ public class XMLPropertyListConfiguratio
}
}
}
- catch (ParseException e)
+ catch (final ParseException e)
{
throw new IllegalArgumentException(String.format(
"'%s' cannot be parsed to a date!", value), e);
@@ -752,13 +754,13 @@ public class XMLPropertyListConfiguratio
*
* @param value the value to be added
*/
- public void addDataValue(String value)
+ public void addDataValue(final String value)
{
try
{
addValue(Base64.decodeBase64(value.getBytes(DATA_ENCODING)));
}
- catch (UnsupportedEncodingException e)
+ catch (final UnsupportedEncodingException e)
{
//Cannot happen as UTF-8 is a default encoding
throw new AssertionError(e);
@@ -770,7 +772,7 @@ public class XMLPropertyListConfiguratio
*
* @param value the value to be added
*/
- public void addIntegerValue(String value)
+ public void addIntegerValue(final String value)
{
addValue(new BigInteger(value));
}
@@ -780,7 +782,7 @@ public class XMLPropertyListConfiguratio
*
* @param value the value to be added
*/
- public void addRealValue(String value)
+ public void addRealValue(final String value)
{
addValue(new BigDecimal(value));
}
@@ -806,7 +808,7 @@ public class XMLPropertyListConfiguratio
*
* @param node the node whose value will be added to the current node value
*/
- public void addList(ArrayNodeBuilder node)
+ public void addList(final ArrayNodeBuilder node)
{
addValue(node.getNodeValue());
}
@@ -816,7 +818,7 @@ public class XMLPropertyListConfiguratio
*
* @param nodeName the node name
*/
- public void setName(String nodeName)
+ public void setName(final String nodeName)
{
name = nodeName;
}
@@ -826,7 +828,7 @@ public class XMLPropertyListConfiguratio
*
* @param child the child builder to be added
*/
- public void addChild(PListNodeBuilder child)
+ public void addChild(final PListNodeBuilder child)
{
childBuilders.add(child);
}
@@ -838,9 +840,9 @@ public class XMLPropertyListConfiguratio
*/
public ImmutableNode createNode()
{
- ImmutableNode.Builder nodeBuilder =
+ final ImmutableNode.Builder nodeBuilder =
new ImmutableNode.Builder(childBuilders.size());
- for (PListNodeBuilder child : childBuilders)
+ for (final PListNodeBuilder child : childBuilders)
{
nodeBuilder.addChild(child.createNode());
}
@@ -875,7 +877,7 @@ public class XMLPropertyListConfiguratio
* @param value the value to be added
*/
@Override
- public void addValue(Object value)
+ public void addValue(final Object value)
{
list.add(value);
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/CombinedReloadingController.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/CombinedReloadingController.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/CombinedReloadingController.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/CombinedReloadingController.java Thu Sep 27 22:24:23 2018
@@ -75,7 +75,7 @@ public class CombinedReloadingController
* <b>null</b> or contains <b>null</b> entries
*/
public CombinedReloadingController(
- Collection<? extends ReloadingController> subCtrls)
+ final Collection<? extends ReloadingController> subCtrls)
{
super(DUMMY);
controllers = checkManagedControllers(subCtrls);
@@ -127,16 +127,16 @@ public class CombinedReloadingController
* <b>null</b> or contains <b>null</b> entries
*/
private static Collection<ReloadingController> checkManagedControllers(
- Collection<? extends ReloadingController> subCtrls)
+ final Collection<? extends ReloadingController> subCtrls)
{
if (subCtrls == null)
{
throw new IllegalArgumentException(
"Collection with sub controllers must not be null!");
}
- Collection<ReloadingController> ctrls =
+ final Collection<ReloadingController> ctrls =
new ArrayList<>(subCtrls);
- for (ReloadingController rc : ctrls)
+ for (final ReloadingController rc : ctrls)
{
if (rc == null)
{
@@ -165,7 +165,7 @@ public class CombinedReloadingController
*
* @param o the owner
*/
- public MultiReloadingControllerDetector(CombinedReloadingController o)
+ public MultiReloadingControllerDetector(final CombinedReloadingController o)
{
owner = o;
}
@@ -181,7 +181,7 @@ public class CombinedReloadingController
public boolean isReloadingRequired()
{
boolean result = false;
- for (ReloadingController rc : owner.getSubControllers())
+ for (final ReloadingController rc : owner.getSubControllers())
{
if (rc.checkForReloading(null))
{
@@ -198,7 +198,7 @@ public class CombinedReloadingController
@Override
public void reloadingPerformed()
{
- for (ReloadingController rc : owner.getSubControllers())
+ for (final ReloadingController rc : owner.getSubControllers())
{
rc.resetReloadingState();
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/FileHandlerReloadingDetector.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/FileHandlerReloadingDetector.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/FileHandlerReloadingDetector.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/FileHandlerReloadingDetector.java Thu Sep 27 22:24:23 2018
@@ -84,7 +84,7 @@ public class FileHandlerReloadingDetecto
* @param refreshDelay the refresh delay; a value of 0 means that a check is
* performed in all cases
*/
- public FileHandlerReloadingDetector(FileHandler handler, long refreshDelay)
+ public FileHandlerReloadingDetector(final FileHandler handler, final long refreshDelay)
{
fileHandler = (handler != null) ? handler : new FileHandler();
this.refreshDelay = refreshDelay;
@@ -98,7 +98,7 @@ public class FileHandlerReloadingDetecto
* @param handler the {@code FileHandler} associated with this detector (can
* be <b>null</b>)
*/
- public FileHandlerReloadingDetector(FileHandler handler)
+ public FileHandlerReloadingDetector(final FileHandler handler)
{
this(handler, DEFAULT_REFRESH_DELAY);
}
@@ -150,12 +150,12 @@ public class FileHandlerReloadingDetecto
@Override
public boolean isReloadingRequired()
{
- long now = System.currentTimeMillis();
+ final long now = System.currentTimeMillis();
if (now >= lastChecked + getRefreshDelay())
{
lastChecked = now;
- long modified = getLastModificationDate();
+ final long modified = getLastModificationDate();
if (modified > 0)
{
if (lastModified == 0)
@@ -205,7 +205,7 @@ public class FileHandlerReloadingDetecto
*/
protected long getLastModificationDate()
{
- File file = getExistingFile();
+ final File file = getExistingFile();
return (file != null) ? file.lastModified() : 0;
}
@@ -216,7 +216,7 @@ public class FileHandlerReloadingDetecto
*
* @param time the new last modification date
*/
- protected void updateLastModified(long time)
+ protected void updateLastModified(final long time)
{
lastModified = time;
}
@@ -232,7 +232,7 @@ public class FileHandlerReloadingDetecto
*/
protected File getFile()
{
- URL url = getFileHandler().getURL();
+ final URL url = getFileHandler().getURL();
return (url != null) ? fileFromURL(url) : getFileHandler().getFile();
}
@@ -259,17 +259,17 @@ public class FileHandlerReloadingDetecto
* @param url the URL to be converted
* @return the resulting file or <b>null </b>
*/
- private static File fileFromURL(URL url)
+ private static File fileFromURL(final URL url)
{
if (JAR_PROTOCOL.equals(url.getProtocol()))
{
- String path = url.getPath();
+ final String path = url.getPath();
try
{
return FileLocatorUtils.fileFromURL(new URL(path.substring(0,
path.indexOf('!'))));
}
- catch (MalformedURLException mex)
+ catch (final MalformedURLException mex)
{
return null;
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/PeriodicReloadingTrigger.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/PeriodicReloadingTrigger.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/PeriodicReloadingTrigger.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/PeriodicReloadingTrigger.java Thu Sep 27 22:24:23 2018
@@ -87,8 +87,8 @@ public class PeriodicReloadingTrigger
* default executor service is created
* @throws IllegalArgumentException if a required argument is missing
*/
- public PeriodicReloadingTrigger(ReloadingController ctrl, Object ctrlParam,
- long triggerPeriod, TimeUnit unit, ScheduledExecutorService exec)
+ public PeriodicReloadingTrigger(final ReloadingController ctrl, final Object ctrlParam,
+ final long triggerPeriod, final TimeUnit unit, final ScheduledExecutorService exec)
{
if (ctrl == null)
{
@@ -115,8 +115,8 @@ public class PeriodicReloadingTrigger
* @param unit the time unit for the period
* @throws IllegalArgumentException if a required argument is missing
*/
- public PeriodicReloadingTrigger(ReloadingController ctrl, Object ctrlParam,
- long triggerPeriod, TimeUnit unit)
+ public PeriodicReloadingTrigger(final ReloadingController ctrl, final Object ctrlParam,
+ final long triggerPeriod, final TimeUnit unit)
{
this(ctrl, ctrlParam, triggerPeriod, unit, null);
}
@@ -173,7 +173,7 @@ public class PeriodicReloadingTrigger
* @param shutdownExecutor a flag whether the associated
* {@code ScheduledExecutorService} is to be shut down
*/
- public void shutdown(boolean shutdownExecutor)
+ public void shutdown(final boolean shutdownExecutor)
{
stop();
if (shutdownExecutor)
@@ -228,7 +228,7 @@ public class PeriodicReloadingTrigger
*/
private static ScheduledExecutorService createDefaultExecutorService()
{
- ThreadFactory factory =
+ final ThreadFactory factory =
new BasicThreadFactory.Builder()
.namingPattern("ReloadingTrigger-%s").daemon(true)
.build();
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/ReloadingController.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/ReloadingController.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/ReloadingController.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/ReloadingController.java Thu Sep 27 22:24:23 2018
@@ -83,7 +83,7 @@ public class ReloadingController impleme
* @param detect the {@code ReloadingDetector} (must not be <b>null</b>)
* @throws IllegalArgumentException if the detector is undefined
*/
- public ReloadingController(ReloadingDetector detect)
+ public ReloadingController(final ReloadingDetector detect)
{
if (detect == null)
{
@@ -110,14 +110,14 @@ public class ReloadingController impleme
*/
@Override
public <T extends Event> void addEventListener(
- EventType<T> eventType, EventListener<? super T> listener)
+ final EventType<T> eventType, final EventListener<? super T> listener)
{
listeners.addEventListener(eventType, listener);
}
@Override
public <T extends Event> boolean removeEventListener(
- EventType<T> eventType, EventListener<? super T> listener)
+ final EventType<T> eventType, final EventListener<? super T> listener)
{
return listeners.removeEventListener(eventType, listener);
}
@@ -152,7 +152,7 @@ public class ReloadingController impleme
* @param data additional data for an event notification
* @return a flag whether a reload operation is necessary
*/
- public boolean checkForReloading(Object data)
+ public boolean checkForReloading(final Object data)
{
boolean sendEvent = false;
synchronized (this)
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/ReloadingEvent.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/ReloadingEvent.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/ReloadingEvent.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/ReloadingEvent.java Thu Sep 27 22:24:23 2018
@@ -53,7 +53,7 @@ public class ReloadingEvent extends Even
* @param addData an arbitrary data object to be evaluated by event
* listeners
*/
- public ReloadingEvent(ReloadingController source, Object addData)
+ public ReloadingEvent(final ReloadingController source, final Object addData)
{
super(source, ANY);
data = addData;
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/VFSFileHandlerReloadingDetector.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/VFSFileHandlerReloadingDetector.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/VFSFileHandlerReloadingDetector.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/reloading/VFSFileHandlerReloadingDetector.java Thu Sep 27 22:24:23 2018
@@ -70,8 +70,8 @@ public class VFSFileHandlerReloadingDete
* @param handler the {@code FileHandler}
* @param refreshDelay the refresh delay
*/
- public VFSFileHandlerReloadingDetector(FileHandler handler,
- long refreshDelay)
+ public VFSFileHandlerReloadingDetector(final FileHandler handler,
+ final long refreshDelay)
{
super(handler, refreshDelay);
}
@@ -82,7 +82,7 @@ public class VFSFileHandlerReloadingDete
*
* @param handler the {@code FileHandler}
*/
- public VFSFileHandlerReloadingDetector(FileHandler handler)
+ public VFSFileHandlerReloadingDetector(final FileHandler handler)
{
super(handler);
}
@@ -94,7 +94,7 @@ public class VFSFileHandlerReloadingDete
@Override
protected long getLastModificationDate()
{
- FileObject file = getFileObject();
+ final FileObject file = getFileObject();
try
{
if (file == null || !file.exists())
@@ -104,7 +104,7 @@ public class VFSFileHandlerReloadingDete
return file.getContent().getLastModifiedTime();
}
- catch (FileSystemException ex)
+ catch (final FileSystemException ex)
{
log.error("Unable to get last modified time for"
+ file.getName().getURI(), ex);
@@ -127,17 +127,17 @@ public class VFSFileHandlerReloadingDete
try
{
- FileSystemManager fsManager = VFS.getManager();
- String uri = resolveFileURI();
+ final FileSystemManager fsManager = VFS.getManager();
+ final String uri = resolveFileURI();
if (uri == null)
{
throw new ConfigurationRuntimeException("Unable to determine file to monitor");
}
return fsManager.resolveFile(uri);
}
- catch (FileSystemException fse)
+ catch (final FileSystemException fse)
{
- String msg = "Unable to monitor " + getFileHandler().getURL().toString();
+ final String msg = "Unable to monitor " + getFileHandler().getURL().toString();
log.error(msg);
throw new ConfigurationRuntimeException(msg, fse);
}
@@ -151,8 +151,8 @@ public class VFSFileHandlerReloadingDete
*/
protected String resolveFileURI()
{
- FileSystem fs = getFileHandler().getFileSystem();
- String uri =
+ final FileSystem fs = getFileHandler().getFileSystem();
+ final String uri =
fs.getPath(null, getFileHandler().getURL(), getFileHandler()
.getBasePath(), getFileHandler().getFileName());
return uri;