Skip to content

Commit

Permalink
8264526: javax/swing/text/html/parser/Parser/8078268/bug8078268.java …
Browse files Browse the repository at this point in the history
…timeout

Reviewed-by: serb
  • Loading branch information
DamonFool committed Apr 2, 2021
1 parent 66d9961 commit da643cd
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -39,6 +39,7 @@ public class bug8078268 {
static volatile Exception exception;

public static void main(String[] args) throws Exception {
long timeout = 10_000;
long s = System.currentTimeMillis();
SwingUtilities.invokeLater(new Runnable() {
@Override
Expand All @@ -53,14 +54,14 @@ public void run() {
}
}
});
while (!parsingDone && exception == null && System.currentTimeMillis() - s < 5_000) {
while (!parsingDone && exception == null && System.currentTimeMillis() - s < timeout) {
Thread.sleep(200);
}
final long took = System.currentTimeMillis() - s;
if (exception != null) {
throw exception;
}
if (took > 5_000) {
if (took > timeout) {
throw new RuntimeException("Parsing takes too long.");
}
}
Expand Down

3 comments on commit da643cd

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DamonFool
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk11u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on da643cd Nov 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DamonFool @DamonFool the backport was successfully created on the branch DamonFool-backport-da643cdb in my personal fork of openjdk/jdk11u-dev. To create a pull request with this backport targeting openjdk/jdk11u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

this pull request contains a backport of commit da643cdb from the openjdk/jdk repository.

The commit being backported was authored by Jie Fu on 2 Apr 2021 and was reviewed by Sergey Bylokhov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk11u-dev:

$ git fetch https://github.com/openjdk-bots/jdk11u-dev DamonFool-backport-da643cdb:DamonFool-backport-da643cdb
$ git checkout DamonFool-backport-da643cdb
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk11u-dev DamonFool-backport-da643cdb

Please sign in to comment.