cziegeler opened a new pull request, #38:
URL: https://github.com/apache/sling-org-apache-sling-scripting-core/pull/38

   Improves robustness of the `ScriptCacheConsolePlugin` and 
`ScriptingVariablesConsolePlugin` OSGi Web Console plugins by wrapping servlet 
handler methods in try-catch blocks and sending proper HTTP error responses 
instead of letting exceptions propagate.
   
   **Changes:**
   - `ScriptCacheConsolePlugin.doGet`: wrap in try-catch for `IOException`, 
`ServletException`, and `RuntimeException`; add null-check for classpath 
resource stream (returns 404 if missing)
   - `ScriptCacheConsolePlugin.doPost`: same try-catch wrapping; move 
`resp.setStatus(SC_OK)` inside the success path
   - `ScriptingVariablesConsolePlugin.doGet`: wrap in try-catch for 
`IOException` and `RuntimeException`; remove unused `ServletException` import
   - All handlers now send `500 Internal Server Error` with the exception 
message when the response is not yet committed, and log a secondary error if 
the error response itself fails
   
   Note: the diff was truncated; the `ScriptingVariablesConsolePlugin.doGet` 
catch block tail was not visible, but the pattern matches the changes described 
above.
   
   Co-authored-by: Maia <maia@noreply>


-- 
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