Skip to content

fix: close streams and writers with try-with-resources#1390

Merged
joaodinissf merged 1 commit into
dsldevkit:masterfrom
joaodinissf:fix/check-ui-resource-leaks
Jun 1, 2026
Merged

fix: close streams and writers with try-with-resources#1390
joaodinissf merged 1 commit into
dsldevkit:masterfrom
joaodinissf:fix/check-ui-resource-leaks

Conversation

@joaodinissf

Copy link
Copy Markdown
Collaborator

Several streams/writers were leaked on non-happy paths:

  • DeployJobFileInputStream passed to EMF Resource.load (which doesn't close caller-supplied streams).
  • CheckExtensionGeneratorBufferedInputStream passed to SAXParser.parse.
  • KeywordAnalysisHelper (printViolations / printReport) — PrintWriters closed only on the happy path.

Each is wrapped in try-with-resources so it's always closed. (The two IFile.getContents() sites in CheckTocGenerator/CheckContextsGenerator are handled separately — their throws CoreException methods need IOException-from-close() handling.)

Found by a repo-wide inconsistency sweep.

🤖 Generated with Claude Code

Several streams/writers were leaked on non-happy paths:
- DeployJob: FileInputStream passed to EMF Resource.load (which does not close
  caller streams)
- CheckExtensionGenerator: BufferedInputStream passed to SAXParser.parse
- KeywordAnalysisHelper.printViolations / printReport: PrintWriters closed only
  on the happy path

Wrap each in try-with-resources so they are always closed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@joaodinissf joaodinissf marked this pull request as ready for review May 30, 2026 16:29
@joaodinissf joaodinissf enabled auto-merge (rebase) May 30, 2026 16:35
@joaodinissf joaodinissf merged commit 4ece5ba into dsldevkit:master Jun 1, 2026
4 checks passed
@joaodinissf joaodinissf deleted the fix/check-ui-resource-leaks branch June 1, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants