[9.2.0] Prevent UrlRewriterParseException from being wrapped in RuntimeException (https://github.com/bazelbuild/bazel/pull/28305) (#30212)

When attempting to run a Bazel command, Bazel server will shutdown and
exit with an unexpected error when the [downloader
config](https://bazel.build/reference/command-line-reference#common_options-flag--downloader_config)
is invalid:

```
$ echo "#test\nfoo" > bazel_downloader.cfg
$ cat bazel_downloader.cfg
#test
foo
$ bazel-dev build //... --downloader_config=bazel_downloader.cfg
< exits immediately with the Bazel server killed >
$ echo $?
37
```

`37` corresponds to `Unhandled Exception / Internal Bazel Error` as per
the [docs](https://bazel.build/run/scripts#exit-codes).

This PR introduces changes that will let catch and rethrow
`UrlRewriterParseException` before `Closer.rethrow()` to prevent it from
being wrapped in `RuntimeException`.

```
$ bazel-dev-fixed query //... --downloader_config=bazel_downloader.cfg
...
ERROR: Failed to parse downloader config at bazel_downloader.cfg:2: Unable to parse: foo
$ echo $?
2
```

Closes #28305.

PiperOrigin-RevId: 891501161
Change-Id: I3cbfe2e2cdcad14c6b5e8210e2e1b8e999eba0ae

Commit
https://github.com/bazelbuild/bazel/commit/45ea1f009a76996b32d8eda0bd5f43f958a68293

Co-authored-by: Alexey Tereshenkov <50622389+AlexTereshenkov@users.noreply.github.com>
2 files changed
tree: 8d189dbbd1931486d611d5338646b97f05e2e8ac
  1. .bazelci/
  2. .github/
  3. docs/
  4. examples/
  5. scripts/
  6. site/
  7. src/
  8. third_party/
  9. tools/
  10. .bazelrc
  11. .bazelversion
  12. .gitattributes
  13. .gitignore
  14. AUTHORS
  15. bazel_downloader.cfg
  16. BUILD
  17. CHANGELOG.md
  18. CODE_OF_CONDUCT.md
  19. CODEOWNERS
  20. combine_distfiles.py
  21. combine_distfiles_to_tar.sh
  22. compile.sh
  23. CONTRIBUTING.md
  24. CONTRIBUTORS
  25. distdir.bzl
  26. extensions.bzl
  27. LICENSE
  28. maven_install.json
  29. MODULE.bazel
  30. MODULE.bazel.lock
  31. README.md
  32. repositories.bzl
  33. requirements.txt
  34. SECURITY.md
README.md

Bazel

{Fast, Correct} - Choose two

Build and test software of any size, quickly and reliably.

  • Speed up your builds and tests: Bazel rebuilds only what is necessary. With advanced local and distributed caching, optimized dependency analysis and parallel execution, you get fast and incremental builds.

  • One tool, multiple languages: Build and test Java, C++, Android, iOS, Go, and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.

  • Scalable: Bazel helps you scale your organization, codebase, and continuous integration solution. It handles codebases of any size, in multiple repositories or a huge monorepo.

  • Extensible to your needs: Easily add support for new languages and platforms with Bazel's familiar extension language. Share and re-use language rules written by the growing Bazel community.

Getting Started

Documentation

Reporting a Vulnerability

To report a security issue, please email security@bazel.build with a description of the issue, the steps you took to create the issue, affected versions, and, if known, mitigations for the issue. Our vulnerability management team will respond within 3 working days of your email. If the issue is confirmed as a vulnerability, we will open a Security Advisory. This project follows a 90 day disclosure timeline.

Contributing to Bazel

See CONTRIBUTING.md

Build status