fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From my...@apache.org
Subject [fineract-cn-deposit-account-management] 17/23: fixed NPE in Term
Date Mon, 22 Jan 2018 15:28:50 GMT
This is an automated email from the ASF dual-hosted git repository.

myrle pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-deposit-account-management.git

commit 619cbc7ccd188f5ce4ecdb23e5f8eea7e13754ab
Author: mgeiss <mgeiss@mifos.org>
AuthorDate: Mon Jun 26 13:36:29 2017 +0200

    fixed NPE in Term
---
 .../java/io/mifos/deposit/api/v1/definition/domain/Term.java   | 10 ++++++++--
 .../io/mifos/deposit/service/internal/mapper/TermMapper.java   |  4 +++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/api/src/main/java/io/mifos/deposit/api/v1/definition/domain/Term.java b/api/src/main/java/io/mifos/deposit/api/v1/definition/domain/Term.java
index faeeff5..b72c30e 100644
--- a/api/src/main/java/io/mifos/deposit/api/v1/definition/domain/Term.java
+++ b/api/src/main/java/io/mifos/deposit/api/v1/definition/domain/Term.java
@@ -40,11 +40,17 @@ public class Term {
   }
 
   public String getTimeUnit() {
-    return this.timeUnit.name();
+    if (this.timeUnit != null) {
+      return this.timeUnit.name();
+    } else {
+      return null;
+    }
   }
 
   public void setTimeUnit(final String timeUnit) {
-    this.timeUnit = TimeUnit.valueOf(timeUnit);
+    if (timeUnit != null) {
+      this.timeUnit = TimeUnit.valueOf(timeUnit);
+    }
   }
 
   public String getInterestPayable() {
diff --git a/service/src/main/java/io/mifos/deposit/service/internal/mapper/TermMapper.java
b/service/src/main/java/io/mifos/deposit/service/internal/mapper/TermMapper.java
index b6f3dbf..ce98239 100644
--- a/service/src/main/java/io/mifos/deposit/service/internal/mapper/TermMapper.java
+++ b/service/src/main/java/io/mifos/deposit/service/internal/mapper/TermMapper.java
@@ -36,7 +36,9 @@ public class TermMapper {
   public static Term map(final TermEntity termEntity) {
     final Term term = new Term();
     term.setPeriod(termEntity.getPeriod());
-    term.setTimeUnit(termEntity.getTimeUnit());
+    if (termEntity.getTimeUnit() != null) {
+      term.setTimeUnit(termEntity.getTimeUnit());
+    }
     term.setInterestPayable(termEntity.getInterestPayable());
 
     return term;

-- 
To stop receiving notification emails like this one, please contact
myrle@apache.org.

Mime
View raw message