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 3bd63fcf30097d7bb4c7901168fffb491f48b0a9 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Mon Jul 28 06:59:48 2025 -0400 Move instance variable declarationm closer to usage --- .../vfs2/provider/http4/Http4FileContentInfoFactory.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileContentInfoFactory.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileContentInfoFactory.java index 0bc7fb693..eac5d8fb7 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileContentInfoFactory.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileContentInfoFactory.java @@ -48,24 +48,18 @@ public class Http4FileContentInfoFactory implements FileContentInfoFactory { @SuppressWarnings("unchecked") @Override public FileContentInfo create(final FileContent fileContent) throws FileSystemException { - String contentMimeType = null; - String contentCharset = null; - - try (Http4FileObject<Http4FileSystem> http4File = (Http4FileObject<Http4FileSystem>) FileObjectUtils - .getAbstractFileObject(fileContent.getFile())) { + try (Http4FileObject<Http4FileSystem> http4File = (Http4FileObject<Http4FileSystem>) FileObjectUtils.getAbstractFileObject(fileContent.getFile())) { final HttpResponse lastHeadResponse = http4File.getLastHeadResponse(); - final Header header = lastHeadResponse.getFirstHeader(HTTP.CONTENT_TYPE); - + String contentMimeType = null; + String contentCharset = null; if (header != null) { final ContentType contentType = ContentType.parse(header.getValue()); contentMimeType = contentType.getMimeType(); - if (contentType.getCharset() != null) { contentCharset = contentType.getCharset().name(); } } - return new DefaultFileContentInfo(contentMimeType, contentCharset); } catch (final IOException e) { throw new FileSystemException(e);