You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/12/16 22:15:32 UTC

[commons-vfs] 01/02: Fix Spotbugs issue.

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 2c3d3807149c2849aef15c8bf91d9ef970a5e7b2
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Dec 16 17:10:07 2020 -0500

    Fix Spotbugs issue.
---
 .../src/main/java/org/apache/commons/vfs2/tasks/ShowFileTask.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/tasks/ShowFileTask.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/tasks/ShowFileTask.java
index 313ba75..e80ca8d 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/tasks/ShowFileTask.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/tasks/ShowFileTask.java
@@ -19,6 +19,7 @@ package org.apache.commons.vfs2.tasks;
 import java.io.BufferedReader;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.nio.charset.Charset;
 import java.util.Date;
 
 import org.apache.commons.vfs2.FileContent;
@@ -124,10 +125,9 @@ public class ShowFileTask extends VfsTask {
      * Writes the content of the file to Ant log.
      */
     private void logContent(final FileObject file, final String prefix) throws Exception {
-        try (
-            final InputStream instr = file.getContent().getInputStream();
-            final BufferedReader reader = new BufferedReader(new InputStreamReader(instr)); )
-        {
+        try (final FileContent content = file.getContent();
+            final InputStream instr = content.getInputStream();
+            final BufferedReader reader = new BufferedReader(new InputStreamReader(instr, Charset.defaultCharset()))) {
             while (true) {
                 final String line = reader.readLine();
                 if (line == null) {