gravitino icon indicating copy to clipboard operation
gravitino copied to clipboard

[Improvement] Prevent potential null pointer error in MetadataObjectStatisticsOperations.java

Open justinmclean opened this issue 1 month ago • 2 comments

What would you like to be improved?

Added validate to MetadataObjectStatisticsOperations.java dropStatistics method to throw a clear error when the caller supplies a null or empty statistics list, preventing a NullPointerExceptions.

Adding a few lines to the existing test shows the issue:

 private void testDropStatistics(SupportsStatistics supportsStatistics, String path)
      throws JsonProcessingException {
    Assertions.assertThrows(
        IllegalArgumentException.class, () -> supportsStatistics.dropStatistics(null));
    Assertions.assertThrows(
        IllegalArgumentException.class, () -> supportsStatistics.dropStatistics(Collections.emptyList()));

How should we improve?

see above

justinmclean avatar Nov 14 '25 06:11 justinmclean

Hi! @justinmclean Can I take this issue?

Pikady avatar Nov 14 '25 13:11 Pikady

Sure it's all yours. If you have any questions, just ask.

justinmclean avatar Nov 14 '25 22:11 justinmclean