From f08ed205ef6ba7ca690391dd5ef0dc71ee6b9070 Mon Sep 17 00:00:00 2001 From: jestin Date: Wed, 16 Aug 2000 18:08:32 +0000 Subject: Bugfixes, comments, et al. --- src/Ivy.java | 2 ++ src/IvyClient.java | 4 ++-- src/Probe.java | 13 +++++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Ivy.java b/src/Ivy.java index 5b423eb..f7511ba 100755 --- a/src/Ivy.java +++ b/src/Ivy.java @@ -99,6 +99,8 @@ public class Ivy implements Runnable, IvyApplicationListener { /** * disconnects from the Ivy bus. + * TODO is there a bug here ? There is still a thread running and a + * standalone application won't quit here. */ public void stop() { try { diff --git a/src/IvyClient.java b/src/IvyClient.java index dd0f156..e99574c 100755 --- a/src/IvyClient.java +++ b/src/IvyClient.java @@ -7,7 +7,7 @@ import java.util.*; import gnu.regexp.*; /** - * A private Class for the the peers on the bus + * A private Class for the the peers on the bus. * * @author François-Régis Colin * @author Yannick Jestin @@ -19,7 +19,7 @@ import gnu.regexp.*; * created for each remote client. */ -class IvyClient extends Thread { +public class IvyClient extends Thread { /* the protocol magic numbers */ final static int Bye = 0; /* end of the peer */ 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 http://www.tls.cena.fr/products/ivy/ + * 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(); } } -- cgit v1.1