aboutsummaryrefslogtreecommitdiff
path: root/src/Probe.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Probe.java')
-rw-r--r--src/Probe.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/Probe.java b/src/Probe.java
index 6218e03..5152cda 100644
--- a/src/Probe.java
+++ b/src/Probe.java
@@ -8,6 +8,7 @@ import java.io.*;
* @see fr.dgac.ivy.TestIvySwing
* @author Yannick Jestin
* @author <a href="http://www.tls.cena.fr/products/ivy/">http://www.tls.cena.fr/products/ivy/</a>
+ * TODO BUG ! Should exit on end of user input
*/
class Probe implements IvyApplicationListener, IvyMessageListener {
@@ -39,12 +40,16 @@ class Probe implements IvyApplicationListener, IvyMessageListener {
DataInputStream in =
new DataInputStream(new BufferedInputStream(System.in));
// infinite loop on keyboard input
- while ((s=in.readLine()).length()!=0)
- System.out.println("-> Sent to " +bus.sendMsg(s)+" peers");
+ try {
+ while ((s=in.readLine()).length()!=0)
+ System.out.println("-> Sent to " +bus.sendMsg(s)+" peers");
+ } catch (NullPointerException e) {
+ bus.stop();
+ } catch (IOException e) {
+ bus.stop();
+ }
} catch (IvyException ie) {
System.out.println("Caught an exception. quitting. "+ie.getMessage());
- } catch (IOException e) {
- e.printStackTrace();
}
}