TD2: Check for message text emptyness.
[TD_SR.git] / TD2 / client / ThreadClientSend.java
index 42fe7dfd13c723a5cac6c8e09bbfe4cbf7db611c..2ba2491e48a49f2e46d42ab7a1a6431d6a652be7 100644 (file)
@@ -12,13 +12,15 @@ public class ThreadClientSend implements Runnable {
         try {
             userInput = new BufferedReader(new InputStreamReader(System.in));
             boolean end = false;
-                       while (!end) {
-                               String line = userInput.readLine();
+            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) {
@@ -32,6 +34,7 @@ public class ThreadClientSend implements Runnable {
                 }
                 catch (IOException e) {
                     System.err.println("IOException: " + e);
+                    e.printStackTrace();
                 }
             }
         }