Source:
<code>public void run(final ActionContext context) throws Exception { config.validate(); Connection connection = new Connection(config.host); try { connection.connect(); char[] privateKey = <START> new String(context.getSecureData(context.getNamespace(), config.privateKeyFileLookupKey).get()).toCharArray(); <END> String passphrase = Strings.isNullOrEmpty(config.passphrase) ? "" : config.passphrase; if (!connection.authenticateWithPublicKey(config.user, privateKey, passphrase)) { throw new IOException(String.format("SSH authentication error when connecting to %s@%s on port %d", config.user, config.host, config.port)); } LOG.debug("Connection established with the host {}", config.host); Session session = connection.openSession(); session.execCommand(config.command); InputStream stdout = new StreamGobbler(session.getStdout()); BufferedReader outBuffer = new BufferedReader(new InputStreamReader(stdout, Charsets.UTF_8)); InputStream stderr = new StreamGobbler(session.getStderr()); BufferedReader errBuffer = new BufferedReader(new InputStreamReader(stderr, Charsets.UTF_8)); String out = CharStreams.toString(outBuffer); String err = CharStreams.toString(errBuffer); if (out.length() > 0) { LOG.debug("Stdout: {}", out); } if (err.length() > 0) { LOG.error("Stderr: {}", err); } Integer exitCode = session.getExitStatus(); if (exitCode != null && exitCode != 0) { throw new IOException(String.format("Error: command %s running on hostname %s finished with exit code: %d", config.command, config.host, exitCode)); } if (config.output != null) { out = out.endsWith("\n") ? out.substring(0, out.length() - 1) : out; context.getArguments().set(config.output, out); } } finally { connection.close(); } }</code><technical_language>charset while converting byte[] String. Bytes.toString(...)</technical_language>

Target:
public void run(final ActionContext context) throws Exception { config.validate(); Connection connection = new Connection(config.host); try { connection.connect(); if (!connection.authenticateWithPublicKey(config.user, config.privateKey.toCharArray(), config.passphrase)) { throw new IOException(String.format("SSH authentication error when connecting to %s@%s on port %d", config.user, config.host, config.port)); } LOG.debug("Connection established with the host {}", config.host); Session session = connection.openSession(); session.execCommand(config.command); InputStream stdout = new StreamGobbler(session.getStdout()); BufferedReader outBuffer = new BufferedReader(new InputStreamReader(stdout, Charsets.UTF_8)); InputStream stderr = new StreamGobbler(session.getStderr()); BufferedReader errBuffer = new BufferedReader(new InputStreamReader(stderr, Charsets.UTF_8)); String out = CharStreams.toString(outBuffer); String err = CharStreams.toString(errBuffer); if (out.length() > 0) { LOG.debug("Stdout: {}", out); } if (err.length() > 0) { LOG.error("Stderr: {}", err); } Integer exitCode = session.getExitStatus(); if (exitCode != null && exitCode != 0) { throw new IOException(String.format("Error: command %s running on hostname %s finished with exit code: %d", config.command, config.host, exitCode)); } out = out.endsWith("\n") ? out.substring(0, out.length() - 1) : out; context.getArguments().set(config.outputKey, out); } finally { connection.close(); } }