You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/01/22 06:45:29 UTC
[isis] branch master updated: ISIS-2297: fixes potential NPE in
CommandJdoRepository
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new c095d8b ISIS-2297: fixes potential NPE in CommandJdoRepository
c095d8b is described below
commit c095d8b0151a6f2ab3c0324fa0b8bd6efb4de710
Author: Andi Huber <ah...@apache.org>
AuthorDate: Fri Jan 22 07:45:18 2021 +0100
ISIS-2297: fixes potential NPE in CommandJdoRepository
---
.../commandlog/impl/jdo/CommandJdoRepository.java | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/extensions/core/command-log/impl/src/main/java/org/apache/isis/extensions/commandlog/impl/jdo/CommandJdoRepository.java b/extensions/core/command-log/impl/src/main/java/org/apache/isis/extensions/commandlog/impl/jdo/CommandJdoRepository.java
index c16711d..c7f5c8a 100644
--- a/extensions/core/command-log/impl/src/main/java/org/apache/isis/extensions/commandlog/impl/jdo/CommandJdoRepository.java
+++ b/extensions/core/command-log/impl/src/main/java/org/apache/isis/extensions/commandlog/impl/jdo/CommandJdoRepository.java
@@ -73,8 +73,8 @@ public class CommandJdoRepository {
@Inject final JdoSupportService jdoSupport;
public List<CommandJdo> findByFromAndTo(
- @Nullable final LocalDate from,
- @Nullable final LocalDate to) {
+ final @Nullable LocalDate from,
+ final @Nullable LocalDate to) {
final Timestamp fromTs = toTimestampStartOfDayWithOffset(from, 0);
final Timestamp toTs = toTimestampStartOfDayWithOffset(to, 1);
@@ -126,9 +126,9 @@ public class CommandJdoRepository {
public List<CommandJdo> findByTargetAndFromAndTo(
- final Bookmark target
- , final LocalDate from
- , final LocalDate to) {
+ final Bookmark target,
+ final @Nullable LocalDate from,
+ final @Nullable LocalDate to) {
final Timestamp fromTs = toTimestampStartOfDayWithOffset(from, 0);
final Timestamp toTs = toTimestampStartOfDayWithOffset(to, 1);
@@ -158,13 +158,15 @@ public class CommandJdoRepository {
return repositoryService().allMatches(query);
}
- private static Timestamp toTimestampStartOfDayWithOffset(final LocalDate dt, int daysOffset) {
-
- val timestamp = dt.atStartOfDay().plusDays(daysOffset).atZone(ZoneId.systemDefault());
+ private static Timestamp toTimestampStartOfDayWithOffset(
+ final @Nullable LocalDate dt,
+ final int daysOffset) {
return dt!=null
- ?new java.sql.Timestamp(Instant.from(timestamp).toEpochMilli())
- :null;
+ ? new java.sql.Timestamp(
+ Instant.from(dt.atStartOfDay().plusDays(daysOffset).atZone(ZoneId.systemDefault()))
+ .toEpochMilli())
+ : null;
}