Skip to content
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

8287397 : Print top-level exception when snippet fails to read file #8826

Closed

Conversation

anthonyvdotbe
Copy link
Contributor

@anthonyvdotbe anthonyvdotbe commented May 22, 2022

When using a snippet as follows (on Windows): {@snippet file=baz\Baz.java }, javadoc prints the error:

src\foo\foo\Foo.java:14: error: Error reading file: baz\Baz.java
{@snippet file=baz\Baz.java }
          ^
        (null)

which is unhelpful. So rather than printing the exception's cause (which is null in the example above), it seems better to print the top-level exception itself.

PS: I'll need help from someone to create a JBS issue & sponsor this PR


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8287397: Print top-level exception when snippet fails to read file

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/8826/head:pull/8826
$ git checkout pull/8826

Update a local copy of the PR:
$ git checkout pull/8826
$ git pull https://git.openjdk.org/jdk pull/8826/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 8826

View PR using the GUI difftool:
$ git pr show -t 8826

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/8826.diff

Signed-off-by: Anthony Vanelverdinghe <dev@anthonyv.be>
@bridgekeeper
Copy link

bridgekeeper bot commented May 22, 2022

👋 Welcome back anthonyvdotbe! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented May 22, 2022

@anthonyvdotbe The following label will be automatically applied to this pull request:

  • javadoc

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.

@openjdk openjdk bot added the javadoc javadoc-dev@openjdk.org label May 22, 2022
@anthonyvdotbe anthonyvdotbe marked this pull request as draft May 22, 2022 11:11
@jonathan-gibbons
Copy link
Contributor

@jonathan-gibbons
Copy link
Contributor

@anthonyvdotbe You need to change the PR summary by inserting 8287397 (the JBS issue number) at the beginning.

8287397 : Print top-level exception when snippet fails to read file

@anthonyvdotbe anthonyvdotbe changed the title Print top-level exception when snippet fails to read file 8287397 : Print top-level exception when snippet fails to read file May 27, 2022
@anthonyvdotbe
Copy link
Contributor Author

Thanks for your help @jonathan-gibbons

Actually there's several ways to fix the issue:

  1. report the top-level exception (simplest, current PR)
  2. report the direct cause if non-null, else report the top-level exception (most compatible with current code)
  3. report the innermost exception for which getCause() is null (most helpful message for the user?)

Which of these do you prefer?

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 22, 2022

@anthonyvdotbe This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@jonathan-gibbons
Copy link
Contributor

Thanks for your help @jonathan-gibbons

Actually there's several ways to fix the issue:

  1. report the top-level exception (simplest, current PR)
  2. report the direct cause if non-null, else report the top-level exception (most compatible with current code)
  3. report the innermost exception for which getCause() is null (most helpful message for the user?)

Which of these do you prefer?

In general, exceptions are woefully underspecified, and unless you have specific reasons to know specific details of the exception being thrown, it is generally safest to just report the top-level exception.

@openjdk
Copy link

openjdk bot commented Aug 19, 2022

@anthonyvdotbe 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:

8287397: Print top-level exception when snippet fails to read file

Reviewed-by: jjg

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 2185 new commits pushed to the master branch:

  • 657a0b2: 8295865: Several issues with os::realloc
  • ff2c987: 8294378: URLPermission constructor exception when using tr locale
  • 34a499d: 8294033: x86_64: libm stubs are missing
  • f0b648b: 8296758: [BACKOUT] Revert 8296115
  • 7f587e5: 8296872: gtest is built with the build-jdk
  • 819c691: 8295867: TestVerifyGraphEdges.java fails with exit code -1073741571 when using AlwaysIncrementalInline
  • ced88a2: 8296733: JFR: File Read event for RandomAccessFile::write(byte[]) is incorrect
  • 87b809a: 8296229: JFR: jfr tool should print unsigned values correctly
  • e7c2a8e: 8295214: Generational ZGC: Guard nmethods from cross modifying code
  • d4d183e: 8296301: Interpreter(RISC-V): Implement -XX:+PrintBytecodeHistogram and -XX:+PrintBytecodePairHistogram options
  • ... and 2175 more: https://git.openjdk.org/jdk/compare/c156bcc599534ae989bc9cbd001e7c150da8096c...master

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@jonathan-gibbons) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@jonathan-gibbons
Copy link
Contributor

Note you should verify all javadoc tests pass after making the change.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Aug 19, 2022
@anthonyvdotbe anthonyvdotbe marked this pull request as ready for review November 12, 2022 13:55
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 12, 2022
@anthonyvdotbe
Copy link
Contributor Author

/integrate

All Javadoc tests pass after making the change (I rebased on master (87b809a) before running the tests):

==============================
Test summary
==============================
   TEST                                              TOTAL  PASS  FAIL ERROR
   jtreg:test/langtools:langtools_javadoc              482   482     0     0
==============================
TEST SUCCESS

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Nov 12, 2022
@openjdk
Copy link

openjdk bot commented Nov 12, 2022

@anthonyvdotbe
Your change (at version 50ae8f4) is now ready to be sponsored by a Committer.

@mlbridge
Copy link

mlbridge bot commented Nov 12, 2022

Webrevs

@TheShermanTanker
Copy link
Contributor

/sponsor

@openjdk
Copy link

openjdk bot commented Dec 8, 2022

Going to push as commit 297bf6a.
Since your change was applied there have been 2630 commits pushed to the master branch:

  • 073897c: 8294588: Auto vectorize half precision floating point conversion APIs
  • 46cd457: 8298341: Ensure heap growth in TestNativeMemoryUsageEvents.java
  • 1166c8e: 8296896: Change virtual Thread.yield to use external submit
  • 5175965: 8298323: trivial typo in JOptionPane.OK_OPTION
  • d5cf18e: 8296198: JFileChooser throws InternalError java.lang.InternalError with Windows shortcuts
  • 74f346b: 8298075: RISC-V: Implement post-call NOPs
  • 3aa4070: 8294047: HttpResponseInputStream swallows interrupts
  • af8fb7e: 8282578: AIOOBE in javax.sound.sampled.Clip
  • 8b69a2e: 8298099: [JVMCI] decouple libgraal from JVMCI module at runtime
  • 8a9911e: 8295803: Console should be usable in jshell and other environments
  • ... and 2620 more: https://git.openjdk.org/jdk/compare/c156bcc599534ae989bc9cbd001e7c150da8096c...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Dec 8, 2022
@openjdk openjdk bot closed this Dec 8, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Dec 8, 2022
@openjdk
Copy link

openjdk bot commented Dec 8, 2022

@TheShermanTanker @anthonyvdotbe Pushed as commit 297bf6a.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@anthonyvdotbe anthonyvdotbe deleted the print-toplevel-exception branch February 25, 2023 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated javadoc javadoc-dev@openjdk.org
3 participants