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
commit 95ddecdfd55338ff3efdf8a6dda24fc10d2425d9 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sun Jul 21 17:21:57 2024 -0400 Remove redundant keywords Use final --- .../org/apache/commons/vfs2/tasks/DeleteTask.java | 6 +- .../org/apache/commons/vfs2/FileDepthSelector.java | 2 +- .../commons/vfs2/FileSystemConfigBuilder.java | 6 +- .../java/org/apache/commons/vfs2/NameScope.java | 2 +- .../apache/commons/vfs2/PatternFileSelector.java | 4 +- .../apache/commons/vfs2/filter/AndFileFilter.java | 12 +- .../apache/commons/vfs2/filter/OrFileFilter.java | 10 +- .../commons/vfs2/impl/DefaultFileMonitor.java | 168 ++++++++++----------- .../commons/vfs2/provider/AbstractFileName.java | 6 +- .../commons/vfs2/provider/AbstractFileObject.java | 2 +- .../commons/vfs2/provider/AbstractFileSystem.java | 2 +- .../commons/vfs2/provider/DefaultFileContent.java | 2 +- .../vfs2/provider/FileContentThreadData.java | 28 ++-- .../apache/commons/vfs2/provider/UriParser.java | 8 +- .../commons/vfs2/provider/ftp/FtpFileObject.java | 68 ++++----- .../commons/vfs2/provider/ftp/FtpFileType.java | 2 +- .../vfs2/provider/http5/Http5FileSystem.java | 2 +- .../vfs2/provider/jar/JarURLConnectionImpl.java | 6 +- .../commons/vfs2/provider/ram/RamFileData.java | 40 ++--- .../commons/vfs2/provider/ram/RamFileObject.java | 30 ++-- .../vfs2/provider/ram/RamFileOutputStream.java | 8 +- .../provider/ram/RamFileRandomAccessContent.java | 38 ++--- .../commons/vfs2/provider/ram/RamFileSystem.java | 24 +-- .../commons/vfs2/provider/sftp/SftpFileObject.java | 2 +- .../commons/vfs2/provider/sftp/SftpFileSystem.java | 16 +- .../provider/sftp/SftpFileSystemConfigBuilder.java | 10 +- .../commons/vfs2/provider/tar/TarFileSystem.java | 10 +- .../commons/vfs2/provider/zip/ZipFileSystem.java | 6 +- .../apache/commons/vfs2/util/PosixPermissions.java | 44 +++--- .../commons/vfs2/util/WeakRefFileListener.java | 4 +- .../org/apache/commons/vfs2/AbstractTestSuite.java | 2 +- .../java/org/apache/commons/vfs2/ContentTests.java | 6 +- .../java/org/apache/commons/vfs2/FileInfo.java | 2 +- .../java/org/apache/commons/vfs2/FileTypeTest.java | 2 +- .../commons/vfs2/IPv6LocalConnectionTests.java | 2 +- .../org/apache/commons/vfs2/PermissionsTests.java | 2 +- .../apache/commons/vfs2/ProviderDeleteTests.java | 2 +- .../commons/vfs2/ProviderRandomSetLengthTests.java | 4 +- .../org/apache/commons/vfs2/ProviderReadTests.java | 2 +- .../apache/commons/vfs2/VerifyingFileSelector.java | 2 +- .../ftps/AbstractFtpsProviderTestCase.java | 2 +- .../provider/ftps/FtpsMultipleConnectionTest.java | 4 +- .../ftps/NoProtocolSslConfigurationProxy.java | 10 +- .../vfs2/provider/ram/CustomRamProviderTest.java | 16 +- .../sftp/AbstractSftpProviderTestCase.java | 10 +- .../sftp/SftpProviderStreamProxyModeTestCase.java | 2 +- 46 files changed, 319 insertions(+), 319 deletions(-) diff --git a/commons-vfs2-ant/src/main/java/org/apache/commons/vfs2/tasks/DeleteTask.java b/commons-vfs2-ant/src/main/java/org/apache/commons/vfs2/tasks/DeleteTask.java index 7e07ea8c..7372344c 100644 --- a/commons-vfs2-ant/src/main/java/org/apache/commons/vfs2/tasks/DeleteTask.java +++ b/commons-vfs2-ant/src/main/java/org/apache/commons/vfs2/tasks/DeleteTask.java @@ -88,9 +88,9 @@ public class DeleteTask extends VfsTask { /** * Sets the source directory. * - * @param srcDir The source directory. + * @param srcDirUrl The source directory. */ - public void setSrcDir(final String srcDir) { - this.srcDirUrl = srcDir; + public void setSrcDir(final String srcDirUrl) { + this.srcDirUrl = srcDirUrl; } } diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileDepthSelector.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileDepthSelector.java index 88517313..50e262a8 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileDepthSelector.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileDepthSelector.java @@ -51,7 +51,7 @@ public class FileDepthSelector implements FileSelector { * @param maxDepth maximum depth */ public FileDepthSelector(final int minDepth, final int maxDepth) { - this.range = Range.between(minDepth, maxDepth); + range = Range.between(minDepth, maxDepth); } /** diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java index 4bc793ad..45410772 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java @@ -43,7 +43,7 @@ public abstract class FileSystemConfigBuilder { * @since 1.0 */ protected FileSystemConfigBuilder() { - this.prefix = PREFIX; + prefix = PREFIX; } /** @@ -54,7 +54,7 @@ public abstract class FileSystemConfigBuilder { * @since 2.0 */ protected FileSystemConfigBuilder(final String component) { - this.prefix = PREFIX + component; + prefix = PREFIX + component; } /** @@ -718,7 +718,7 @@ public abstract class FileSystemConfigBuilder { * @since 2.1 */ private String toPropertyKey(final String name) { - return this.prefix + name; + return prefix + name; } } diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/NameScope.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/NameScope.java index 190a4d9a..6dd85104 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/NameScope.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/NameScope.java @@ -60,7 +60,7 @@ public enum NameScope { private final String realName; NameScope(final String name) { - this.realName = name; + realName = name; } /** diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/PatternFileSelector.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/PatternFileSelector.java index 2871b2fe..c9eb3ca6 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/PatternFileSelector.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/PatternFileSelector.java @@ -89,12 +89,12 @@ public class PatternFileSelector implements FileSelector { */ @Override public boolean includeFile(final FileSelectInfo fileInfo) throws Exception { - return this.pattern.matcher(fileInfo.getFile().getName().getPath()).matches(); + return pattern.matcher(fileInfo.getFile().getName().getPath()).matches(); } @Override public String toString() { - return this.pattern.toString(); + return pattern.toString(); } /** diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/AndFileFilter.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/AndFileFilter.java index 43a77725..d6a514db 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/AndFileFilter.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/AndFileFilter.java @@ -49,7 +49,7 @@ public class AndFileFilter implements FileFilter, ConditionalFileFilter, Seriali * Default constructor. */ public AndFileFilter() { - this.fileFilters = new ArrayList<>(); + fileFilters = new ArrayList<>(); } /** @@ -66,7 +66,7 @@ public class AndFileFilter implements FileFilter, ConditionalFileFilter, Seriali throw new IllegalArgumentException("Null filters are not allowed"); } } - this.fileFilters = new ArrayList<>(Arrays.asList(filters)); + fileFilters = new ArrayList<>(Arrays.asList(filters)); } /** @@ -85,7 +85,7 @@ public class AndFileFilter implements FileFilter, ConditionalFileFilter, Seriali @Override public boolean accept(final FileSelectInfo fileSelectInfo) throws FileSystemException { - if (this.fileFilters.isEmpty()) { + if (fileFilters.isEmpty()) { return false; } for (final FileFilter fileFilter : fileFilters) { @@ -98,17 +98,17 @@ public class AndFileFilter implements FileFilter, ConditionalFileFilter, Seriali @Override public void addFileFilter(final FileFilter fileFilter) { - this.fileFilters.add(fileFilter); + fileFilters.add(fileFilter); } @Override public List<FileFilter> getFileFilters() { - return Collections.unmodifiableList(this.fileFilters); + return Collections.unmodifiableList(fileFilters); } @Override public boolean removeFileFilter(final FileFilter fileFilter) { - return this.fileFilters.remove(fileFilter); + return fileFilters.remove(fileFilter); } @Override diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/OrFileFilter.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/OrFileFilter.java index 16491b2a..c81210cd 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/OrFileFilter.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/OrFileFilter.java @@ -48,7 +48,7 @@ public class OrFileFilter implements FileFilter, ConditionalFileFilter, Serializ * Default constructor. */ public OrFileFilter() { - this.fileFilters = new ArrayList<>(); + fileFilters = new ArrayList<>(); } /** @@ -65,7 +65,7 @@ public class OrFileFilter implements FileFilter, ConditionalFileFilter, Serializ throw new IllegalArgumentException("Null filters are not allowed"); } } - this.fileFilters = new ArrayList<>(Arrays.asList(filters)); + fileFilters = new ArrayList<>(Arrays.asList(filters)); } /** @@ -94,17 +94,17 @@ public class OrFileFilter implements FileFilter, ConditionalFileFilter, Serializ @Override public void addFileFilter(final FileFilter fileFilter) { - this.fileFilters.add(fileFilter); + fileFilters.add(fileFilter); } @Override public List<FileFilter> getFileFilters() { - return Collections.unmodifiableList(this.fileFilters); + return Collections.unmodifiableList(fileFilters); } @Override public boolean removeFileFilter(final FileFilter fileFilter) { - return this.fileFilters.remove(fileFilter); + return fileFilters.remove(fileFilter); } @Override diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileMonitor.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileMonitor.java index bcbf190a..37a57c25 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileMonitor.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileMonitor.java @@ -92,70 +92,70 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable this.defaultFileMonitor = fm; this.fileObject = file; - this.refresh(); - this.resetChildrenList(); + refresh(); + resetChildrenList(); try { - this.exists = this.fileObject.exists(); + exists = fileObject.exists(); } catch (final FileSystemException fse) { - this.exists = false; - this.timestamp = -1; + exists = false; + timestamp = -1; } - if (this.exists) { + if (exists) { try { - this.timestamp = this.fileObject.getContent().getLastModifiedTime(); + timestamp = fileObject.getContent().getLastModifiedTime(); } catch (final FileSystemException fse) { - this.timestamp = -1; + timestamp = -1; } } } private void check() { - this.refresh(); + refresh(); try { // If the file existed and now doesn't - if (this.exists && !this.fileObject.exists()) { - this.exists = this.fileObject.exists(); - this.timestamp = -1; + if (exists && !fileObject.exists()) { + exists = fileObject.exists(); + timestamp = -1; // Fire delete event - ((AbstractFileSystem) this.fileObject.getFileSystem()).fireFileDeleted(this.fileObject); + ((AbstractFileSystem) fileObject.getFileSystem()).fireFileDeleted(fileObject); // Remove listener in case file is re-created. Don't want to fire twice. - if (this.defaultFileMonitor.getFileListener() != null) { - this.fileObject.getFileSystem().removeListener(this.fileObject, this.defaultFileMonitor.getFileListener()); + if (defaultFileMonitor.getFileListener() != null) { + fileObject.getFileSystem().removeListener(fileObject, defaultFileMonitor.getFileListener()); } // Remove from map - this.defaultFileMonitor.queueRemoveFile(this.fileObject); - } else if (this.exists && this.fileObject.exists()) { + defaultFileMonitor.queueRemoveFile(fileObject); + } else if (exists && fileObject.exists()) { // Check the timestamp to see if it has been modified - if (this.timestamp != this.fileObject.getContent().getLastModifiedTime()) { - this.timestamp = this.fileObject.getContent().getLastModifiedTime(); + if (timestamp != fileObject.getContent().getLastModifiedTime()) { + timestamp = fileObject.getContent().getLastModifiedTime(); // Fire change event // Don't fire if it's a folder because new file children // and deleted files in a folder have their own event triggered. - if (!this.fileObject.getType().hasChildren()) { - ((AbstractFileSystem) this.fileObject.getFileSystem()).fireFileChanged(this.fileObject); + if (!fileObject.getType().hasChildren()) { + ((AbstractFileSystem) fileObject.getFileSystem()).fireFileChanged(fileObject); } } - } else if (!this.exists && this.fileObject.exists()) { - this.exists = this.fileObject.exists(); - this.timestamp = this.fileObject.getContent().getLastModifiedTime(); + } else if (!exists && fileObject.exists()) { + exists = fileObject.exists(); + timestamp = fileObject.getContent().getLastModifiedTime(); // Don't fire if it's a folder because new file children // and deleted files in a folder have their own event triggered. - if (!this.fileObject.getType().hasChildren()) { - ((AbstractFileSystem) this.fileObject.getFileSystem()).fireFileCreated(this.fileObject); + if (!fileObject.getType().hasChildren()) { + ((AbstractFileSystem) fileObject.getFileSystem()).fireFileCreated(fileObject); } } - this.checkForNewChildren(); + checkForNewChildren(); } catch (final FileSystemException fse) { LOG.error(fse.getLocalizedMessage(), fse); @@ -167,9 +167,9 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable */ private void checkForNewChildren() { try { - if (this.fileObject.getType().hasChildren()) { - final FileObject[] newChildren = this.fileObject.getChildren(); - if (this.children != null) { + if (fileObject.getType().hasChildren()) { + final FileObject[] newChildren = fileObject.getChildren(); + if (children != null) { // See which new children are not listed in the current children map. final Map<FileName, Object> newChildrenMap = new HashMap<>(); final Stack<FileObject> missingChildren = new Stack<>(); @@ -177,27 +177,27 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable for (final FileObject element : newChildren) { newChildrenMap.put(element.getName(), new Object()); // null ? // If the child's not there - if (!this.children.containsKey(element.getName())) { + if (!children.containsKey(element.getName())) { missingChildren.push(element); } } - this.children = newChildrenMap; + children = newChildrenMap; // If there were missing children if (!missingChildren.empty()) { while (!missingChildren.empty()) { - this.fireAllCreate(missingChildren.pop()); + fireAllCreate(missingChildren.pop()); } } } else if (newChildren.length > 0) { // First set of children - Break out the cigars - this.children = new HashMap<>(); + children = new HashMap<>(); for (final FileObject element : newChildren) { - this.children.put(element.getName(), new Object()); // null? - this.fireAllCreate(element); + children.put(element.getName(), new Object()); // null? + fireAllCreate(element); } } } @@ -214,21 +214,21 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable */ private void fireAllCreate(final FileObject child) { // Add listener so that it can be triggered - if (this.defaultFileMonitor.getFileListener() != null) { - child.getFileSystem().addListener(child, this.defaultFileMonitor.getFileListener()); + if (defaultFileMonitor.getFileListener() != null) { + child.getFileSystem().addListener(child, defaultFileMonitor.getFileListener()); } ((AbstractFileSystem) child.getFileSystem()).fireFileCreated(child); // Remove it because a listener is added in the queueAddFile - if (this.defaultFileMonitor.getFileListener() != null) { - child.getFileSystem().removeListener(child, this.defaultFileMonitor.getFileListener()); + if (defaultFileMonitor.getFileListener() != null) { + child.getFileSystem().removeListener(child, defaultFileMonitor.getFileListener()); } - this.defaultFileMonitor.queueAddFile(child); // Add + defaultFileMonitor.queueAddFile(child); // Add try { - if (this.defaultFileMonitor.isRecursive() && child.getType().hasChildren()) { + if (defaultFileMonitor.isRecursive() && child.getType().hasChildren()) { Stream.of(child.getChildren()).forEach(this::fireAllCreate); } } catch (final FileSystemException fse) { @@ -241,7 +241,7 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable */ private void refresh() { try { - this.fileObject.refresh(); + fileObject.refresh(); } catch (final FileSystemException fse) { LOG.error(fse.getLocalizedMessage(), fse); } @@ -249,14 +249,14 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable private void resetChildrenList() { try { - if (this.fileObject.getType().hasChildren()) { - this.children = new HashMap<>(); - for (final FileObject element : this.fileObject.getChildren()) { - this.children.put(element.getName(), new Object()); // null? + if (fileObject.getType().hasChildren()) { + children = new HashMap<>(); + for (final FileObject element : fileObject.getChildren()) { + children.put(element.getName(), new Object()); // null? } } } catch (final FileSystemException fse) { - this.children = null; + children = null; } } @@ -329,16 +329,16 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable */ @Override public void addFile(final FileObject file) { - synchronized (this.monitorMap) { - if (this.monitorMap.get(file.getName()) == null) { - this.monitorMap.put(file.getName(), new FileMonitorAgent(this, file)); + synchronized (monitorMap) { + if (monitorMap.get(file.getName()) == null) { + monitorMap.put(file.getName(), new FileMonitorAgent(this, file)); try { - if (this.listener != null) { - file.getFileSystem().addListener(file, this.listener); + if (listener != null) { + file.getFileSystem().addListener(file, listener); } - if (file.getType().hasChildren() && this.recursive) { + if (file.getType().hasChildren() && recursive) { // Traverse the children // Add depth first Stream.of(file.getChildren()).forEach(this::addFile); @@ -354,15 +354,15 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable @Override public void close() { - this.runFlag = false; - if (this.monitorThread != null) { - this.monitorThread.interrupt(); + runFlag = false; + if (monitorThread != null) { + monitorThread.interrupt(); try { - this.monitorThread.join(); + monitorThread.join(); } catch (final InterruptedException e) { // ignore } - this.monitorThread = null; + monitorThread = null; } } @@ -401,7 +401,7 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable * @return The FileListener. */ FileListener getFileListener() { - return this.listener; + return listener; } /** @@ -410,7 +410,7 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable * @return true if monitoring is enabled for children. */ public boolean isRecursive() { - return this.recursive; + return recursive; } /** @@ -419,7 +419,7 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable * @param file The FileObject to add. */ protected void queueAddFile(final FileObject file) { - this.addStack.push(file); + addStack.push(file); } /** @@ -428,7 +428,7 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable * @param file The FileObject to be removed from being monitored. */ protected void queueRemoveFile(final FileObject file) { - this.deleteStack.push(file); + deleteStack.push(file); } /** @@ -438,9 +438,9 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable */ @Override public void removeFile(final FileObject file) { - synchronized (this.monitorMap) { + synchronized (monitorMap) { final FileName fn = file.getName(); - if (this.monitorMap.get(fn) != null) { + if (monitorMap.get(fn) != null) { FileObject parent; try { parent = file.getParent(); @@ -448,10 +448,10 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable parent = null; } - this.monitorMap.remove(fn); + monitorMap.remove(fn); if (parent != null) { // Not the root - final FileMonitorAgent parentAgent = this.monitorMap.get(parent.getName()); + final FileMonitorAgent parentAgent = monitorMap.get(parent.getName()); if (parentAgent != null) { parentAgent.resetChildrenList(); } @@ -465,17 +465,17 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable */ @Override public void run() { - mainloop: while (!monitorThread.isInterrupted() && this.runFlag) { + mainloop: while (!monitorThread.isInterrupted() && runFlag) { // For each entry in the map final Object[] fileNames; - synchronized (this.monitorMap) { - fileNames = this.monitorMap.keySet().toArray(); + synchronized (monitorMap) { + fileNames = monitorMap.keySet().toArray(); } for (int iterFileNames = 0; iterFileNames < fileNames.length; iterFileNames++) { final FileName fileName = (FileName) fileNames[iterFileNames]; final FileMonitorAgent agent; - synchronized (this.monitorMap) { - agent = this.monitorMap.get(fileName); + synchronized (monitorMap) { + agent = monitorMap.get(fileName); } if (agent != null) { agent.check(); @@ -489,17 +489,17 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable } } - if (monitorThread.isInterrupted() || !this.runFlag) { + if (monitorThread.isInterrupted() || !runFlag) { continue mainloop; } } - while (!this.addStack.empty()) { - this.addFile(this.addStack.pop()); + while (!addStack.empty()) { + addFile(addStack.pop()); } - while (!this.deleteStack.empty()) { - this.removeFile(this.deleteStack.pop()); + while (!deleteStack.empty()) { + removeFile(deleteStack.pop()); } try { @@ -509,7 +509,7 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable } } - this.runFlag = true; + runFlag = true; } /** @@ -548,19 +548,19 @@ public class DefaultFileMonitor implements Runnable, FileMonitor, AutoCloseable * @param newRecursive true if monitoring should be enabled for children. */ public void setRecursive(final boolean newRecursive) { - this.recursive = newRecursive; + recursive = newRecursive; } /** * Starts monitoring the files that have been added. */ public synchronized void start() { - if (this.monitorThread == null) { - this.monitorThread = new Thread(this); - this.monitorThread.setDaemon(true); - this.monitorThread.setPriority(Thread.MIN_PRIORITY); + if (monitorThread == null) { + monitorThread = new Thread(this); + monitorThread.setDaemon(true); + monitorThread.setPriority(Thread.MIN_PRIORITY); } - this.monitorThread.start(); + monitorThread.start(); } /** diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java index 7356b319..3c683195 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java @@ -100,11 +100,11 @@ public abstract class AbstractFileName implements FileName { * @param type the file type. */ public AbstractFileName(final String scheme, final String absolutePath, final FileType type) { - this.rootUri = null; + rootUri = null; this.scheme = scheme; this.type = type; if (StringUtils.isEmpty(absolutePath)) { - this.absPath = ROOT_PATH; + absPath = ROOT_PATH; } else if (absolutePath.length() > 1 && absolutePath.endsWith("/")) { this.absPath = absolutePath.substring(0, absolutePath.length() - 1); } else { @@ -505,7 +505,7 @@ public abstract class AbstractFileName implements FileName { @Override public boolean isFile() throws FileSystemException { // Use equals instead of == to avoid any class loader worries. - return FileType.FILE.equals(this.getType()); + return FileType.FILE.equals(getType()); } /** 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 6c405da3..6a65d460 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 @@ -1835,7 +1835,7 @@ public abstract class AbstractFileObject<AFS extends AbstractFileSystem> impleme @Override public FileObject resolveFile(final String name, final NameScope scope) throws FileSystemException { // return fs.resolveFile(this.name.resolveName(name, scope)); - return fileSystem.resolveFile(fileSystem.getFileSystemManager().resolveName(this.fileName, name, scope)); + return fileSystem.resolveFile(fileSystem.getFileSystemManager().resolveName(fileName, name, scope)); } private FileObject[] resolveFiles(final FileName[] children) throws FileSystemException { diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java index 3d0ca8e1..e505d281 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java @@ -301,7 +301,7 @@ public abstract class AbstractFileSystem extends AbstractVfsComponent implements } FileSystemKey getCacheKey() { - return this.cacheKey; + return cacheKey; } /** diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java index 5f7b39ad..d8af8f05 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java @@ -511,7 +511,7 @@ public final class DefaultFileContent implements FileContent { } private FileContentThreadData getFileContentThreadData() { - return this.threadLocal.get(); + return threadLocal.get(); } /** diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/FileContentThreadData.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/FileContentThreadData.java index 4856d29b..a6cbceb2 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/FileContentThreadData.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/FileContentThreadData.java @@ -35,17 +35,17 @@ final class FileContentThreadData { } void add(final InputStream inputStream) { - if (this.inputStreamList == null) { - this.inputStreamList = new ArrayList<>(); + if (inputStreamList == null) { + inputStreamList = new ArrayList<>(); } - this.inputStreamList.add(inputStream); + inputStreamList.add(inputStream); } void add(final RandomAccessContent randomAccessContent) { - if (this.randomAccessContentList == null) { - this.randomAccessContentList = new ArrayList<>(); + if (randomAccessContentList == null) { + randomAccessContentList = new ArrayList<>(); } - this.randomAccessContentList.add(randomAccessContent); + randomAccessContentList.add(randomAccessContent); } /** @@ -59,11 +59,11 @@ final class FileContentThreadData { } DefaultFileContent.FileContentOutputStream getOutputStream() { - return this.outputStream; + return outputStream; } boolean hasInputStream() { - return this.inputStreamList != null && !this.inputStreamList.isEmpty(); + return inputStreamList != null && !inputStreamList.isEmpty(); } boolean hasRandomAccessContent() { @@ -85,23 +85,23 @@ final class FileContentThreadData { // be a leak because the input stream won't be removed from the original thread's `inputStreamList`. // See https://github.com/apache/commons-vfs/pull/166 for more context. // TODO: fix this problem - if (this.inputStreamList != null) { - this.inputStreamList.remove(inputStream); + if (inputStreamList != null) { + inputStreamList.remove(inputStream); } } void remove(final RandomAccessContent randomAccessContent) { - if (this.randomAccessContentList != null) { - this.randomAccessContentList.remove(randomAccessContent); + if (randomAccessContentList != null) { + randomAccessContentList.remove(randomAccessContent); } } InputStream removeInputStream(final int pos) { - return this.inputStreamList.remove(pos); + return inputStreamList.remove(pos); } Object removeRandomAccessContent(final int pos) { - return this.randomAccessContentList.remove(pos); + return randomAccessContentList.remove(pos); } void setOutputStream(final DefaultFileContent.FileContentOutputStream outputStream) { diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java index d1719380..22405a88 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java @@ -38,7 +38,7 @@ public final class UriParser { PathNormalizer(final StringBuilder path) { this.path = path; - this.end = path.length(); + end = path.length(); } private boolean consumeSeparator() { @@ -46,7 +46,7 @@ public final class UriParser { if (readSeparator()) { path.delete(from, cursor); cursor = from; - this.end = path.length(); + end = path.length(); return true; } return false; @@ -146,7 +146,7 @@ public final class UriParser { } path.delete(cursor, to); lastSeparator = cursor; - this.end = path.length(); + end = path.length(); readSeparator(); } @@ -173,7 +173,7 @@ public final class UriParser { // '/./' path.delete(lastSeparator, beforeNextSeparator); cursor = lastSeparator + cursor - beforeNextSeparator; - this.end = path.length(); + end = path.length(); } else { // '/.other' readNonSeparators(); diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java index 6d879a38..2b2d2896 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java @@ -194,11 +194,11 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> { @Override protected void doDelete() throws Exception { synchronized (getFileSystem()) { - if (this.ftpFile != null) { + if (ftpFile != null) { final boolean ok; final FtpClient ftpClient = getAbstractFileSystem().getClient(); try { - if (this.ftpFile.isDirectory()) { + if (ftpFile.isDirectory()) { ok = ftpClient.removeDirectory(relPath); } else { ok = ftpClient.deleteFile(relPath); @@ -210,9 +210,9 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> { if (!ok) { throw new FileSystemException("vfs.provider.ftp/delete-file.error", getName()); } - this.ftpFile = null; + ftpFile = null; } - this.childMap = EMPTY_FTP_FILE_MAP; + childMap = EMPTY_FTP_FILE_MAP; } } @@ -222,9 +222,9 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> { @Override protected void doDetach() { synchronized (getFileSystem()) { - this.ftpFile = null; - this.childMap = null; - this.mdtmSet = false; + ftpFile = null; + childMap = null; + mdtmSet = false; } } @@ -274,18 +274,18 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> { @Override protected long doGetContentSize() throws Exception { synchronized (getFileSystem()) { - if (this.ftpFile == null) { + if (ftpFile == null) { return 0; } - if (this.ftpFile.isSymbolicLink()) { + if (ftpFile.isSymbolicLink()) { final FileObject linkDest = getLinkDestination(); // VFS-437: Try to avoid a recursion loop. - if (this.isCircular(linkDest)) { - return this.ftpFile.getSize(); + if (isCircular(linkDest)) { + return ftpFile.getSize(); } return linkDest.getContent().getSize(); } - return this.ftpFile.getSize(); + return ftpFile.getSize(); } } @@ -316,13 +316,13 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> { @Override protected long doGetLastModifiedTime() throws Exception { synchronized (getFileSystem()) { - if (this.ftpFile == null) { + if (ftpFile == null) { return DEFAULT_TIMESTAMP; } - if (this.ftpFile.isSymbolicLink()) { + if (ftpFile.isSymbolicLink()) { final FileObject linkDest = getLinkDestination(); // VFS-437: Try to avoid a recursion loop. - if (this.isCircular(linkDest)) { + if (isCircular(linkDest)) { return getTimestampMillis(); } return linkDest.getContent().getLastModifiedTime(); @@ -345,7 +345,7 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> { out = client.storeFileStream(relPath); } - FileSystemException.requireNonNull(out, "vfs.provider.ftp/output-error.debug", this.getName(), + FileSystemException.requireNonNull(out, "vfs.provider.ftp/output-error.debug", getName(), client.getReplyString()); return new FtpOutputStream(client, out); @@ -367,23 +367,23 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> { protected FileType doGetType() throws Exception { // VFS-210 synchronized (getFileSystem()) { - if (this.ftpFile == null) { + if (ftpFile == null) { setFTPFile(false); } - if (this.ftpFile == UNKNOWN) { + if (ftpFile == UNKNOWN) { return FileType.IMAGINARY; } - if (this.ftpFile.isDirectory()) { + if (ftpFile.isDirectory()) { return FileType.FOLDER; } - if (this.ftpFile.isFile()) { + if (ftpFile.isFile()) { return FileType.FILE; } - if (this.ftpFile.isSymbolicLink()) { + if (ftpFile.isSymbolicLink()) { final FileObject linkDest = getLinkDestination(); // VFS-437: We need to check if the symbolic link links back to the symbolic link itself - if (this.isCircular(linkDest)) { + if (isCircular(linkDest)) { // If the symbolic link links back to itself, treat it as an imaginary file to prevent following // this link. If the user tries to access the link as a file or directory, the user will end up with // a FileSystemException warning that the file cannot be accessed. This is to prevent the infinite @@ -419,10 +419,10 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> { @Override protected FileObject[] doListChildrenResolved() throws Exception { synchronized (getFileSystem()) { - if (this.ftpFile != null && this.ftpFile.isSymbolicLink()) { + if (ftpFile != null && ftpFile.isSymbolicLink()) { final FileObject linkDest = getLinkDestination(); // VFS-437: Try to avoid a recursion loop. - if (this.isCircular(linkDest)) { + if (isCircular(linkDest)) { return null; } return linkDest.getChildren(); @@ -449,8 +449,8 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> { if (!ok) { throw new FileSystemException("vfs.provider.ftp/rename-file.error", getName().toString(), newFile); } - this.ftpFile = null; - this.childMap = EMPTY_FTP_FILE_MAP; + ftpFile = null; + childMap = EMPTY_FTP_FILE_MAP; } } @@ -503,10 +503,10 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> { * has C children, P parents, there will be (C * P) listings made with (C * (P + 1)) refreshes, when there * should really only be 1 listing and C refreshes. */ - this.inRefresh.set(true); + inRefresh.set(true); return super.getChildren(); } finally { - this.inRefresh.set(false); + inRefresh.set(false); } } @@ -514,7 +514,7 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> { final FtpClient client = getAbstractFileSystem().getClient(); try { final InputStream instr = client.retrieveFileStream(relPath, filePointer); - FileSystemException.requireNonNull(instr, "vfs.provider.ftp/input-error.debug", this.getName(), + FileSystemException.requireNonNull(instr, "vfs.provider.ftp/input-error.debug", getName(), client.getReplyString()); return new FtpInputStream(client, instr); } catch (final IOException e) { @@ -527,7 +527,7 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> { if (linkDestination == null) { final String path; synchronized (getFileSystem()) { - path = this.ftpFile == null ? null : this.ftpFile.getLink(); + path = ftpFile == null ? null : ftpFile.getLink(); } final FileName parent = getName().getParent(); final FileName relativeTo = parent == null ? getName() : parent; @@ -567,7 +567,7 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> { * This is an over simplistic implementation for VFS-437. */ private boolean isCircular(final FileObject linkDest) throws FileSystemException { - return linkDest.getName().getPathDecoded().equals(this.getName().getPathDecoded()); + return linkDest.getName().getPathDecoded().equals(getName().getPathDecoded()); } /** @@ -580,7 +580,7 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> { if (getType().equals(FileType.IMAGINARY)) { // file is deleted, avoid server lookup synchronized (getFileSystem()) { - this.ftpFile = UNKNOWN; + ftpFile = UNKNOWN; } return; } @@ -611,7 +611,7 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> { try { super.refresh(); synchronized (getFileSystem()) { - this.ftpFile = null; + ftpFile = null; } /* * VFS-210 try { // this will tell the parent to recreate its children collection getInfo(true); } catch @@ -637,7 +637,7 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> { newFileInfo = new FTPFile(); newFileInfo.setType(FTPFile.DIRECTORY_TYPE); } - this.ftpFile = newFileInfo == null ? UNKNOWN : newFileInfo; + ftpFile = newFileInfo == null ? UNKNOWN : newFileInfo; } } } diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileType.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileType.java index ab8d4fed..d85660d6 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileType.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileType.java @@ -65,6 +65,6 @@ public enum FtpFileType { * @return The Apache Commons Net FTP file type. */ int getValue() { - return this.value; + return value; } } diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileSystem.java index 3432a1fb..accfa376 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileSystem.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileSystem.java @@ -70,7 +70,7 @@ public class Http5FileSystem extends AbstractFileSystem { // if scheme is 'http*s' or 'HTTP*S', then the internal base URI should be 'https'. 'http' otherwise. final String scheme = lastCharOfScheme == 's' || lastCharOfScheme == 'S' ? "https" : "http"; - this.internalBaseURI = URI.create(scheme + rootURI.substring(offset)); + internalBaseURI = URI.create(scheme + rootURI.substring(offset)); this.httpClient = httpClient; this.httpClientContext = httpClientContext; } diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/jar/JarURLConnectionImpl.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/jar/JarURLConnectionImpl.java index 691d3425..28ed5e8d 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/jar/JarURLConnectionImpl.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/jar/JarURLConnectionImpl.java @@ -56,10 +56,10 @@ public class JarURLConnectionImpl extends JarURLConnection { // This is because JarURLConnection SUCKS!! super(new URL(HACK_URL)); - this.url = jarFileObject.getURL(); + url = jarFileObject.getURL(); this.fileContent = fileContent; - this.parentURL = jarFileObject.getURL(); - this.entryName = jarFileObject.getName().getPath(); + parentURL = jarFileObject.getURL(); + entryName = jarFileObject.getName().getPath(); this.jarFileObject = jarFileObject; } diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileData.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileData.java index 18bc69f0..66d3ec51 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileData.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileData.java @@ -67,8 +67,8 @@ final class RamFileData implements Serializable { * @param name The file name. */ RamFileData(final FileName name) { - this.children = Collections.synchronizedCollection(new ArrayList<>()); - this.clear(); + children = Collections.synchronizedCollection(new ArrayList<>()); + clear(); if (name == null) { throw new IllegalArgumentException("name can not be null"); } @@ -82,28 +82,28 @@ final class RamFileData implements Serializable { * @throws FileSystemException if an error occurs. */ void addChild(final RamFileData data) throws FileSystemException { - if (!this.getType().hasChildren()) { + if (!getType().hasChildren()) { throw new FileSystemException("A child can only be added in a folder"); } FileSystemException.requireNonNull(data, "No child can be null"); - if (this.children.contains(data)) { + if (children.contains(data)) { throw new FileSystemException("Child already exists. " + data); } - this.children.add(data); + children.add(data); updateLastModified(); } /** */ void clear() { - this.content = ArrayUtils.EMPTY_BYTE_ARRAY; + content = ArrayUtils.EMPTY_BYTE_ARRAY; updateLastModified(); - this.type = FileType.IMAGINARY; - this.children.clear(); - this.name = null; + type = FileType.IMAGINARY; + children.clear(); + name = null; } /* @@ -120,7 +120,7 @@ final class RamFileData implements Serializable { return false; } final RamFileData data = (RamFileData) o; - return this.getName().equals(data.getName()); + return getName().equals(data.getName()); } /** @@ -162,7 +162,7 @@ final class RamFileData implements Serializable { } boolean hasChildren(final RamFileData data) { - return this.children.contains(data); + return children.contains(data); } /* @@ -172,7 +172,7 @@ final class RamFileData implements Serializable { */ @Override public int hashCode() { - return this.getName().hashCode(); + return getName().hashCode(); } /** @@ -182,13 +182,13 @@ final class RamFileData implements Serializable { * @throws FileSystemException if an error occurs. */ void removeChild(final RamFileData data) throws FileSystemException { - if (!this.getType().hasChildren()) { + if (!getType().hasChildren()) { throw new FileSystemException("A child can only be removed from a folder"); } - if (!this.children.contains(data)) { + if (!children.contains(data)) { throw new FileSystemException("Child not found. " + data); } - this.children.remove(data); + children.remove(data); updateLastModified(); } @@ -204,10 +204,10 @@ final class RamFileData implements Serializable { String.format("newSize(%d) > Integer.MAX_VALUE(%d)", newSize, Integer.MAX_VALUE)); } final int resize = (int) newSize; - final int size = this.size(); + final int size = size(); final byte[] newBuf = new byte[resize]; - System.arraycopy(this.content, 0, newBuf, 0, Math.min(resize, size)); - this.content = newBuf; + System.arraycopy(content, 0, newBuf, 0, Math.min(resize, size)); + content = newBuf; updateLastModified(); } @@ -247,11 +247,11 @@ final class RamFileData implements Serializable { */ @Override public String toString() { - return this.name.toString(); + return name.toString(); } void updateLastModified() { - this.lastModifiedMillis = System.currentTimeMillis(); + lastModifiedMillis = System.currentTimeMillis(); } } diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java index c4b0d3e4..153a6814 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java @@ -49,7 +49,7 @@ public class RamFileObject extends AbstractFileObject<RamFileSystem> { */ protected RamFileObject(final AbstractFileName name, final RamFileSystem fs) { super(name, fs); - this.getAbstractFileSystem().attach(this); + getAbstractFileSystem().attach(this); } /* @@ -59,7 +59,7 @@ public class RamFileObject extends AbstractFileObject<RamFileSystem> { */ @Override protected void doAttach() throws Exception { - this.getAbstractFileSystem().attach(this); + getAbstractFileSystem().attach(this); } /* @@ -69,8 +69,8 @@ public class RamFileObject extends AbstractFileObject<RamFileSystem> { */ @Override protected void doCreateFolder() throws Exception { - this.injectType(FileType.FOLDER); - this.save(); + injectType(FileType.FOLDER); + save(); } /* @@ -81,8 +81,8 @@ public class RamFileObject extends AbstractFileObject<RamFileSystem> { @Override protected void doDelete() throws Exception { - if (this.isContentOpen()) { - throw new FileSystemException(this.getName() + " cannot be deleted while the file is open"); + if (isContentOpen()) { + throw new FileSystemException(getName() + " cannot be deleted while the file is open"); } getAbstractFileSystem().delete(this); } @@ -94,7 +94,7 @@ public class RamFileObject extends AbstractFileObject<RamFileSystem> { */ @Override protected long doGetContentSize() throws Exception { - return this.size(); + return size(); } /* @@ -109,7 +109,7 @@ public class RamFileObject extends AbstractFileObject<RamFileSystem> { throw new FileSystemException("vfs.provider/read-not-file.error", getName()); } - return new ByteArrayInputStream(this.data.getContent()); + return new ByteArrayInputStream(data.getContent()); } /* @@ -130,7 +130,7 @@ public class RamFileObject extends AbstractFileObject<RamFileSystem> { @Override protected OutputStream doGetOutputStream(final boolean bAppend) throws Exception { if (!bAppend) { - this.data.setContent(ArrayUtils.EMPTY_BYTE_ARRAY); + data.setContent(ArrayUtils.EMPTY_BYTE_ARRAY); } return new RamFileOutputStream(this); } @@ -163,7 +163,7 @@ public class RamFileObject extends AbstractFileObject<RamFileSystem> { */ @Override protected String[] doListChildren() throws Exception { - return this.getAbstractFileSystem().listChildren(this.getName()); + return getAbstractFileSystem().listChildren(getName()); } /* @@ -197,7 +197,7 @@ public class RamFileObject extends AbstractFileObject<RamFileSystem> { @Override protected void endOutput() throws Exception { super.endOutput(); - this.save(); + save(); } /** @@ -214,7 +214,7 @@ public class RamFileObject extends AbstractFileObject<RamFileSystem> { */ @Override protected void injectType(final FileType fileType) { - this.data.setType(fileType); + data.setType(fileType); super.injectType(fileType); } @@ -227,15 +227,15 @@ public class RamFileObject extends AbstractFileObject<RamFileSystem> { final FileSystemOptions afsOptions = afs.getFileSystemOptions(); if (afsOptions != null) { final long maxSize = RamFileSystemConfigBuilder.getInstance().getLongMaxSize(afsOptions); - if (afs.size() + newSize - this.size() > maxSize) { + if (afs.size() + newSize - size() > maxSize) { throw new IOException("FileSystem capacity (" + maxSize + ") exceeded."); } } - this.data.resize(newSize); + data.resize(newSize); } private void save() throws FileSystemException { - this.getAbstractFileSystem().save(this); + getAbstractFileSystem().save(this); } /** diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileOutputStream.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileOutputStream.java index 3860e663..e2877d3e 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileOutputStream.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileOutputStream.java @@ -55,7 +55,7 @@ public class RamFileOutputStream extends OutputStream { if (exception != null) { throw exception; } - this.closed = true; + closed = true; } @Override @@ -69,14 +69,14 @@ public class RamFileOutputStream extends OutputStream { */ @Override public void write(final byte[] b, final int off, final int len) throws IOException { - final RamFileData data = this.file.getData(); + final RamFileData data = file.getData(); final int size = data.size(); final int newSize = size + len; // Store the Exception in order to notify the client again on close() try { - this.file.resize(newSize); + file.resize(newSize); } catch (final IOException e) { - this.exception = e; + exception = e; throw e; } System.arraycopy(b, off, data.getContent(), size, len); diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContent.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContent.java index df21237b..430e6bd7 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContent.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContent.java @@ -137,7 +137,7 @@ public class RamFileRandomAccessContent implements RandomAccessContent { public RamFileRandomAccessContent(final RamFileObject file, final RandomAccessMode mode) { Objects.requireNonNull(file, "file"); Objects.requireNonNull(mode, "mode"); - this.buf = file.getData().getContent(); + buf = file.getData().getContent(); this.file = file; rafis = new InputStream() { @@ -200,7 +200,7 @@ public class RamFileRandomAccessContent implements RandomAccessContent { */ @Override public long getFilePointer() throws IOException { - return this.filePointer; + return filePointer; } @Override @@ -229,7 +229,7 @@ public class RamFileRandomAccessContent implements RandomAccessContent { */ @Override public boolean readBoolean() throws IOException { - return this.readUnsignedByte() != 0; + return readUnsignedByte() != 0; } /* @@ -239,7 +239,7 @@ public class RamFileRandomAccessContent implements RandomAccessContent { */ @Override public byte readByte() throws IOException { - return (byte) this.readUnsignedByte(); + return (byte) readUnsignedByte(); } /* @@ -249,8 +249,8 @@ public class RamFileRandomAccessContent implements RandomAccessContent { */ @Override public char readChar() throws IOException { - final int ch1 = this.readUnsignedByte(); - final int ch2 = this.readUnsignedByte(); + final int ch1 = readUnsignedByte(); + final int ch2 = readUnsignedByte(); return (char) ((ch1 << 8) + (ch2 << 0)); } @@ -261,7 +261,7 @@ public class RamFileRandomAccessContent implements RandomAccessContent { */ @Override public double readDouble() throws IOException { - return Double.longBitsToDouble(this.readLong()); + return Double.longBitsToDouble(readLong()); } /* @@ -271,7 +271,7 @@ public class RamFileRandomAccessContent implements RandomAccessContent { */ @Override public float readFloat() throws IOException { - return Float.intBitsToFloat(this.readInt()); + return Float.intBitsToFloat(readInt()); } /* @@ -295,9 +295,9 @@ public class RamFileRandomAccessContent implements RandomAccessContent { throw new IndexOutOfBoundsException("Length is lower than 0"); } - if (len > this.getLeftBytes()) { + if (len > getLeftBytes()) { throw new IndexOutOfBoundsException( - "Read length (" + len + ") is higher than buffer left bytes (" + this.getLeftBytes() + ") "); + "Read length (" + len + ") is higher than buffer left bytes (" + getLeftBytes() + ") "); } System.arraycopy(buf, filePointer, b, off, len); @@ -391,13 +391,13 @@ public class RamFileRandomAccessContent implements RandomAccessContent { if (pos < 0) { throw new IOException("Attempt to position before the start of the file"); } - this.filePointer = (int) pos; + filePointer = (int) pos; } @Override public void setLength(final long newLength) throws IOException { - this.file.resize(newLength); - this.buf = this.file.getData().getContent(); + file.resize(newLength); + buf = file.getData().getContent(); } /* @@ -439,13 +439,13 @@ public class RamFileRandomAccessContent implements RandomAccessContent { */ @Override public void write(final byte[] b, final int off, final int len) throws IOException { - if (this.getLeftBytes() < len) { - final int newSize = this.buf.length + len - this.getLeftBytes(); - this.file.resize(newSize); - this.buf = this.file.getData().getContent(); + if (getLeftBytes() < len) { + final int newSize = buf.length + len - getLeftBytes(); + file.resize(newSize); + buf = file.getData().getContent(); } - System.arraycopy(b, off, this.buf, filePointer, len); - this.filePointer += len; + System.arraycopy(b, off, buf, filePointer, len); + filePointer += len; } /* diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileSystem.java index 47e533ca..b5b217be 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileSystem.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileSystem.java @@ -56,12 +56,12 @@ public class RamFileSystem extends AbstractFileSystem implements Serializable { */ protected RamFileSystem(final FileName rootName, final FileSystemOptions fileSystemOptions) { super(rootName, null, fileSystemOptions); - this.cache = Collections.synchronizedMap(new HashMap<>()); + cache = Collections.synchronizedMap(new HashMap<>()); // create root final RamFileData rootData = new RamFileData(rootName); rootData.setType(FileType.FOLDER); rootData.setLastModified(System.currentTimeMillis()); - this.cache.put(rootName, rootData); + cache.put(rootName, rootData); } /* @@ -83,7 +83,7 @@ public class RamFileSystem extends AbstractFileSystem implements Serializable { if (ramFileObject.getName() == null) { throw new IllegalArgumentException("Null argument"); } - RamFileData data = this.cache.get(ramFileObject.getName()); + RamFileData data = cache.get(ramFileObject.getName()); if (data == null) { data = new RamFileData(ramFileObject.getName()); } @@ -95,7 +95,7 @@ public class RamFileSystem extends AbstractFileSystem implements Serializable { */ @Override public void close() { - this.cache.clear(); + cache.clear(); super.close(); } @@ -120,7 +120,7 @@ public class RamFileSystem extends AbstractFileSystem implements Serializable { FileSystemException.requireNonNull(file.getParent(), "unable to delete root"); // Remove reference from cache - this.cache.remove(file.getName()); + cache.remove(file.getName()); // Notify the parent final RamFileObject parent = (RamFileObject) this.resolveFile(file.getParent().getName()); parent.getData().removeChild(file.getData()); @@ -138,7 +138,7 @@ public class RamFileSystem extends AbstractFileSystem implements Serializable { */ public void importTree(final File file) throws FileSystemException { final FileObject fileFo = getFileSystemManager().toFileObject(file); - this.toRamFileObject(fileFo, fileFo); + toRamFileObject(fileFo, fileFo); } /** @@ -146,7 +146,7 @@ public class RamFileSystem extends AbstractFileSystem implements Serializable { * @return children The names of the children. */ String[] listChildren(final FileName name) { - final RamFileData data = this.cache.get(name); + final RamFileData data = cache.get(name); if (data == null || !data.getType().hasChildren()) { return null; } @@ -163,7 +163,7 @@ public class RamFileSystem extends AbstractFileSystem implements Serializable { * @throws FileSystemException if an error occurs. */ void rename(final RamFileObject from, final RamFileObject to) throws FileSystemException { - if (!this.cache.containsKey(from.getName())) { + if (!cache.containsKey(from.getName())) { throw new FileSystemException("File does not exist: " + from.getName()); } // Copy data @@ -172,8 +172,8 @@ public class RamFileSystem extends AbstractFileSystem implements Serializable { to.getData().setLastModified(from.getData().getLastModified()); to.getData().setType(from.getData().getType()); - this.save(to); - this.delete(from); + save(to); + delete(from); } /** @@ -191,7 +191,7 @@ public class RamFileSystem extends AbstractFileSystem implements Serializable { // Add to the parent if (file.getName().getDepth() > 0) { - final RamFileData parentData = this.cache.get(file.getParent().getName()); + final RamFileData parentData = cache.get(file.getParent().getName()); // Only if not already added if (!parentData.hasChildren(file.getData())) { final RamFileObject parent = (RamFileObject) file.getParent(); @@ -230,7 +230,7 @@ public class RamFileSystem extends AbstractFileSystem implements Serializable { // Import recursively final FileObject[] fos = fo.getChildren(); for (final FileObject child : fos) { - this.toRamFileObject(child, root); + toRamFileObject(child, root); } } else if (fo.isFile()) { // Copy bytes diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java index 724fc31c..16f19e93 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java @@ -278,7 +278,7 @@ public class SftpFileObject extends AbstractFileObject<SftpFileSystem> { @Override protected FileObject[] doListChildrenResolved() throws Exception { // should not require a round-trip because type is already set. - if (this.isFile()) { + if (isFile()) { return null; } // List the contents of the folder diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java index db054184..60739bbd 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java @@ -93,12 +93,12 @@ public class SftpFileSystem extends AbstractFileSystem { final FileSystemOptions fileSystemOptions) { super(rootName, null, fileSystemOptions); this.session = Objects.requireNonNull(session, "session"); - this.connectTimeout = SftpFileSystemConfigBuilder.getInstance().getConnectTimeout(fileSystemOptions); + connectTimeout = SftpFileSystemConfigBuilder.getInstance().getConnectTimeout(fileSystemOptions); if (SftpFileSystemConfigBuilder.getInstance().isDisableDetectExecChannel(fileSystemOptions)) { - this.execDisabled = true; + execDisabled = true; } else { - this.execDisabled = detectExecDisabled(); + execDisabled = detectExecDisabled(); } } @@ -260,7 +260,7 @@ public class SftpFileSystem extends AbstractFileSystem { if (code != 0) { throw new JSchException("Could not get the groups id of the current user (error code: " + code + ")"); } - this.groupsIds = parseGroupIdOutput(output); + groupsIds = parseGroupIdOutput(output); } } } @@ -283,16 +283,16 @@ public class SftpFileSystem extends AbstractFileSystem { * @throws FileSystemException if a session cannot be created. */ private Session getSession() throws FileSystemException { - if (!this.session.isConnected()) { + if (!session.isConnected()) { synchronized (this) { - if (!this.session.isConnected()) { + if (!session.isConnected()) { doCloseCommunicationLink(); - this.session = SftpFileProvider.createSession((GenericFileName) getRootName(), + session = SftpFileProvider.createSession((GenericFileName) getRootName(), getFileSystemOptions()); } } } - return this.session; + return session; } /** diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java index b78a5695..c6641c19 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java @@ -52,7 +52,7 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder { @Override public int compareTo(final ProxyType pType) { - return this.proxyType.compareTo(pType.proxyType); + return proxyType.compareTo(pType.proxyType); } @Override @@ -63,7 +63,7 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder { if (obj == null || this.getClass() != obj.getClass()) { return false; } - return Objects.equals(this.proxyType, ((ProxyType) obj).proxyType); + return Objects.equals(proxyType, ((ProxyType) obj).proxyType); } /** @@ -72,7 +72,7 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder { */ @Override public int hashCode() { - return this.proxyType.hashCode(); + return proxyType.hashCode(); } } @@ -517,7 +517,7 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder { */ @Deprecated public void setConnectTimeoutMillis(final FileSystemOptions options, final Integer timeout) { - this.setConnectTimeout(options, Duration.ofMillis(timeout)); + setConnectTimeout(options, Duration.ofMillis(timeout)); } /** @@ -759,7 +759,7 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder { */ @Deprecated public void setSessionTimeoutMillis(final FileSystemOptions options, final Integer timeout) { - this.setSessionTimeout(options, Duration.ofMillis(timeout)); + setSessionTimeout(options, Duration.ofMillis(timeout)); } /** diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java index df472d49..0feb5530 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java @@ -159,7 +159,7 @@ public class TarFileSystem extends AbstractFileSystem { } protected TarArchiveInputStream getTarFile() throws FileSystemException { - if (tarFile == null && this.file.exists()) { + if (tarFile == null && file.exists()) { recreateTarFile(); } return tarFile; @@ -225,15 +225,15 @@ public class TarFileSystem extends AbstractFileSystem { */ private void recreateTarFile() throws FileSystemException { - if (this.tarFile != null) { + if (tarFile != null) { try { - this.tarFile.close(); + tarFile.close(); } catch (final IOException e) { throw new FileSystemException("vfs.provider.tar/close-tar-file.error", file, e); } tarFile = null; } - this.tarFile = createTarFile(this.file); + tarFile = createTarFile(file); } /** @@ -248,7 +248,7 @@ public class TarFileSystem extends AbstractFileSystem { // Reading specific entries requires skipping through the tar file from the beginning // Not especially elegant, but we don't have the ability to seek to specific positions // with an input stream. - if (this.file.exists()) { + if (file.exists()) { recreateTarFile(); } } diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystem.java index 78a57ae3..7eb5d8bb 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystem.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystem.java @@ -70,7 +70,7 @@ public class ZipFileSystem extends AbstractFileSystem { // Make a local copy of the file file = parentLayer.getFileSystem().replicateFile(parentLayer, Selectors.SELECT_SELF); - this.charset = ZipFileSystemConfigBuilder.getInstance().getCharset(fileSystemOptions); + charset = ZipFileSystemConfigBuilder.getInstance().getCharset(fileSystemOptions); // Open the Zip file if (!file.exists()) { @@ -136,8 +136,8 @@ public class ZipFileSystem extends AbstractFileSystem { } protected ZipFile getZipFile() throws FileSystemException { - if (zipFile == null && this.file.exists()) { - this.zipFile = createZipFile(this.file); + if (zipFile == null && file.exists()) { + zipFile = createZipFile(file); } return zipFile; diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/PosixPermissions.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/PosixPermissions.java index ff7f88e0..5ab92447 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/PosixPermissions.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/PosixPermissions.java @@ -92,7 +92,7 @@ public class PosixPermissions { * @return the mask for this permission. */ public int getMask() { - return this.mask; + return mask; } } @@ -132,7 +132,7 @@ public class PosixPermissions { * @return The new permissions. */ private int computeNewPermissions(final Map<Type, Boolean> values) { - int newPerms = this.permissions; + int newPerms = permissions; for (final Map.Entry<Type, Boolean> entry : values.entrySet()) { final Type type = entry.getKey(); if (entry.getValue()) { @@ -150,7 +150,7 @@ public class PosixPermissions { * @return whether the bit corresponding to the permission is set. */ private boolean get(final Type type) { - return (type.getMask() & this.permissions) != 0; + return (type.getMask() & permissions) != 0; } /** @@ -159,7 +159,7 @@ public class PosixPermissions { * @return permissions. */ public int getPermissions() { - return this.permissions; + return permissions; } /** @@ -168,13 +168,13 @@ public class PosixPermissions { * @return whether the permissions are executable. */ public boolean isExecutable() { - if (this.isOwner) { - return this.get(Type.UserExecutable); + if (isOwner) { + return get(Type.UserExecutable); } - if (this.isInGroup) { - return this.get(Type.GroupExecutable); + if (isInGroup) { + return get(Type.GroupExecutable); } - return this.get(Type.OtherExecutable); + return get(Type.OtherExecutable); } /** @@ -183,13 +183,13 @@ public class PosixPermissions { * @return whether the permissions are readable. */ public boolean isReadable() { - if (this.isOwner) { - return this.get(Type.UserReadable); + if (isOwner) { + return get(Type.UserReadable); } - if (this.isInGroup) { - return this.get(Type.GroupReadable); + if (isInGroup) { + return get(Type.GroupReadable); } - return this.get(Type.OtherReadable); + return get(Type.OtherReadable); } /** @@ -198,13 +198,13 @@ public class PosixPermissions { * @return whether the permissions are writable. */ public boolean isWritable() { - if (this.isOwner) { - return this.get(Type.UserWritable); + if (isOwner) { + return get(Type.UserWritable); } - if (this.isInGroup) { - return this.get(Type.GroupWritable); + if (isInGroup) { + return get(Type.GroupWritable); } - return this.get(Type.OtherWritable); + return get(Type.OtherWritable); } /** @@ -221,7 +221,7 @@ public class PosixPermissions { map.put(Type.GroupExecutable, executable); map.put(Type.OtherExecutable, executable); } - return this.computeNewPermissions(map); + return computeNewPermissions(map); } /** @@ -238,7 +238,7 @@ public class PosixPermissions { map.put(Type.GroupReadable, readable); map.put(Type.OtherReadable, readable); } - return this.computeNewPermissions(map); + return computeNewPermissions(map); } /** @@ -255,6 +255,6 @@ public class PosixPermissions { map.put(Type.GroupWritable, writable); map.put(Type.OtherWritable, writable); } - return this.computeNewPermissions(map); + return computeNewPermissions(map); } } diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/WeakRefFileListener.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/WeakRefFileListener.java index 05c989f1..09c71d51 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/WeakRefFileListener.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/WeakRefFileListener.java @@ -58,8 +58,8 @@ public class WeakRefFileListener implements FileListener { private final WeakReference<FileListener> listener; protected WeakRefFileListener(final FileObject file, final FileListener listener) { - this.fs = file.getFileSystem(); - this.name = file.getName(); + fs = file.getFileSystem(); + name = file.getName(); this.listener = new WeakReference<>(listener); } diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractTestSuite.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractTestSuite.java index e87b30c3..cea7489d 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractTestSuite.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractTestSuite.java @@ -118,7 +118,7 @@ public abstract class AbstractTestSuite extends TestSetup { final AbstractProviderTestCase testCase = (AbstractProviderTestCase) testClass.getConstructor().newInstance(); testCase.setMethod(method); testCase.setName(prefix + method.getName()); - testCase.addEmptyDir(this.addEmptyDir); + testCase.addEmptyDir(addEmptyDir); testSuite.addTest(testCase); } } diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ContentTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ContentTests.java index c17cb36b..68bb95f6 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ContentTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ContentTests.java @@ -61,7 +61,7 @@ public class ContentTests extends AbstractProviderTestCase { */ @Test public void testAttributes() throws FileSystemException { - this.getReadFolder().getContent().getAttributes(); + getReadFolder().getContent().getAttributes(); } /** @@ -352,7 +352,7 @@ public class ContentTests extends AbstractProviderTestCase { */ @Test public void testRootAPI() throws FileSystemException { - if (!this.getProviderConfig().isFileSystemRootAccessible()) { + if (!getProviderConfig().isFileSystemRootAccessible()) { return; } testRoot(getFileSystem().getRoot()); @@ -363,7 +363,7 @@ public class ContentTests extends AbstractProviderTestCase { */ @Test public void testRootURI() throws FileSystemException { - if (!this.getProviderConfig().isFileSystemRootAccessible()) { + if (!getProviderConfig().isFileSystemRootAccessible()) { return; } final FileSystem fileSystem = getFileSystem(); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileInfo.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileInfo.java index b8418175..5a32884a 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileInfo.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileInfo.java @@ -33,7 +33,7 @@ public class FileInfo { public FileInfo(final String name, final FileType type) { baseName = name; this.type = type; - this.content = null; + content = null; } public FileInfo(final String name, final FileType type, final String content) { diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileTypeTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileTypeTest.java index 6f185d0a..ab6d012c 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileTypeTest.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileTypeTest.java @@ -33,7 +33,7 @@ public class FileTypeTest { private final FileType fileType = FileType.FILE; public FileType getFileType() { - return this.fileType; + return fileType; } } diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/IPv6LocalConnectionTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/IPv6LocalConnectionTests.java index 420b1399..471cfe6f 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/IPv6LocalConnectionTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/IPv6LocalConnectionTests.java @@ -100,7 +100,7 @@ public class IPv6LocalConnectionTests extends AbstractProviderTestCase { final List<String> localIPv6Addresses = getLocalIPv6Addresses(); boolean connected = false; for (final String ipv6Address : localIPv6Addresses) { - final String ipv6Url = StringUtils.replace(this.getReadFolder().getURL().toString(), "localhost", "[" + ipv6Address + "]"); + final String ipv6Url = StringUtils.replace(getReadFolder().getURL().toString(), "localhost", "[" + ipv6Address + "]"); try { final FileSystem fileSystem = getFileSystem(); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/PermissionsTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/PermissionsTests.java index 17e25a62..7cd238da 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/PermissionsTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/PermissionsTests.java @@ -68,7 +68,7 @@ public class PermissionsTests extends AbstractProviderTestCase { * Returns true if the file system is a LocalFileSystem on Windows */ private boolean isWindows() { - return SystemUtils.IS_OS_WINDOWS && this.getFileSystem() instanceof LocalFileSystem; + return SystemUtils.IS_OS_WINDOWS && getFileSystem() instanceof LocalFileSystem; } /** diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderDeleteTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderDeleteTests.java index d2b71863..f43ad8cb 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderDeleteTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderDeleteTests.java @@ -32,7 +32,7 @@ public class ProviderDeleteTests extends AbstractProviderTestCase { @Override public boolean includeFile(final FileSelectInfo fileInfo) throws Exception { - return this.baseName.equals(fileInfo.getFile().getName().getBaseName()); + return baseName.equals(fileInfo.getFile().getName().getBaseName()); } @Override diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRandomSetLengthTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRandomSetLengthTests.java index dc1a143d..2c804e3b 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRandomSetLengthTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRandomSetLengthTests.java @@ -33,7 +33,7 @@ public class ProviderRandomSetLengthTests extends AbstractProviderTestCase { * Sets up a scratch folder for the test to use. */ protected FileObject createScratchFolder() throws Exception { - final FileObject scratchFolder = this.getWriteFolder(); + final FileObject scratchFolder = getWriteFolder(); // Make sure the test folder is empty scratchFolder.delete(Selectors.EXCLUDE_SELF); @@ -56,7 +56,7 @@ public class ProviderRandomSetLengthTests extends AbstractProviderTestCase { */ @Test public void testRandomSetLength() throws Exception { - try (FileObject file = this.createScratchFolder().resolveFile("random_write.txt")) { + try (FileObject file = createScratchFolder().resolveFile("random_write.txt")) { file.createFile(); final String fileString = file.toString(); final RandomAccessContent ra = file.getContent().getRandomAccessContent(RandomAccessMode.READWRITE); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderReadTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderReadTests.java index 5cd3abc6..6834991c 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderReadTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderReadTests.java @@ -290,7 +290,7 @@ public class ProviderReadTests extends AbstractProviderTestCase { */ @Test public void testRoot() throws FileSystemException { - if (!this.getProviderConfig().isFileSystemRootAccessible()) { + if (!getProviderConfig().isFileSystemRootAccessible()) { return; } final FileSystem fs = getFileSystem(); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/VerifyingFileSelector.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/VerifyingFileSelector.java index 192ef3c1..28c590bd 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/VerifyingFileSelector.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/VerifyingFileSelector.java @@ -39,7 +39,7 @@ public class VerifyingFileSelector extends Assertions implements FileSelector { private final List<Set<String>> stack = new ArrayList<>(); public VerifyingFileSelector(final FileInfo fileInfo) { - this.rootFile = fileInfo; + rootFile = fileInfo; children = new HashSet<>(); children.add(rootFile.baseName); } diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/AbstractFtpsProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/AbstractFtpsProviderTestCase.java index c8399d96..d04eb2bc 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/AbstractFtpsProviderTestCase.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/AbstractFtpsProviderTestCase.java @@ -51,7 +51,7 @@ abstract class AbstractFtpsProviderTestCase extends AbstractProviderTestConfig { public FtpProviderTestSuite(final AbstractFtpsProviderTestCase providerConfig) throws Exception { super(providerConfig); - this.implicit = providerConfig.isImplicit(); + implicit = providerConfig.isImplicit(); } @Override diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/FtpsMultipleConnectionTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/FtpsMultipleConnectionTest.java index 45fd3434..8ee821d0 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/FtpsMultipleConnectionTest.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/FtpsMultipleConnectionTest.java @@ -58,8 +58,8 @@ public class FtpsMultipleConnectionTest { @Test public void testUnderlyingConnect() throws SocketException, IOException { - final FTPSClient client1 = this.init(new FTPSClient(true)); - final FTPSClient client2 = this.init(new FTPSClient(true)); + final FTPSClient client1 = init(new FTPSClient(true)); + final FTPSClient client2 = init(new FTPSClient(true)); try { final String hostname = "localhost"; client1.connect(hostname, AbstractFtpsProviderTestCase.getSocketPort()); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/NoProtocolSslConfigurationProxy.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/NoProtocolSslConfigurationProxy.java index c75827eb..4a971a0c 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/NoProtocolSslConfigurationProxy.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/NoProtocolSslConfigurationProxy.java @@ -39,12 +39,12 @@ public class NoProtocolSslConfigurationProxy implements SslConfiguration { @Override public ClientAuth getClientAuth() { - return this.sslConfiguration.getClientAuth(); + return sslConfiguration.getClientAuth(); } @Override public String[] getEnabledCipherSuites() { - return this.sslConfiguration.getEnabledCipherSuites(); + return sslConfiguration.getEnabledCipherSuites(); } @Override @@ -54,17 +54,17 @@ public class NoProtocolSslConfigurationProxy implements SslConfiguration { @Override public SSLSocketFactory getSocketFactory() throws GeneralSecurityException { - return this.sslConfiguration.getSocketFactory(); + return sslConfiguration.getSocketFactory(); } @Override public SSLContext getSSLContext() throws GeneralSecurityException { - return this.sslConfiguration.getSSLContext(); + return sslConfiguration.getSSLContext(); } @Override public SSLContext getSSLContext(final String protocol) throws GeneralSecurityException { - return this.sslConfiguration.getSSLContext(protocol); + return sslConfiguration.getSSLContext(protocol); } } diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/CustomRamProviderTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/CustomRamProviderTest.java index 05aeb4df..fdfda76b 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/CustomRamProviderTest.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/CustomRamProviderTest.java @@ -68,7 +68,7 @@ public class CustomRamProviderTest { * Closes the given {@link Closeable} during the tearDown phase. */ private <C extends Closeable> C closeOnTearDown(final C closeable) { - this.closeables.add(closeable); + closeables.add(closeable); return closeable; } @@ -122,7 +122,7 @@ public class CustomRamProviderTest { @AfterEach public void tearDown() { - for (final Closeable closeable : this.closeables) { + for (final Closeable closeable : closeables) { try { closeable.close(); } catch (final Exception e) { @@ -169,13 +169,13 @@ public class CustomRamProviderTest { @Test public void testReadEmptyFileByteByByte() throws FileSystemException, IOException { - final InputStream input = this.createEmptyFile(); + final InputStream input = createEmptyFile(); assertEquals(-1, input.read(),"Empty file didn't return EOF -1"); } @Test public void testReadEmptyFileIntoBuffer() throws FileSystemException, IOException { - final InputStream input = this.createEmptyFile(); + final InputStream input = createEmptyFile(); final byte[] buffer = new byte[100]; assertEquals(-1, input.read(buffer), "Empty file didn't return when filling buffer"); @@ -184,7 +184,7 @@ public class CustomRamProviderTest { @Test public void testReadEmptyFileIntoBufferWithOffsetAndLength() throws FileSystemException, IOException { - final InputStream input = this.createEmptyFile(); + final InputStream input = createEmptyFile(); final byte[] buffer = new byte[100]; assertEquals(-1, input.read(buffer, 10, 90), "Empty file didn't return when filling buffer"); assertArrayEquals(new byte[100], buffer, "Buffer was written too"); @@ -192,7 +192,7 @@ public class CustomRamProviderTest { @Test public void testReadNonEmptyFileByteByByte() throws FileSystemException, IOException { - final InputStream input = this.createNonEmptyFile(); + final InputStream input = createNonEmptyFile(); assertEquals(1, input.read(), "Read 1st byte failed"); assertEquals(2, input.read(), "Read 2st byte failed"); @@ -202,7 +202,7 @@ public class CustomRamProviderTest { @Test public void testReadNonEmptyFileIntoBuffer() throws FileSystemException, IOException { - final InputStream input = this.createNonEmptyFile(); + final InputStream input = createNonEmptyFile(); final byte[] buffer = new byte[100]; assertEquals(NON_EMPTY_FILE_CONTENT.length, input.read(buffer), "Filling buffer failed when file is not empty"); @@ -219,7 +219,7 @@ public class CustomRamProviderTest { @Test public void testReadNonEmptyFileIntoBufferWithOffsetAndLength() throws FileSystemException, IOException { - final InputStream input = this.createNonEmptyFile(); + final InputStream input = createNonEmptyFile(); final byte[] buffer = new byte[100]; final int offset = 10; diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/AbstractSftpProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/AbstractSftpProviderTestCase.java index fbc200d7..ed8b2c30 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/AbstractSftpProviderTestCase.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/AbstractSftpProviderTestCase.java @@ -111,7 +111,7 @@ abstract class AbstractSftpProviderTestCase extends AbstractProviderTestConfig { case SSH_FXP_INIT: { // Just grab the version here - this._version = id; + _version = id; break; } } @@ -229,8 +229,8 @@ abstract class AbstractSftpProviderTestCase extends AbstractProviderTestConfig { public SftpProviderTestSuite(final AbstractSftpProviderTestCase providerConfig) throws Exception { super(providerConfig); - this.isExecChannelClosed = providerConfig.isExecChannelClosed(); - this.sessionFactory = providerConfig.sessionFactory(); + isExecChannelClosed = providerConfig.isExecChannelClosed(); + sessionFactory = providerConfig.sessionFactory(); } @Override @@ -543,7 +543,7 @@ abstract class AbstractSftpProviderTestCase extends AbstractProviderTestConfig { server.setFileSystemFactory(new TestFileSystemFactory()); // HACK End server.start(); - int socketPort = server.getPort(); + final int socketPort = server.getPort(); connectionUri = String.format("sftp://%s@localhost:%d", DEFAULT_USER, socketPort); // HACK Start // How do we really do simple security? @@ -588,7 +588,7 @@ abstract class AbstractSftpProviderTestCase extends AbstractProviderTestConfig { builder.setSessionTimeout(fileSystemOptions, Duration.ofSeconds(60)); final FileObject fileObject = manager.resolveFile(uri, fileSystemOptions); - this.fileSystem = (SftpFileSystem) fileObject.getFileSystem(); + fileSystem = (SftpFileSystem) fileObject.getFileSystem(); return fileObject; } diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderStreamProxyModeTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderStreamProxyModeTestCase.java index f190d18a..42e50ee2 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderStreamProxyModeTestCase.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderStreamProxyModeTestCase.java @@ -88,7 +88,7 @@ public class SftpProviderStreamProxyModeTestCase extends AbstractSftpProviderTes } final FileObject fileObject = manager.resolveFile(uri, fileSystemOptions); - this.fileSystem = (SftpFileSystem) fileObject.getFileSystem(); + fileSystem = (SftpFileSystem) fileObject.getFileSystem(); return fileObject; }