galovics commented on code in PR #2712:
URL: https://github.com/apache/fineract/pull/2712#discussion_r1015691696
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedularWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -102,10 +102,10 @@ public void updateSchedulerDetail(final SchedulerDetail
schedulerDetail) {
}
@Override
- public SchedulerDetail retriveSchedulerDetail() {
+ public SchedulerDetail retrieveSchedulerDetail() {
SchedulerDetail schedulerDetail = null;
final List<SchedulerDetail> schedulerDetailList =
this.schedulerDetailRepository.findAll();
- if (schedulerDetailList != null) {
+ if (schedulerDetailList != null && schedulerDetailList.size() > 0) {
schedulerDetail = schedulerDetailList.get(0);
Review Comment:
If this is the logic, why don't we simple grab the first item via the query?
I mean it wasn't you who implemented this but since you're touching it, would
be worth to optimize a bit. What do you think?
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedularWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -102,10 +102,10 @@ public void updateSchedulerDetail(final SchedulerDetail
schedulerDetail) {
}
@Override
- public SchedulerDetail retriveSchedulerDetail() {
+ public SchedulerDetail retrieveSchedulerDetail() {
SchedulerDetail schedulerDetail = null;
final List<SchedulerDetail> schedulerDetailList =
this.schedulerDetailRepository.findAll();
- if (schedulerDetailList != null) {
+ if (schedulerDetailList != null && schedulerDetailList.size() > 0) {
Review Comment:
Could be replaced by a simple CollectionUtils.isNotEmpty call.
--
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]