No need to initialize to default value.
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileContentInfoFactory.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileContentInfoFactory.java
index 86b5478..0b13a41 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileContentInfoFactory.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileContentInfoFactory.java
@@ -37,7 +37,6 @@
public FileContentInfo create(final FileContent fileContent) throws FileSystemException {
String contentType = null;
- String contentEncoding = null;
HeadMethod headMethod;
try (final HttpFileObject<HttpFileSystem> httpFile = (HttpFileObject<HttpFileSystem>) FileObjectUtils
@@ -54,8 +53,6 @@
}
}
- contentEncoding = headMethod.getResponseCharSet();
-
- return new DefaultFileContentInfo(contentType, contentEncoding);
+ return new DefaultFileContentInfo(contentType, headMethod.getResponseCharSet());
}
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java
index 5ef4898..2eaa7a0 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java
@@ -68,8 +68,6 @@
final char[] password, final FileSystemOptions fileSystemOptions) throws FileSystemException {
final JSch jsch = new JSch();
- File sshDir = null;
-
// new style - user passed
final SftpFileSystemConfigBuilder builder = SftpFileSystemConfigBuilder.getInstance();
final File knownHostsFile = builder.getKnownHosts(fileSystemOptions);
@@ -78,7 +76,7 @@
final ConfigRepository configRepository = builder.getConfigRepository(fileSystemOptions);
final boolean loadOpenSSHConfig = builder.isLoadOpenSSHConfig(fileSystemOptions);
- sshDir = findSshDir();
+ File sshDir = findSshDir();
setKnownHosts(jsch, sshDir, knownHostsFile);
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/MonitorRandomAccessContent.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/MonitorRandomAccessContent.java
index cb54b2e..52190e3 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/MonitorRandomAccessContent.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/MonitorRandomAccessContent.java
@@ -54,7 +54,7 @@
}
// Close the output stream
- IOException exc = null;
+ IOException exc;
try {
content.close();
} catch (final IOException ioe) {
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/test/AbstractSftpProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/test/AbstractSftpProviderTestCase.java
index db02798..2e1fbeb 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/test/AbstractSftpProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/test/AbstractSftpProviderTestCase.java
@@ -461,8 +461,7 @@
private String[] extended;
private SftpAttrs(final Buffer buf) {
- int flags = 0;
- flags = buf.getInt();
+ int flags = buf.getInt();
if ((flags & SftpATTRS.SSH_FILEXFER_ATTR_SIZE) != 0) {
size = buf.getLong();