This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git
The following commit(s) were added to refs/heads/master by this push:
new aaebdac Remove dead comment. Inline single use local vars.
aaebdac is described below
commit aaebdac626a38a3e3a2c1661f2e95e1bc2e860f7
Author: Gary Gregory <[email protected]>
AuthorDate: Tue Mar 2 08:14:31 2021 -0500
Remove dead comment. Inline single use local vars.
---
.../vfs2/impl/StandardFileSystemManager.java | 25 +++++++++-------------
.../commons/vfs2/impl/URLStreamHandlerProxy.java | 3 +--
.../operations/AbstractFileOperationProvider.java | 4 +---
.../commons/vfs2/provider/AbstractFileObject.java | 2 --
4 files changed, 12 insertions(+), 22 deletions(-)
diff --git
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/StandardFileSystemManager.java
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/StandardFileSystemManager.java
index 5181f34..ceac054 100644
---
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/StandardFileSystemManager.java
+++
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/StandardFileSystemManager.java
@@ -120,14 +120,13 @@ public class StandardFileSystemManager extends
DefaultFileSystemManager {
protected void configurePlugins() throws FileSystemException {
final Enumeration<URL> enumResources;
try {
- enumResources = loadResources(PLUGIN_CONFIG_RESOURCE);
+ enumResources = enumerateResources(PLUGIN_CONFIG_RESOURCE);
} catch (final IOException e) {
throw new FileSystemException(e);
}
while (enumResources.hasMoreElements()) {
- final URL url = enumResources.nextElement();
- configure(url);
+ configure(enumResources.nextElement());
}
}
@@ -192,10 +191,7 @@ public class StandardFileSystemManager extends
DefaultFileSystemManager {
try {
// Load up the config
// TODO - validate
- final DocumentBuilder builder = createDocumentBuilder();
- final Element config =
builder.parse(configStream).getDocumentElement();
-
- configure(config);
+
configure(createDocumentBuilder().parse(configStream).getDocumentElement());
} catch (final Exception e) {
throw new FileSystemException("vfs.impl/load-config.error",
configUri, e);
@@ -418,8 +414,7 @@ public class StandardFileSystemManager extends
DefaultFileSystemManager {
*/
private Object createInstance(final String className) throws
FileSystemException {
try {
- final Class<?> clazz = loadClass(className);
- return clazz.newInstance();
+ return loadClass(className).newInstance();
} catch (final Exception e) {
throw new FileSystemException("vfs.impl/create-provider.error",
className, e);
}
@@ -440,17 +435,17 @@ public class StandardFileSystemManager extends
DefaultFileSystemManager {
}
/**
- * Resolve resources from different class loaders.
+ * Enumerates resources from different class loaders.
*
* @throws IOException if {@code getResource} failed.
* @see #findClassLoader()
*/
- private Enumeration<URL> loadResources(final String name) throws
IOException {
- Enumeration<URL> res = findClassLoader().getResources(name);
- if (res == null || !res.hasMoreElements()) {
- res = getValidClassLoader(getClass()).getResources(name);
+ private Enumeration<URL> enumerateResources(final String name) throws
IOException {
+ Enumeration<URL> enumeration = findClassLoader().getResources(name);
+ if (enumeration == null || !enumeration.hasMoreElements()) {
+ enumeration = getValidClassLoader(getClass()).getResources(name);
}
- return res;
+ return enumeration;
}
}
diff --git
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/URLStreamHandlerProxy.java
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/URLStreamHandlerProxy.java
index 8b92589..c547bc2 100644
---
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/URLStreamHandlerProxy.java
+++
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/URLStreamHandlerProxy.java
@@ -29,8 +29,7 @@ final class URLStreamHandlerProxy extends URLStreamHandler {
@Override
protected URLConnection openConnection(final URL url) throws IOException {
- final URL proxyURL = new URL(url.toExternalForm());
- return proxyURL.openConnection();
+ return new URL(url.toExternalForm()).openConnection();
}
@Override
diff --git
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/AbstractFileOperationProvider.java
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/AbstractFileOperationProvider.java
index 53a142f..cee7814 100644
---
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/AbstractFileOperationProvider.java
+++
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/AbstractFileOperationProvider.java
@@ -73,9 +73,7 @@ public abstract class AbstractFileOperationProvider
implements FileOperationProv
throws FileSystemException {
final Class<? extends FileOperation> implementation =
lookupOperation(operationClass);
- final FileOperation operationInstance = instantiateOperation(file,
implementation);
-
- return operationInstance;
+ return instantiateOperation(file, implementation);
}
/**
diff --git
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
index fab30d3..43e9f96 100644
---
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
+++
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
@@ -1871,8 +1871,6 @@ public abstract class AbstractFileObject<AFS extends
AbstractFileSystem> impleme
}
}
- // --- OPERATIONS ---
-
@Override
public boolean setWritable(final boolean readable, final boolean
ownerOnly) throws FileSystemException {
try {