X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TD2%2Fclient%2FThreadClientSend.java;h=2ba2491e48a49f2e46d42ab7a1a6431d6a652be7;hb=03a13b6164d44f0c74e5cd180abecbb8e0dda30a;hp=9d40e0d6a7effddb01cd3e585fc7a1db0caabd33;hpb=b9a33c97f77a1eae45b91426ca8061e18f163d4e;p=TD_SR.git diff --git a/TD2/client/ThreadClientSend.java b/TD2/client/ThreadClientSend.java index 9d40e0d..2ba2491 100644 --- a/TD2/client/ThreadClientSend.java +++ b/TD2/client/ThreadClientSend.java @@ -12,28 +12,31 @@ public class ThreadClientSend implements Runnable { try { userInput = new BufferedReader(new InputStreamReader(System.in)); boolean end = false; - while (!end) { - String line = userInput.readLine(); - if (line.equals(".")) { + while (!end) { + String line = userInput.readLine(); + if (line.equals(".")) { end = true; } - client.sendMsg(line); - System.out.println(Thread.currentThread().getName() + " a envoye " + line); + if (!line.isEmpty()) { + client.sendMsg(line); + System.out.println(Thread.currentThread().getName() + " a envoye " + line); + } } - } + } catch (IOException e) { System.err.println("IOException: " + e); e.printStackTrace(); } finally { if (userInput != null) { - try { - userInput.close(); - } - catch (IOException e) { - System.err.println("IOException: " + e); - } - } + try { + userInput.close(); + } + catch (IOException e) { + System.err.println("IOException: " + e); + e.printStackTrace(); + } + } } } }