From: Jérôme Benoit Date: Sat, 17 Mar 2018 15:27:55 +0000 (+0100) Subject: TD2: Check for message text emptyness. X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=03a13b6164d44f0c74e5cd180abecbb8e0dda30a;p=TD_SR.git TD2: Check for message text emptyness. Signed-off-by: Jérôme Benoit --- diff --git a/TD2/IHM/IHM.java b/TD2/IHM/IHM.java index 22624fc..5a43687 100644 --- a/TD2/IHM/IHM.java +++ b/TD2/IHM/IHM.java @@ -94,7 +94,7 @@ public class IHM implements ActionListener { e.printStackTrace(); } String mess = (String)sendMessages.remove(0); - if (mess.length() == 0) + if (mess.isEmpty()) return ""; System.out.println("IHM -> message a envoyer : " + mess); return randName + "> " + mess; diff --git a/TD2/IHM/ThreadIHMSend.java b/TD2/IHM/ThreadIHMSend.java index f8077c9..5113989 100644 --- a/TD2/IHM/ThreadIHMSend.java +++ b/TD2/IHM/ThreadIHMSend.java @@ -17,7 +17,7 @@ public class ThreadIHMSend implements Runnable { if (line.equals(".")) { end = true; } - if (line.length() != 0) { + if (!line.isEmpty()) { client.sendMsg(line); System.out.println(Thread.currentThread().getName() + " a envoye " + line); } diff --git a/TD2/client/ThreadClientSend.java b/TD2/client/ThreadClientSend.java index 639228f..2ba2491 100644 --- a/TD2/client/ThreadClientSend.java +++ b/TD2/client/ThreadClientSend.java @@ -17,7 +17,7 @@ public class ThreadClientSend implements Runnable { if (line.equals(".")) { end = true; } - if (line.length() != 0) { + if (!line.isEmpty()) { client.sendMsg(line); System.out.println(Thread.currentThread().getName() + " a envoye " + line); } diff --git a/TD2/client/ThreadClientoSend.java b/TD2/client/ThreadClientoSend.java index 1d7e232..2475be6 100644 --- a/TD2/client/ThreadClientoSend.java +++ b/TD2/client/ThreadClientoSend.java @@ -38,7 +38,7 @@ public class ThreadClientoSend implements Runnable { if (line.equals(".")) { end = true; } - if (line.length() != 0) { + if (!line.isEmpty()) { Message oMsg = new Message(randName, line, Calendar.getInstance()); client.sendoMsg(oMsg); System.out.println(Thread.currentThread().getName() + " a envoye " + oMsg);