emiliosetiadarma commented on code in PR #6054:
URL: https://github.com/apache/nifi/pull/6054#discussion_r876448151


##########
nifi-commons/nifi-flow-encryptor/src/main/java/org/apache/nifi/flow/encryptor/StandardFlowEncryptor.java:
##########
@@ -49,38 +42,27 @@ public class StandardFlowEncryptor implements FlowEncryptor 
{
      */
     @Override
     public void processFlow(final InputStream inputStream, final OutputStream 
outputStream, final PropertyEncryptor inputEncryptor, final PropertyEncryptor 
outputEncryptor) {
-        try (final PrintWriter writer = new PrintWriter(new 
OutputStreamWriter(outputStream))) {
-            try (final BufferedReader reader = new BufferedReader(new 
InputStreamReader(inputStream))) {
-                reader.lines().forEach(line -> {
-                    final Matcher matcher = ENCRYPTED_PATTERN.matcher(line);
-
-                    final StringBuffer sb = new StringBuffer();
-                    boolean matched = false;
-                    while (matcher.find()) {
-                        final String outputEncrypted = 
getOutputEncrypted(matcher.group(FIRST_GROUP), inputEncryptor, outputEncryptor);
-                        matcher.appendReplacement(sb, outputEncrypted);
-                        matched = true;
-                    }
-
-                    final String outputLine;
-                    if (matched) {
-                        matcher.appendTail(sb);
-                        outputLine = sb.toString();
-                    } else {
-                        outputLine = line;
-                    }
-
-                    writer.println(outputLine);
-                });
+        final BufferedInputStream bufferedInputStream = new 
BufferedInputStream(inputStream);
+        if (bufferedInputStream.markSupported()) {

Review Comment:
   Making the changes



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to