GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [3.10.x] Use try-with-resources by slachiewicz · Pull Request #12845 · apache/maven

Conversation

@slachiewicz

@slachiewicz slachiewicz commented Aug 26, 2026

Copy link
Copy Markdown
Member

Make sure resources (AuthenticationContext, InputStream, Reader, PrintWriter) are properly closed even when exceptions are thrown by using try-with-resources.

Rebase / adaptation of #669 for maven-3.10.x:

  • LegacyRepositorySystem: AuthenticationContext try-with-resources for getAuthentication and getProxy
  • MavenRepositorySystem: AuthenticationContext try-with-resources for getAuthentication and getProxy
  • ProjectBuildingException: PrintWriter try-with-resources in createMessage
  • DefaultMavenPluginManager: InputStream and Reader try-with-resources in extractPluginDescriptor and parsePluginDescriptor

Related: #669, #12843

  • I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@slachiewicz
Use try-with-resources
e78c1a1
Closes #669
This was referenced Aug 26, 2026
[3.9.x] Use try-with-resources #12846
Merged
Use try-with-resources #669
Closed
@gnodet gnodet mentioned this pull request Aug 26, 2026
[4.0.x] Use try-with-resources for AuthenticationContext #12844
Merged
1 task done
slawekjaranowski
slawekjaranowski approved these changes Aug 26, 2026
View reviewed changes
@slachiewicz slachiewicz added the maintenance label Aug 26, 2026
@slachiewicz
slachiewicz merged commit 6f49fdc into maven-3.10.x Aug 26, 2026
22 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@slachiewicz
slachiewicz deleted the feature/maven-3.10.x-try-with-resources branch August 26, 2026 20:43
@github-actions github-actions Bot added this to the 3.10.0 milestone Aug 26, 2026
@github-actions github-actions Bot assigned slachiewicz Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@slawekjaranowski slawekjaranowski slawekjaranowski approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@slachiewicz slachiewicz

Labels

maintenance

Projects

None yet

Milestone

3.10.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@slachiewicz @slawekjaranowski
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.