Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

FINERACT-1266: Fix potential NPE in determineInterestPostingPeriods - #5454

Merged
adamsaghy merged 1 commit into
apache:developfrom
Satish11012007:FINERACT-1266-fix-npe
Feb 19, 2026
Merged

adamsaghy merged 1 commit into
apache:developfrom
Satish11012007:FINERACT-1266-fix-npe

Conversation

@Satish11012007

@Satish11012007 Satish11012007 commented Feb 6, 2026 •

Copy link
Copy Markdown
Contributor

Description:
This PR addresses a potential NullPointerException in
determineInterestPostingPeriods by adding null-safety checks
for edge cases where inputs may be absent. The change improves
stability without affecting existing logic.

Key Changes:

  • Added defensive null checks to prevent potential NPE
  • Ensured safe handling of empty or missing inputs
  • No functional changes for valid scenarios

Testing:

  • Project builds successfully with Gradle
  • Existing tests pass
  • Manually verified affected code paths

Checklist:

@Satish11012007

Copy link
Copy Markdown
Contributor Author

This PR fixes one of the potential NPE scenarios related to FINERACT-932.
Other cases tracked under the parent issue may still remain.

@airajena

airajena commented Feb 9, 2026

Copy link
Copy Markdown
Contributor

@Satish11012007 , please sign your commit and also fix the PR title.

@adamsaghy

Copy link
Copy Markdown
Contributor

@Satish11012007 Please rebase this PR with latest develop branch!

Also it seems licence headers are missing from the newly created files:

* What went wrong:
Execution failed for task ':rat'.
> A failure occurred while executing org.nosphere.apache.rat.RatWork
   > Apache Rat audit failure - 1 unapproved license
     	See file:///home/runner/work/fineract/fineract/build/reports/rat/index.html

@airajena

Copy link
Copy Markdown
Contributor

@Satish11012007 please squash your commits into one commit and also please sign your commit.

@Satish11012007
Satish11012007 marked this pull request as draft February 16, 2026 18:17

private static final CompoundInterestHelper COMPOUND_INTEREST_HELPER = new CompoundInterestHelper();

// FIXED METHOD (FINERACT-1266)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the AI generated, useless comments!

return postingPeriods;
}

// 🔐 Null-safe list

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the AI generated, useless comments!

postInterestAsOn = Collections.emptyList();
}

// 🔐 Null-safe posting period

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the AI generated, useless comments!

private LocalDate determineInterestPostingPeriodEndDateFrom(final LocalDate periodStartDate,
final SavingsPostingInterestPeriodType interestPostingPeriodType, final LocalDate interestPostingUpToDate,

// FIXED HELPER METHOD

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the AI generated, useless comments!

final LocalDate interestPostingUpToDate,
Integer financialYearBeginningMonth) {

// 🔐 Null-safe fallback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the AI generated, useless comments!

Comment thread .gitignore

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What did you change here?

@adamsaghy adamsaghy changed the title FINERACT-1266 Fix potential NPE in determineInterestPostingPeriods FINERACT-1266: Fix potential NPE in determineInterestPostingPeriods Feb 17, 2026
@adamsaghy

Copy link
Copy Markdown
Contributor

@Satish11012007 Please squash your commits and make sure the commit message is correct. THe 1st commit message are missing the : after the FINERACT-1266 part.

}

if (!isEndDateSet) {
periodEndDate = quarterlyDates.get(0).plusYears(1).with(TemporalAdjusters.lastDayOfMonth());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you removed this?

}

if (!isEndDateSet) {
periodEndDate = biannualDates.get(0).plusYears(1).with(TemporalAdjusters.lastDayOfMonth());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you removed this?

@adamsaghy adamsaghy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kindly see my concerns!

@Satish11012007
Satish11012007 marked this pull request as ready for review February 17, 2026 18:43
@adamsaghy
adamsaghy merged commit 89487a8 into apache:develop Feb 19, 2026
36 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants