From e48d7a18569641f437ecd8b622413baf8a8f1603 Mon Sep 17 00:00:00 2001 From: j-dimension Date: Wed, 4 Dec 2024 00:04:49 +0100 Subject: [PATCH] fixed bigdecimal comparison. issue #2681 --- .../jlawyer/client/editors/files/ArchivalDialog.java | 4 ++-- .../com/jdimension/jlawyer/persistence/TimesheetPosition.java | 2 +- .../com/jdimension/jlawyer/services/ArchiveFileService.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ArchivalDialog.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ArchivalDialog.java index 8c72f6e8..c0658a26 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ArchivalDialog.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ArchivalDialog.java @@ -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"); diff --git a/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/persistence/TimesheetPosition.java b/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/persistence/TimesheetPosition.java index cb597531..94906a19 100644 --- a/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/persistence/TimesheetPosition.java +++ b/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/persistence/TimesheetPosition.java @@ -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)); } } diff --git a/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/services/ArchiveFileService.java b/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/services/ArchiveFileService.java index e934021b..279cfe29 100644 --- a/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/services/ArchiveFileService.java +++ b/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/services/ArchiveFileService.java @@ -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 positions=this.timesheetPositionsFacade.findByTimesheet(ts);