summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/CompileClient.scala2
-rw-r--r--src/compiler/scala/tools/nsc/CompileServer.scala6
-rw-r--r--src/compiler/scala/tools/nsc/CompileSocket.scala8
3 files changed, 8 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/CompileClient.scala b/src/compiler/scala/tools/nsc/CompileClient.scala
index de780a9c70..9e24a67d72 100644
--- a/src/compiler/scala/tools/nsc/CompileClient.scala
+++ b/src/compiler/scala/tools/nsc/CompileClient.scala
@@ -65,7 +65,7 @@ object CompileClient {
else CompileSocket.getSocket(serverAdr)
val out = new PrintWriter(socket.getOutputStream(), true)
val in = new BufferedReader(new InputStreamReader(socket.getInputStream()))
- out.println(CompileSocket.getPassWord(socket.getPort()))
+ out.println(CompileSocket.getPassword(socket.getPort()))
out.println(args.mkString("", "\0", ""))
var fromServer = in.readLine()
while (fromServer != null) {
diff --git a/src/compiler/scala/tools/nsc/CompileServer.scala b/src/compiler/scala/tools/nsc/CompileServer.scala
index 256bc6bdd5..c97e1d54a1 100644
--- a/src/compiler/scala/tools/nsc/CompileServer.scala
+++ b/src/compiler/scala/tools/nsc/CompileServer.scala
@@ -69,10 +69,10 @@ object CompileServer extends SocketServer {
System.out.println("New session, total memory = "+runtime.totalMemory()+
", max memory = "+runtime.maxMemory()+
", free memory = "+runtime.freeMemory)
- val passWord = CompileSocket.getPassWord(port)
- val guestPassWord = in.readLine()
+ val password = CompileSocket.getPassword(port)
+ val guessedPassword = in.readLine()
val input = in.readLine()
- if (input != null && passWord == guestPassWord) {
+ if (input != null && password == guessedPassword) {
try {
inSession = true
progress = true
diff --git a/src/compiler/scala/tools/nsc/CompileSocket.scala b/src/compiler/scala/tools/nsc/CompileSocket.scala
index 15dad1df53..c5ae8131e1 100644
--- a/src/compiler/scala/tools/nsc/CompileSocket.scala
+++ b/src/compiler/scala/tools/nsc/CompileSocket.scala
@@ -87,8 +87,8 @@ object CompileSocket {
/** Set the port number to which a scala compile server is connected */
def setPort(port: int): unit =
try {
- val f = new DataOutputStream(new FileOutputStream(portFile(port)))
- f.writeChars(new java.util.Random().nextInt.toString)
+ val f = new PrintWriter(new FileOutputStream(portFile(port)))
+ f.println(new java.util.Random().nextInt.toString)
f.close()
} catch {
case ex: IOException =>
@@ -153,8 +153,8 @@ object CompileSocket {
exit(1)
}
- def getPassWord(port: int): String = {
- val f = new DataInputStream(new FileInputStream(portFile(port)))
+ def getPassword(port: int): String = {
+ val f = new BufferedReader(new FileReader(portFile(port)))
val result = f.readLine()
f.close()
result