renechoi opened a new pull request, #5010:
URL: https://github.com/apache/zeppelin/pull/5010

   ## What is this PR for?
   This PR fixes resource management issues throughout the Zeppelin codebase, 
specifically addressing resource leaks and potential NullPointerExceptions.
   
   ## What type of PR is it?
   Bug Fix / Improvement
   
   ## What is the Jira issue?
   (Please create a JIRA issue if needed)
   
   ## How should this be tested?
   - All modified files compile successfully
   - Existing tests should pass without modification
   - The changes maintain backward compatibility
   
   ## Screenshots (if appropriate)
   N/A
   
   ## Questions:
   * Does the license files need update? No
   * Is there breaking changes for older versions? No
   * Does this need documentation? No (internal improvements only)
   
   ## Changes Made:
   
   ### 1. AlluxioInterpreterTest.java
   - Fixed FileInputStream resource leak by using try-finally block
   - Ensures stream is closed even when exceptions occur
   
   ### 2. Resource Loading Null Checks
   Added null checks for `getResourceAsStream()` calls in:
   - **ZeppelinR.java**: Loading R/zeppelin_sparkr.R
   - **PythonInterpreter.java**: Loading Python resources (also fixed missing 
InputStream import)
   - **IPythonInterpreter.java**: Loading python/zeppelin_ipython.py, 
python/zeppelin_context.py, and additional init files
   - **IRInterpreter.java**: Loading R/zeppelin_isparkr.R
   
   ### Benefits:
   - Prevents resource leaks that could cause memory issues in long-running 
processes
   - Prevents NullPointerException when resources are missing
   - Provides clear error messages when resources cannot be found
   - Improves overall stability and reliability
   
   ### Testing Notes:
   While I couldn't run all tests due to environment setup issues, all files 
compile successfully and the changes are minimal and safe - they only add 
defensive programming practices without changing any business logic.


-- 
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: reviews-unsubscr...@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to