more robust console thread (cf. jedit plugin version);
--- a/lib/classes/isabelle/IsabelleDemo.java Sun Jan 06 18:09:34 2008 +0100
+++ b/lib/classes/isabelle/IsabelleDemo.java Sun Jan 06 19:18:01 2008 +0100
@@ -33,12 +33,20 @@
public void run()
{
IsabelleProcess.Result result = null;
- while (result == null || result.kind != IsabelleProcess.Result.Kind.EXIT) {
- try {
- result = results.take();
- System.err.println(result.toString());
- } catch (InterruptedException ex) { }
- }
+ do {
+ try {
+ result = results.take();
+ } catch (NullPointerException ex) {
+ result = null;
+ } catch (InterruptedException ex) {
+ result = null;
+ }
+ if (result != null)
+ System.err.println(result.toString());
+ if (result.kind == IsabelleProcess.Result.Kind.EXIT) {
+ result = null;
+ }
+ } while (result != null);
System.err.println("Console thread terminated");
}
}).start();