提交 a452e5ff 编写于 作者: K Kohsuke Kawaguchi

Handshaking should fix on the encoding.

See f8916a839c5a7bfe6d0de100a33cf23de33de6e4 for the corresponding change in the remoting.

Since the error messages only use ASCII
上级 25eff900
......@@ -26,8 +26,10 @@ package hudson;
import hudson.slaves.OfflineCause;
import jenkins.AgentProtocol;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.BindException;
import java.net.ServerSocket;
......@@ -139,7 +141,9 @@ public final class TcpSlaveAgentListener extends Thread {
LOGGER.info("Accepted connection #"+id+" from "+s.getRemoteSocketAddress());
DataInputStream in = new DataInputStream(s.getInputStream());
PrintWriter out = new PrintWriter(s.getOutputStream(),true); // DEPRECATED: newer protocol shouldn't use PrintWriter but should use DataOutputStream
PrintWriter out = new PrintWriter(
new BufferedWriter(new OutputStreamWriter(s.getOutputStream(),"UTF-8")),
true); // DEPRECATED: newer protocol shouldn't use PrintWriter but should use DataOutputStream
String s = in.readUTF();
......
......@@ -9,7 +9,9 @@ import jenkins.model.Jenkins;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.Socket;
......@@ -39,7 +41,7 @@ public class CliProtocol extends AgentProtocol {
}
public void run() throws IOException, InterruptedException {
PrintWriter out = new PrintWriter(socket.getOutputStream(),true);
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(),"UTF-8")),true);
out.println("Welcome");
runCli(new Connection(socket));
}
......
......@@ -12,10 +12,12 @@ import jenkins.security.HMACConfidentialKey;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.logging.Level;
......@@ -81,7 +83,7 @@ public class JnlpSlaveAgentProtocol extends AgentProtocol {
public Handler(Socket socket) throws IOException {
this.socket = socket;
in = new DataInputStream(socket.getInputStream());
out = new PrintWriter(socket.getOutputStream(),true);
out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(),"UTF-8")),true);
}
protected void run() throws IOException, InterruptedException {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册