-
Notifications
You must be signed in to change notification settings - Fork 6.1k
JDK-8262899: TestRedirectLinks fails #3137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👋 Welcome back jjg! A progress list of the required criteria for merging this PR into |
@jonathan-gibbons The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
A good place to look for network idioms would be |
* Use InetAddress.getLoopbackAddress * Suppress irrelevant doclint warnings * Check if testURL host is resolveable * Report duration if test connection fails (Duration is ~75 seconds on local machine.)
@@ -385,7 +385,7 @@ private boolean link(String url, String elemlisturl, Reporter reporter, boolean | |||
private static final long serialVersionUID = 0; | |||
|
|||
Fault(String msg, Exception cause) { | |||
super(msg, cause); | |||
super(msg + (cause == null ? "" : " (" + cause + ")"), cause); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although this message concatenation captures the immediate cause of the Fault
, it doesn't capture those deeper exceptions that might be present in the chain. Moreover, such concatenation is required in all places where the cause is to be preserved.
A better way to do it would be to derive diagnostic information from all the exceptions in the chain on the handling site (i.e. wherever this exception is caught). Later we should consider improving jdk.javadoc.doclet.Reporter.print
instead of introducing this concatenation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe. There's a tension between investing effort in an increasingly rare occurrence, and the pain of investigating the occurrence when it does arise.
@@ -84,9 +87,31 @@ public static void main(String... args) throws Exception { | |||
*/ | |||
@Test | |||
public void testRedirects() throws Exception { | |||
// first, test to see if access to external URLs is available | |||
// This test relies on access to an external resource, which may or may not be | |||
// reliably available, depending on the shost system configuration and other |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: shost
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix.
"--module", "mA,mB") | ||
"--module", "mA,mB", | ||
"-Xdoclint:none") | ||
.run() | ||
.writeAll(); | ||
|
||
javadoc("-d", libApi.toString(), | ||
"--module-source-path", libSrc.toString(), | ||
"--module", "mA,mB" ); | ||
"--module", "mA,mB", | ||
"-Xdoclint:none" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you add -Xdoclint:none
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because doclint generated spurious irrelevant warnings in the output that were an unnecessary distraction. The alternative would have been to sprinkle dummy comments throughout the code.
return; | ||
} | ||
|
||
// test to see if access to external URLs is available, and that the URL uses a redirect | ||
|
||
URL testURL = new URL("http://docs.oracle.com/en/java/javase/11/docs/api/element-list"); | ||
String testURLHost = testURL.getHost(); | ||
try { | ||
InetAddress testAddr = InetAddress.getByName(testURLHost); | ||
out.println("Found " + testURLHost + ": " + testAddr); | ||
} catch (UnknownHostException e) { | ||
out.println("Setup failed (" + testURLHost + " not found); this test skipped"); | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L98 and L110: can we use jtreg.SkippedException
instead? That way the results of the test test run might look more clearly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because that means the entire text was skipped; here we just want to skip one @Test
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's rather unfortunate that a setup that uses @javadoc.tester.JavadocTester.Test
works differently than that of @org.testng.annotations.Test
.
@jonathan-gibbons This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 119 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
/integrate |
@jonathan-gibbons Since your change was applied there have been 119 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit f17ea9e. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Please review a trivial change to fix this test when run behind a firewall with a proxy set.
Previously, the test used
InetAddress.getLocalHost
which returns an IP address for the current host. It runs a temporary local web server on that address, but since the address is typically not on thenonProxyHosts
list, the attempted access to the web server goes to the proxy, and fails.The fix is to explicitly use
127.0.0.1
, which should never go to a proxy, if one is set.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3137/head:pull/3137
$ git checkout pull/3137
Update a local copy of the PR:
$ git checkout pull/3137
$ git pull https://git.openjdk.java.net/jdk pull/3137/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 3137
View PR using the GUI difftool:
$ git pr show -t 3137
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3137.diff