Integrated: JDK-8299627: Fix/improve handling of "missing" element-list file

Jonathan Gibbons jjg at openjdk.org
Tue Jan 16 18:44:31 UTC 2024


On Mon, 20 Nov 2023 23:25:38 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

> Please review a relatively simple fix to work around weirdly configured web servers.
> 
> As first reported in this email,  https://mail.openjdk.org/pipermail/javadoc-dev/2023-January/005502.html
> `docs.oracle.com` will redirect links to https://docs.oracle.com/javase/8/docs/api/element-list to https://docs.oracle.com/en/java/javase/19/ even though the content of the page is completely different, and not as expected.
> It was true back when the email discussion happened, and it is still true today (November 20, 2023).
> 
> For more details: see this:
> 
> $ curl --head https://docs.oracle.com/javase/8/docs/api/element-list
> HTTP/1.1 302 Moved Temporarily
> Location: https://docs.oracle.com/en/java/javase/21/
> Content-Length: 1
> Date: Mon, 20 Nov 2023 23:17:27 GMT
> Connection: keep-alive
> 
> 
> Compare this to accessing `package-list`
> 
> $ curl --head https://docs.oracle.com/javase/8/docs/api/package-list
> HTTP/1.1 200 OK
> Accept-Ranges: bytes
> Content-Type: text/plain
> ETag: "a8e824353743394b56c8af52dce037a1:1697560290.919784"
> Last-Modified: Wed, 04 Oct 2023 08:27:21 GMT
> Server: AkamaiNetStorage
> Content-Length: 4366
> Date: Mon, 20 Nov 2023 23:20:35 GMT
> Connection: keep-alive
> 
> 
> In other words, we're getting `302 Moved Temporarily` instead of `404 Not Found`. Sigh.
> 
> So, with that as background, the fix is to check the end of the redirected URL against the end of the desired URL. to make sure they agree.  In other words, we check that both end in `package-list` or `element-list` as appropriate.
> 
> The fix to the main code is almost trivial.  The test is almost `noreg-hard` and primarily consists of setting up a weirdly configured local web server, to exercise different redirect policies.

This pull request has now been integrated.

Changeset: b533272e
Author:    Jonathan Gibbons <jjg at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/b533272ecb594e918f31b48d7fca6ef62c2cac3f
Stats:     193 lines in 3 files changed: 191 ins; 0 del; 2 mod

8299627: Fix/improve handling of "missing" element-list file

Reviewed-by: hannesw

-------------

PR: https://git.openjdk.org/jdk/pull/16751


More information about the javadoc-dev mailing list