TD2: Ensure chat clients will not send empty message.
[TD_SR.git] / TD2 / IHM / ThreadIHMSend.java
index f173996f1650ff4066190d42e713dbf29a27f18c..f8077c968fdf03ed6dc4098fc04670180418d282 100644 (file)
@@ -10,7 +10,6 @@ public class ThreadIHMSend implements Runnable {
     }
 
     public void run() {
-        BufferedReader userInput = null;
         try {
             boolean end = false;
             while (!end) {
@@ -18,8 +17,10 @@ public class ThreadIHMSend implements Runnable {
                 if (line.equals(".")) {
                     end = true;
                 }
-                client.sendMsg(line);
-                System.out.println(Thread.currentThread().getName() + " a envoye " + line);
+                if (line.length() != 0) {
+                    client.sendMsg(line);
+                    System.out.println(Thread.currentThread().getName() + " a envoye " + line);
+                }
             }
         }
         catch (Exception e) {