Skip to content

Commit 01262ce

Browse files
author
duke
committed
Backport f73922b27d126314fc3127ee25aa40b6258c8a6b
1 parent 4a5c578 commit 01262ce

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill001/kill001a.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -141,6 +141,16 @@ public MyThread(String n, Throwable e) {
141141
expectedException = e;
142142
}
143143

144+
145+
static public int[] trash;
146+
147+
void methodForException() {
148+
trash = new int[10];
149+
for (int i = 0; ;i++) {
150+
trash[i % trash.length] = i;
151+
}
152+
}
153+
144154
public void run() {
145155
// Concatenate strings in advance to avoid lambda calculations later
146156
String ThreadFinished = "Thread finished: " + this.name;
@@ -156,8 +166,9 @@ public void run() {
156166
try {
157167
synchronized (kill001a.lock) { }
158168
// We need some code that does an invoke here to make sure the async exception
159-
// gets thrown before we leave the try block. Printing a log message works well.
160-
kill001a.log.display("exited synchronized");
169+
// gets thrown before we leave the try block.
170+
// The methodForException should work until exception is thrown.
171+
methodForException();
161172
} catch (Throwable t) {
162173
if (t == expectedException) {
163174
kill001a.log.display(CaughtExpected);

0 commit comments

Comments
 (0)