fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vishwasb...@apache.org
Subject fineract git commit: handling null pointer exception and updating integration tests for changes made as a part of FINERACT-590
Date Sat, 10 Feb 2018 02:03:05 GMT
Repository: fineract
Updated Branches:
  refs/heads/develop 8ac548554 -> e3ce5f3ae


handling null pointer exception and updating integration tests for changes made as a part
of FINERACT-590


Project: http://git-wip-us.apache.org/repos/asf/fineract/repo
Commit: http://git-wip-us.apache.org/repos/asf/fineract/commit/e3ce5f3a
Tree: http://git-wip-us.apache.org/repos/asf/fineract/tree/e3ce5f3a
Diff: http://git-wip-us.apache.org/repos/asf/fineract/diff/e3ce5f3a

Branch: refs/heads/develop
Commit: e3ce5f3ae054ae2a4194184d6438622bb865a7f7
Parents: 8ac5485
Author: Vishwas Babu A J <vishwas@confluxtechnologies.com>
Authored: Fri Feb 9 18:02:56 2018 -0800
Committer: Vishwas Babu A J <vishwas@confluxtechnologies.com>
Committed: Fri Feb 9 18:02:56 2018 -0800

----------------------------------------------------------------------
 .../fineract/integrationtests/AccountNumberPreferencesTest.java  | 3 ++-
 .../fineract/portfolio/client/domain/AccountNumberGenerator.java | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/fineract/blob/e3ce5f3a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountNumberPreferencesTest.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountNumberPreferencesTest.java
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountNumberPreferencesTest.java
index 97c3fac..12830cd 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountNumberPreferencesTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountNumberPreferencesTest.java
@@ -373,8 +373,9 @@ public class AccountNumberPreferencesTest {
         }
     }
 
-    private void validateAccountNumberLengthAndStartsWithPrefix(final String accountNumber,
final String prefix) {
+    private void validateAccountNumberLengthAndStartsWithPrefix(final String accountNumber,
String prefix) {
         if (prefix != null) {
+        		prefix = prefix.substring(0, Math.min(prefix.length(), 10));
             Assert.assertEquals(accountNumber.length(), prefix.length() + 9);
             Assert.assertTrue(accountNumber.startsWith(prefix));
         } else {

http://git-wip-us.apache.org/repos/asf/fineract/blob/e3ce5f3a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/AccountNumberGenerator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/AccountNumberGenerator.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/AccountNumberGenerator.java
index 3d2deb1..8feff41 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/AccountNumberGenerator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/AccountNumberGenerator.java
@@ -111,7 +111,9 @@ public class AccountNumberGenerator {
 
             // FINERACT-590
             // Because account_no is limited to 20 chars, we can only use the first 10 chars
of prefix - trim if necessary
-            prefix = prefix.substring(0, Math.min(prefix.length(), 10));
+            if (prefix != null) {
+                prefix = prefix.substring(0, Math.min(prefix.length(), 10));
+            }
 
             accountNumber = StringUtils.overlay(accountNumber, prefix, 0, 0);
         }


Mime
View raw message