From 97c1c3882d48478d41c6987fbf8125a6dceaa60c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 23 Sep 2017 01:57:02 +0200 Subject: [PATCH] Continued a bit: - receiptNumber may be (valid!) null, but never < 1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../jfinancials/model/receipt/Receipts.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/org/mxchange/jfinancials/model/receipt/Receipts.java b/src/org/mxchange/jfinancials/model/receipt/Receipts.java index 7c00650..c6e6493 100644 --- a/src/org/mxchange/jfinancials/model/receipt/Receipts.java +++ b/src/org/mxchange/jfinancials/model/receipt/Receipts.java @@ -46,12 +46,6 @@ public class Receipts implements Serializable { } else if ((receipt1.getReceiptId() instanceof Long) && (receipt1.getReceiptId() < 1)) { // Throw IAE throw new IllegalArgumentException(MessageFormat.format("receipt1.receiptId={0} is not valid.", receipt1.getReceiptId())); - } else if (receipt1.getReceiptNumber() == null) { - // Throw NPE - throw new NullPointerException("receipt1.receiptNumber is null"); - } else if (receipt1.getReceiptNumber() < 1) { - // Throw IAE - throw new IllegalArgumentException(MessageFormat.format("receipt1.receiptNumber={0} is not valid", receipt1.getReceiptNumber())); } else if (receipt1.getReceiptBranchOffice() == null) { // Throw NPE throw new NullPointerException("receipt1.receiptBranchOffice is null"); @@ -61,6 +55,9 @@ public class Receipts implements Serializable { } else if (receipt1.getReceiptBranchOffice().getBranchId() < 1) { // Throw NPE throw new NullPointerException(MessageFormat.format("receipt1.receiptBranchOffice.branchId={0} is not valid", receipt1.getReceiptBranchOffice().getBranchId())); + } else if ((receipt1.getReceiptNumber() instanceof Long) && (receipt1.getReceiptNumber() < 1)) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("receipt1.receiptNumber={0} is not valid.", receipt1.getReceiptNumber())); } else if (receipt1.getReceiptPaymentType()== null) { // Throw NPE throw new NullPointerException("receipt1.receiptPaymentType is null"); @@ -70,12 +67,6 @@ public class Receipts implements Serializable { } else if ((receipt2.getReceiptId() instanceof Long) && (receipt2.getReceiptId() < 1)) { // Throw IAE throw new IllegalArgumentException(MessageFormat.format("receipt2.receiptId={0} is not valid.", receipt2.getReceiptId())); - } else if (receipt2.getReceiptNumber() == null) { - // Throw NPE - throw new NullPointerException("receipt2.receiptNumber is null"); - } else if (receipt2.getReceiptNumber() < 1) { - // Throw IAE - throw new IllegalArgumentException(MessageFormat.format("receipt2.receiptNumber={0} is not valid", receipt2.getReceiptNumber())); } else if (receipt2.getReceiptBranchOffice() == null) { // Throw NPE throw new NullPointerException("receipt2.receiptBranchOffice is null"); @@ -85,6 +76,9 @@ public class Receipts implements Serializable { } else if (receipt2.getReceiptBranchOffice().getBranchId() < 1) { // Throw NPE throw new NullPointerException(MessageFormat.format("receipt2.receiptBranchOffice.branchId={0} is not valid", receipt2.getReceiptBranchOffice().getBranchId())); + } else if ((receipt2.getReceiptNumber() instanceof Long) && (receipt2.getReceiptNumber() < 1)) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("receipt2.receiptNumber={0} is not valid.", receipt2.getReceiptNumber())); } else if (receipt2.getReceiptPaymentType()== null) { // Throw NPE throw new NullPointerException("receipt2.receiptPaymentType is null"); -- 2.39.5