--- old/test/hotspot/jtreg/runtime/Monitor/NonOwnerOps.java 2019-08-13 16:05:21.000000000 -0400 +++ new/test/hotspot/jtreg/runtime/Monitor/NonOwnerOps.java 2019-08-13 16:05:20.000000000 -0400 @@ -31,15 +31,15 @@ public class NonOwnerOps { public static void main(String[] args) { - boolean after; int error_count = 0; Object obj; obj = new Object(); - after = false; try { obj.wait(); - after = true; + System.err.println("ERROR: wait() by non-owner thread did not " + + "throw IllegalMonitorStateException."); + error_count++; } catch (InterruptedException ie) { System.err.println("ERROR: wait() by non-owner thread threw " + "InterruptedException which is not expected."); @@ -49,43 +49,30 @@ "expected IllegalMonitorStateException:"); System.out.println(" " + imse); } - if (after) { - System.err.println("ERROR: wait() by non-owner thread did not " + - "throw IllegalMonitorStateException."); - error_count++; - } obj = new Object(); - after = false; try { obj.notify(); - after = true; + System.err.println("ERROR: notify() by non-owner thread did not " + + "throw IllegalMonitorStateException."); + error_count++; } catch (IllegalMonitorStateException imse) { System.out.println("notify() by non-owner thread threw the " + "expected IllegalMonitorStateException:"); System.out.println(" " + imse); } - if (after) { - System.err.println("ERROR: notify() by non-owner thread did not " + - "throw IllegalMonitorStateException."); - error_count++; - } obj = new Object(); - after = false; try { obj.notifyAll(); - after = true; + System.err.println("ERROR: notifyAll() by non-owner thread did " + + "not throw IllegalMonitorStateException."); + error_count++; } catch (IllegalMonitorStateException imse) { System.out.println("notifyAll() by non-owner thread threw the " + "expected IllegalMonitorStateException:"); System.out.println(" " + imse); } - if (after) { - System.err.println("ERROR: notifyAll() by non-owner thread did " + - "not throw IllegalMonitorStateException."); - error_count++; - } if (error_count != 0) { throw new RuntimeException("Test failed with " + error_count +