You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2022/04/13 13:07:00 UTC

[camel] branch main updated: CAMEL-17962: cleanup duplicated charset features in camel-ssh

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

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


The following commit(s) were added to refs/heads/main by this push:
     new c3eeb2fcef6 CAMEL-17962: cleanup duplicated charset features in camel-ssh
c3eeb2fcef6 is described below

commit c3eeb2fcef6f0b5f4e609230e240c1d3d8887403
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Wed Apr 13 14:03:45 2022 +0200

    CAMEL-17962: cleanup duplicated charset features in camel-ssh
---
 .../src/main/java/org/apache/camel/component/ssh/SshHelper.java     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshHelper.java b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshHelper.java
index 4a204f31951..a343fa0c5de 100644
--- a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshHelper.java
+++ b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshHelper.java
@@ -21,7 +21,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.io.PipedInputStream;
 import java.io.PipedOutputStream;
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.security.KeyPair;
 import java.util.Arrays;
 import java.util.Iterator;
@@ -196,11 +196,11 @@ public final class SshHelper {
     }
 
     private static String getPrompt(ClientChannel channel, ByteArrayOutputStream output, SshEndpoint endpoint)
-            throws UnsupportedEncodingException, InterruptedException {
+            throws InterruptedException {
 
         while (!channel.isClosed()) {
 
-            String response = output.toString("UTF-8");
+            String response = output.toString(StandardCharsets.UTF_8);
             if (response.trim().endsWith(endpoint.getShellPrompt())) {
                 output.reset();
                 return SshShellOutputStringHelper.betweenBeforeLast(response, System.lineSeparator(), System.lineSeparator());