Skip to content

Commit 3bd63fc

Browse files
committed
Move instance variable declarationm closer to usage
1 parent c8b79c2 commit 3bd63fc

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileContentInfoFactory.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,18 @@ public Http4FileContentInfoFactory() {
4848
@SuppressWarnings("unchecked")
4949
@Override
5050
public FileContentInfo create(final FileContent fileContent) throws FileSystemException {
51-
String contentMimeType = null;
52-
String contentCharset = null;
53-
54-
try (Http4FileObject<Http4FileSystem> http4File = (Http4FileObject<Http4FileSystem>) FileObjectUtils
55-
.getAbstractFileObject(fileContent.getFile())) {
51+
try (Http4FileObject<Http4FileSystem> http4File = (Http4FileObject<Http4FileSystem>) FileObjectUtils.getAbstractFileObject(fileContent.getFile())) {
5652
final HttpResponse lastHeadResponse = http4File.getLastHeadResponse();
57-
5853
final Header header = lastHeadResponse.getFirstHeader(HTTP.CONTENT_TYPE);
59-
54+
String contentMimeType = null;
55+
String contentCharset = null;
6056
if (header != null) {
6157
final ContentType contentType = ContentType.parse(header.getValue());
6258
contentMimeType = contentType.getMimeType();
63-
6459
if (contentType.getCharset() != null) {
6560
contentCharset = contentType.getCharset().name();
6661
}
6762
}
68-
6963
return new DefaultFileContentInfo(contentMimeType, contentCharset);
7064
} catch (final IOException e) {
7165
throw new FileSystemException(e);

0 commit comments

Comments
 (0)