Add id validation and improve code formatting in updateSamplingRate

Enhance input validation and code quality in the SamplingRate service:

- Add null check for id parameter in updateSamplingRate() method to prevent
  potential NullPointerException when calling repository.findById()
- Standardize indentation throughout the updateSamplingRate() method body,
  improving code readability and consistency with project style guidelines

This complements the previous validation improvements by ensuring all
method parameters are properly validated before use, creating a more
defensive and robust API surface.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Gustavo Henrique Santos Souza de Miranda 2025-12-06 22:30:51 -03:00
parent ff09d1b89a
commit 94297e75b9
1 changed files with 16 additions and 13 deletions

View File

@ -40,6 +40,9 @@ public class SamplingRateService {
}
public Optional<SamplingRate> updateSamplingRate(Integer id, String value) {
if (id == null) {
throw new IllegalArgumentException("ID cannot be null");
}
logger.info("Updating sampling rate:{}", value);
if (value == null || value.trim().isEmpty()) {
throw new IllegalArgumentException("Sampling-Rate value cannot be null or empty");