This is an automated email from the ASF dual-hosted git repository.

ferdei pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 91e267e6e3 NIFI-10678 MiNiFi: Use defaultCharset for reading files in 
DebugOperationHandler
91e267e6e3 is described below

commit 91e267e6e3d8c59e3f40fc95c308995d57006742
Author: Ferenc Kis <[email protected]>
AuthorDate: Fri Oct 21 13:50:25 2022 +0200

    NIFI-10678 MiNiFi: Use defaultCharset for reading files in 
DebugOperationHandler
    
    This closes #6564
    
    Signed-off-by: Ferenc Erdei <[email protected]>
---
 .../nifi/c2/client/service/operation/DebugOperationHandler.java       | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/DebugOperationHandler.java
 
b/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/DebugOperationHandler.java
index 33ec839c31..22b9cd18b4 100644
--- 
a/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/DebugOperationHandler.java
+++ 
b/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/DebugOperationHandler.java
@@ -34,6 +34,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.UncheckedIOException;
+import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -156,12 +157,13 @@ public class DebugOperationHandler implements 
C2OperationHandler {
         List<Path> contentFilteredFilePaths = new ArrayList<>();
         for (Path path : bundleFilePaths) {
             String fileName = path.getFileName().toString();
-            try (Stream<String> fileStream = lines(path)) {
+            try (Stream<String> fileStream = lines(path, 
Charset.defaultCharset())) {
                 Path tempDirectory = createTempDirectory(operationId);
                 Path tempFile = 
Paths.get(tempDirectory.toAbsolutePath().toString(), fileName);
                 Files.write(tempFile, (Iterable<String>) 
fileStream.filter(contentFilter)::iterator);
                 contentFilteredFilePaths.add(tempFile);
             } catch (IOException e) {
+                LOG.error("Error during filtering file content: " + 
path.toAbsolutePath(), e);
                 throw new UncheckedIOException(e);
             }
         }

Reply via email to