Skip to content

Close leaked resources flagged by SonarQube (S2095) - #526

Open
NicoPiel wants to merge 1 commit into
OpenIntegrationEngine:mainfrom
NicoPiel:fix/sonar-resource-leaks
Open

NicoPiel wants to merge 1 commit into
OpenIntegrationEngine:mainfrom
NicoPiel:fix/sonar-resource-leaks

Conversation

@NicoPiel

@NicoPiel NicoPiel commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

MirthWebServer never closed the downloaded file's stream on success, so each download leaked a file handle. Also close the Statement in DefaultDatabaseTaskController.executeUpdate, and close the socket when setup fails after creation in SocketUtil. The extension manager and PDF viewer now use try-with-resources.

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Test Results

  147 files  + 17    147 suites  +17   4m 11s ⏱️ + 1m 9s
1 006 tests +217  1 006 ✅ +217  0 💤 ±0  0 ❌ ±0 
1 330 runs  +415  1 324 ✅ +415  6 💤 ±0  0 ❌ ±0 

Results for commit 3633f52. ± Comparison against base commit a403039.

This pull request removes 16 and adds 233 tests. Note that renamed tests count towards both.
com.mirth.connect.donkey.server.data.jdbc.OracleJdbcDaoTest ‑ testBatchInsertMessageContentKeepsStatementOpenUntilExecuted
com.mirth.connect.donkey.server.data.jdbc.OracleJdbcDaoTest ‑ testFailedBatchInsertClearsAndClosesTheStatement
com.mirth.connect.util.HttpUtilTest ‑ testExecuteGetRequest
net.lingala.zip4j.unzip.UnzipEngineTest ‑ testUnzipWithMaliciousFile1
net.lingala.zip4j.unzip.UnzipEngineTest ‑ testUnzipWithMaliciousFileAndMaliciousNewFileName
net.lingala.zip4j.unzip.UnzipEngineTest ‑ testUnzipWithMaliciousFileButValidNewFileName
net.lingala.zip4j.unzip.UnzipEngineTest ‑ testUnzipWithNormalFile1
net.lingala.zip4j.unzip.UnzipEngineTest ‑ testUnzipWithNormalFile2
net.lingala.zip4j.unzip.UnzipEngineTest ‑ testUnzipWithNormalFileButMaliciousNewFileName
net.lingala.zip4j.unzip.UnzipTest ‑ testExtractAllFromMaliciousFile
…
com.mirth.connect.client.core.api.providers.CalendarParamConverterProviderTest ‑ testInvalidDateThrowsBadRequest
com.mirth.connect.client.core.api.providers.CalendarParamConverterProviderTest ‑ testNullReturnsNull
com.mirth.connect.client.core.api.providers.CalendarParamConverterProviderTest ‑ testValidDateRoundTrips
com.mirth.connect.client.ui.browsers.message.MessageBrowserAdvancedFilterTest ‑ shouldIgnoreBlankNonEqualitySearches
com.mirth.connect.client.ui.browsers.message.MessageBrowserAdvancedFilterTest ‑ shouldIncludeBlankStringEqualitySearches
com.mirth.connect.client.ui.browsers.message.MessageBrowserAdvancedFilterTest ‑ shouldIncludeNonBlankSearches
com.mirth.connect.connectors.file.filesystems.FileConnectionTest ‑ testCanRead
com.mirth.connect.connectors.file.filesystems.FileConnectionTest ‑ testCanWrite
com.mirth.connect.connectors.file.filesystems.FileConnectionTest ‑ testDelete
com.mirth.connect.connectors.file.filesystems.FileConnectionTest ‑ testDeleteExists
…

♻️ This comment has been updated with latest results.

mgaffigan
mgaffigan previously approved these changes Oct 28, 2026
gibson9583
gibson9583 previously approved these changes Oct 30, 2026

@gibson9583 gibson9583 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks safe to merge.

tonygermano
tonygermano previously approved these changes Nov 27, 2026

@tonygermano tonygermano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a couple of suggestions inline. Neither are blockers, but you have a merge conflict that I think will dismiss the existing reviews when you resolve it, so I figured it wouldn't hurt to ask.

MirthWebServer never closed the downloaded file's stream on success, so each download leaked a file handle. Also close the Statement in DefaultDatabaseTaskController.executeUpdate, and close the socket when setup fails after creation in SocketUtil. The extension manager and PDF viewer now use try-with-resources.

Signed-off-by: Nico Piel <nicopiel@mailbox.org>
@NicoPiel
NicoPiel dismissed stale reviews from tonygermano, gibson9583, and mgaffigan via 3633f52 November 27, 2026 13:17
@NicoPiel
NicoPiel force-pushed the fix/sonar-resource-leaks branch from c50ea99 to 3633f52 Compare November 27, 2026 13:17
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.

4 participants