SebTardif opened a new pull request, #4127:
URL: https://github.com/apache/logging-log4j2/pull/4127

   ## What this PR does
   
   In `log4j-core/.../config/ConfigurationSource.java`, method 
`getConfigurationSource(URL)`: `url.openConnection()` creates a URLConnection, 
but on both error paths (FileNotFoundException, IOException/URISyntaxException) 
the connection is never closed or disconnected.
   
   For `HttpURLConnection` this leaks a socket. For `JarURLConnection` this 
leaks a file handle (relevant to locked JARs on Tomcat redeploy scenarios).
   
   **Fix:**
   - Added a `boolean success` flag with try-finally pattern to 
disconnect/close on error paths
   - Reused the existing `file` variable instead of calling 
`FileUtils.fileFromUri(url.toURI())` a second time
   
   ## AI Disclosure
   
   Developed with AI assistance (Grok by xAI) in a human-in-the-loop workflow. 
All code reviewed and verified by the human author.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to