diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractJDITest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractJDITest.java index ded6ea5aae..1b1db29b2a 100644 --- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractJDITest.java +++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractJDITest.java @@ -1308,8 +1308,7 @@ protected void startProgram() { Event event = waitForEvent(waiter, TIMEOUT); fEventReader.removeEventListener(waiter); if (event == null) { - System.out.println( - "\nThe program doesn't seem to have started after " + TIMEOUT + "ms"); + throw new RuntimeException("ClassPrepareEvent for " + getMainClassName() + " missing after " + TIMEOUT + "ms"); } // silence streams after "Listening for transport dt_socket at address: xyz" if (fConsoleErrorReader instanceof NullConsoleReader r) { diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractReader.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractReader.java index 86f04f6fe1..741cad5e49 100644 --- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractReader.java +++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractReader.java @@ -39,7 +39,11 @@ public void start() { fReaderThread = new Thread(new Runnable() { @Override public void run() { - readerLoop(); + try { + readerLoop(); + } catch (Throwable e) { + e.printStackTrace(); + } } }, fName); fReaderThread.setDaemon(true); diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventReader.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventReader.java index 0f738b973e..45125a9e47 100644 --- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventReader.java +++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventReader.java @@ -63,33 +63,47 @@ public synchronized void addEventListener(EventListener listener) { * Returns whether the VM should be resumed. */ private boolean dispath(Event event, EventListener listener) { - if (event instanceof AccessWatchpointEvent) + System.out.println(event); + if (event instanceof AccessWatchpointEvent) { return listener.accessWatchpoint((AccessWatchpointEvent) event); - if (event instanceof BreakpointEvent) + } + if (event instanceof BreakpointEvent) { return listener.breakpoint((BreakpointEvent) event); - if (event instanceof ClassPrepareEvent) + } + if (event instanceof ClassPrepareEvent) { return listener.classPrepare((ClassPrepareEvent) event); - if (event instanceof ClassUnloadEvent) + } + if (event instanceof ClassUnloadEvent) { return listener.classUnload((ClassUnloadEvent) event); - if (event instanceof ExceptionEvent) + } + if (event instanceof ExceptionEvent) { return listener.exception((ExceptionEvent) event); - if (event instanceof MethodEntryEvent) + } + if (event instanceof MethodEntryEvent) { return listener.methodEntry((MethodEntryEvent) event); - if (event instanceof MethodExitEvent) + } + if (event instanceof MethodExitEvent) { return listener.methodExit((MethodExitEvent) event); - if (event instanceof ModificationWatchpointEvent) + } + if (event instanceof ModificationWatchpointEvent) { return listener.modificationWatchpoint( (ModificationWatchpointEvent) event); - if (event instanceof StepEvent) + } + if (event instanceof StepEvent) { return listener.step((StepEvent) event); - if (event instanceof ThreadDeathEvent) + } + if (event instanceof ThreadDeathEvent) { return listener.threadDeath((ThreadDeathEvent) event); - if (event instanceof ThreadStartEvent) + } + if (event instanceof ThreadStartEvent) { return listener.threadStart((ThreadStartEvent) event); - if (event instanceof VMDisconnectEvent) + } + if (event instanceof VMDisconnectEvent) { return listener.vmDisconnect((VMDisconnectEvent) event); - if (event instanceof VMDeathEvent) + } + if (event instanceof VMDeathEvent) { return listener.vmDeath((VMDeathEvent) event); + } return true; } /** @@ -113,18 +127,20 @@ protected void readerLoop() { fEventListeners.elementAt(i); shouldGo = shouldGo & dispath(event, listener); } - if (event instanceof VMDeathEvent) + if (event instanceof VMDeathEvent) { stop(); + } } // Let the VM go if it was interrupted if ((!fIsStopping) && (eventSet != null) && (eventSet.suspendPolicy() == EventRequest.SUSPEND_ALL) - && shouldGo) + && shouldGo) { synchronized (this) { fEventQueue.virtualMachine().resume(); } + } } } catch (InterruptedException e) { if (!fIsStopping) { @@ -132,6 +148,7 @@ protected void readerLoop() { return; } } catch (VMDisconnectedException e) { + e.printStackTrace(); return; } }