-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rrd4j] Avoid IAE thrown if e.g. invalid start/end time given #14238
Conversation
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
...ence.rrd4j/src/main/java/org/openhab/persistence/rrd4j/internal/RRD4jPersistenceService.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix. I have left one comment with a suggestion. Unless I'm mistaken this would fix the root cause rather than the symptom.
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
// do not call method {@link RrdDb#createFetchRequest(ConsolFun, long, long, long)} if start > end to avoid | ||
// an IAE to be thrown | ||
if (start > end) { | ||
logger.warn("Could not query rrd4j database for item '{}': start ({}) > end ({})", itemName, start, | ||
end); | ||
return List.of(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could consider throwing IllegalArgumentException
by ourselves here, since this would now be a bug on caller side, where previously it was an internal bug within this method. But let's leave something for future improvement also. 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix and patience.
…b#14238) Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
…b#14238) Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
…b#14238) Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
FetchRequest
called bycreateFetchRequest
method (e.g. invalid start/end time given)See https://github.com/rrd4j/rrd4j/blob/85183713741c648b88926ed3085c4dd87fd9016f/src/main/java/org/rrd4j/core/FetchRequest.java
Signed-off-by: Christoph Weitkamp github@christophweitkamp.de