Skip to content

Commit

Permalink
Remove System.exit calls
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinjwalls committed Apr 16, 2024
1 parent 6385e0c commit a77b3c8
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ public void run() {
} catch (Exception e) {
e.printStackTrace(System.out);
} finally {
System.out.println("TEST INCORRECT: block returned");
System.exit(1);
throw new RuntimeException("TEST INCORRECT: block returned");
}
}
};
Expand Down Expand Up @@ -120,7 +119,7 @@ public void run() {
java.util.Map<Thread,StackTraceElement[]> traces = Thread.getAllStackTraces();
showStackTrace("Thread 1", traces.get(t1));
showStackTrace("Thread 2", traces.get(t2));
System.exit(1);
throw new RuntimeException("TEST FAILED");
}

private static void showStackTrace(String title,
Expand Down Expand Up @@ -152,9 +151,7 @@ public synchronized void block(Semaphore semaphore) {
semaphore.release();
lock.wait(); // block forever
} catch (InterruptedException e) {
System.out.println("TEST INCORRECT: lock interrupted:");
e.printStackTrace(System.out);
System.exit(1);
throw new RuntimeException("TEST INCORRECT: lock interrupted");
}
}
}
Expand Down

0 comments on commit a77b3c8

Please sign in to comment.