Skip to content

Commit e3da580

Browse files
committed
8273704: DrawStringWithInfiniteXform.java failed : drawString with InfiniteXform transform takes long time
Backport-of: 2cac565
1 parent 96c8499 commit e3da580

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/jdk/java/awt/FontClass/DrawStringWithInfiniteXform.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@
3535
import java.util.TimerTask;
3636

3737
public class DrawStringWithInfiniteXform {
38-
Timer timer;
39-
boolean done;
38+
39+
volatile Timer timer;
40+
volatile boolean done;
41+
4042
class ScheduleTask extends TimerTask {
4143
public void run() {
42-
timer.cancel();
4344
if (!done) {
4445
throw new
4546
RuntimeException("drawString with InfiniteXform transform takes long time");
@@ -48,7 +49,7 @@ public void run() {
4849
}
4950
public DrawStringWithInfiniteXform() {
5051
timer = new Timer();
51-
timer.schedule(new ScheduleTask(), 10000);
52+
timer.schedule(new ScheduleTask(), 20000);
5253
}
5354

5455
public static void main(String [] args) {
@@ -73,6 +74,7 @@ private void start() {
7374
g2d.drawString("abc", 20, 20);
7475
}
7576
done = true;
77+
timer.cancel();
7678
System.out.println("Test passed");
7779
}
7880
}

0 commit comments

Comments
 (0)