FINERACT-822 Integrating Error Prone

This commit is contained in:
percyashu
2020-05-28 20:40:35 +02:00
committed by Michael Vorburger ⛑️
parent 896571d479
commit e10a78b2bd
9 changed files with 113 additions and 12 deletions
@@ -88,9 +88,13 @@ public class MathUtil {
/** @return calculates minimum of the two values considering null values
* @param notNull if true then null parameter is omitted, otherwise returns null */
public static Long min(Long first, Long second, boolean notNull) {
return first == null
? (notNull ? second : null)
: second == null ? (notNull ? first : null) : Math.min(first, second);
if (first == null){
return notNull ? second : null;
}
if (second == null) {
return notNull ? first : null;
}
return Math.min(first, second);
}
/** @return calculates minimum of the values considering null values
@@ -42,7 +42,7 @@ public class FloatingRateDTO {
public BigDecimal fetchBaseRate(LocalDate date) {
BigDecimal rate = null;
for (FloatingRatePeriodData periodData : this.baseLendingRatePeriods) {
final LocalDate periodFromDate = new LocalDate(periodData.getFromDate());
final LocalDate periodFromDate = periodData.getFromDate();
if (periodFromDate.isBefore(date) || periodFromDate.isEqual(date)) {
rate = periodData.getInterestRate();
break;
@@ -62,7 +62,7 @@ public class FloatingRatePeriodData implements
}
public LocalDate getFromDateAsLocalDate() {
return new LocalDate(this.fromDate);
return this.fromDate;
}
public BigDecimal getInterestRate() {
@@ -1657,7 +1657,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
for (SavingsAccountTransaction transaction : savingsAccount.getTransactions()) {
if ((transaction.getTransactionLocalDate().isEqual(transferDate)
&& transaction.getTransactionLocalDate().isAfter(new LocalDate(transferDate)))
&& transaction.getTransactionLocalDate().isAfter(transferDate))
|| transaction.getTransactionLocalDate().isAfter(transferDate)) {
throw new GeneralPlatformDomainRuleException(TransferApiConstants.transferClientSavingsException,
TransferApiConstants.transferClientSavingsException, new LocalDate(transaction.createdDate()),
@@ -1667,4 +1667,4 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
}
}
}
}