aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjestin2000-08-16 18:08:32 +0000
committerjestin2000-08-16 18:08:32 +0000
commitf08ed205ef6ba7ca690391dd5ef0dc71ee6b9070 (patch)
treec14d3537881721e3bd72238d198a7705cef0b374 /src
parentbba0d7da93db5a33f5a5e16b476d4ac5b5a88be3 (diff)
downloadivy-java-f08ed205ef6ba7ca690391dd5ef0dc71ee6b9070.zip
ivy-java-f08ed205ef6ba7ca690391dd5ef0dc71ee6b9070.tar.gz
ivy-java-f08ed205ef6ba7ca690391dd5ef0dc71ee6b9070.tar.bz2
ivy-java-f08ed205ef6ba7ca690391dd5ef0dc71ee6b9070.tar.xz
Bugfixes, comments, et al.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/Ivy.java2
-rwxr-xr-xsrc/IvyClient.java4
-rw-r--r--src/Probe.java13
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 <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();
}
}