Skip to content

Commit

Permalink
fixed bigdecimal comparison. issue #2681
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Dec 3, 2024
1 parent 211bed9 commit e48d7a1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -819,13 +819,13 @@ public ArchivalDialog(java.awt.Frame parent, boolean modal, String caseId, JTabl

}

if(!totalEscrowDiff.equals(BigDecimal.ZERO)) {
if(totalEscrowDiff.compareTo(BigDecimal.ZERO)!=0) {
this.lblEscrow.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/cancel.png")));
this.chkEscrow.setEnabled(true);
this.lblEscrow.setText("Aktenkonto: Fremdgelder nicht ausgeglichen");
}

if(!totalExpendituresDiff.equals(BigDecimal.ZERO)) {
if(totalExpendituresDiff.compareTo(BigDecimal.ZERO)!=0) {
this.lblExpenditures.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/cancel.png")));
this.chkExpenditures.setEnabled(true);
this.lblExpenditures.setText("Aktenkonto: Auslagen nicht ausgeglichen");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ public BigDecimal calculateTotal(int intervalMinutes) {
}
double roundedMinutes = Math.ceil(totalMinutes / intervalMinutes) * intervalMinutes;
float roundedMinutesFloat = new Float(roundedMinutes);
if (!this.unitPrice.equals(BigDecimal.ZERO)) {
if (this.unitPrice.compareTo(BigDecimal.ZERO)!=0) {
positionTotal = this.unitPrice.multiply(BigDecimal.valueOf(roundedMinutes).divide(BigDecimal.valueOf(60d), 2, RoundingMode.HALF_EVEN));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5677,7 +5677,7 @@ private float getTimesheetPercentageDone(Timesheet ts) {
return 0f;

// avoid div by zero
if(ts.getLimit().equals(BigDecimal.ZERO))
if(ts.getLimit().compareTo(BigDecimal.ZERO)==0)
return 0f;

List<TimesheetPosition> positions=this.timesheetPositionsFacade.findByTimesheet(ts);
Expand Down

0 comments on commit e48d7a1

Please sign in to comment.