fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From my...@apache.org
Subject [fineract-cn-lang] 07/49: Handled null case.
Date Mon, 22 Jan 2018 15:01:02 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-lang.git

commit 614183f3293ebd81a7d612f5adc9211455281206
Author: myrle-krantz <mkrantz@mifos.org>
AuthorDate: Tue Apr 4 20:10:51 2017 +0200

    Handled null case.
---
 .../java/io/mifos/core/lang/validation/CheckApplicationName.java   | 3 +++
 .../io/mifos/core/lang/validation/ValidApplicationNameTest.java    | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/src/main/java/io/mifos/core/lang/validation/CheckApplicationName.java b/src/main/java/io/mifos/core/lang/validation/CheckApplicationName.java
index ad07d66..74f9d76 100644
--- a/src/main/java/io/mifos/core/lang/validation/CheckApplicationName.java
+++ b/src/main/java/io/mifos/core/lang/validation/CheckApplicationName.java
@@ -29,6 +29,9 @@ public class CheckApplicationName implements ConstraintValidator<ValidApplicatio
    }
 
    public boolean isValid(final String obj, final ConstraintValidatorContext context) {
+      if (obj == null)
+         return false;
+
       try {
          ApplicationName.fromSpringApplicationName(obj);
          return true;
diff --git a/src/test/java/io/mifos/core/lang/validation/ValidApplicationNameTest.java b/src/test/java/io/mifos/core/lang/validation/ValidApplicationNameTest.java
index d2848e3..31613d2 100644
--- a/src/test/java/io/mifos/core/lang/validation/ValidApplicationNameTest.java
+++ b/src/test/java/io/mifos/core/lang/validation/ValidApplicationNameTest.java
@@ -43,6 +43,13 @@ public class ValidApplicationNameTest {
     Assert.assertFalse(isValid(annotatedInstance));
   }
 
+  @Test
+  public void nullAppplicationName()
+  {
+    final AnnotatedClass annotatedInstance = new AnnotatedClass(null);
+    Assert.assertFalse(isValid(annotatedInstance));
+  }
+
   private boolean isValid(final AnnotatedClass annotatedInstance)
   {
 

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

Mime
View raw message