balodesecurity opened a new pull request, #8420:
URL: https://github.com/apache/hadoop/pull/8420

   ## Summary
   - `InstrumentationService.Timer.getValues()` throws 
`ArrayIndexOutOfBoundsException` (index -1) and would divide by zero when 
called on a freshly constructed `Timer` before any `Cron` has been recorded 
(`last == -1`).
   - Fix: return an all-zeros array immediately when `last < 0`, matching the 
suggestion in the JIRA ticket. This is the same defensive pattern used in 
`Sampler.getRate()` which guards against `last == 0`.
   
   ## Test
   - Added `timerGetValuesBeforeAnyCron()` to `TestInstrumentationService` — 
creates a fresh `Timer(2)`, asserts `getValues()` returns zeros without 
exception, and also asserts `toJSONString()` does not throw.
   - All 7 tests in `TestInstrumentationService` pass.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to