TD2: Ensure chat clients will not send empty message.
[TD_SR.git] / TD2 / client / ThreadClientoSend.java
index 52db7d5abdcad564bc3dc80635086d265da27794..1d7e232ffd794bde82be90199f8662d283cf02f7 100644 (file)
@@ -38,9 +38,11 @@ public class ThreadClientoSend implements Runnable {
                 if (line.equals(".")) {
                     end = true;
                 }
-                Message oMsg = new Message(randName, line, Calendar.getInstance());
-                client.sendoMsg(oMsg);
-                System.out.println(Thread.currentThread().getName() + " a envoye " + oMsg);
+                if (line.length() != 0) {
+                    Message oMsg = new Message(randName, line, Calendar.getInstance());
+                    client.sendoMsg(oMsg);
+                    System.out.println(Thread.currentThread().getName() + " a envoye " + oMsg);
+                }
             }
            }
         catch (IOException e) {