deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject deltaspike git commit: DELTASPIKE-1287 fix NullPointer in asList() handling
Date Tue, 29 Aug 2017 14:32:28 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 618dd99b6 -> 651c9a569


DELTASPIKE-1287 fix NullPointer in asList() handling


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

Branch: refs/heads/master
Commit: 651c9a56937f8da2f92859bf5720362459bc3202
Parents: 618dd99
Author: Mark Struberg <struberg@apache.org>
Authored: Tue Aug 29 15:59:47 2017 +0200
Committer: Mark Struberg <struberg@apache.org>
Committed: Tue Aug 29 15:59:47 2017 +0200

----------------------------------------------------------------------
 .../org/apache/deltaspike/core/api/config/ConfigResolver.java | 2 +-
 .../apache/deltaspike/test/api/config/ConfigResolverTest.java | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/651c9a56/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
index 3961678..57d1d08 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
@@ -1017,7 +1017,7 @@ public final class ConfigResolver
         {
             List list = new ArrayList();
             StringBuilder currentValue = new StringBuilder();
-            int length = valueStr.length();
+            int length = valueStr != null ? valueStr.length() : 0;
             for (int i = 0; i < length; i++)
             {
                 char c = valueStr.charAt(i);

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/651c9a56/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java
b/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java
index 9911ae0..d1d6a99 100644
--- a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java
+++ b/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java
@@ -253,6 +253,13 @@ public class ConfigResolverTest
         Assert.assertTrue(intValues.contains(17));
     }
 
+    @Test
+    public void testConfiguredListValues_NotExisting() {
+        List<Integer> intValues = ConfigResolver.resolve("test.list.not_existing").as(Integer.class).asList().getValue();
+        Assert.assertNotNull(intValues);
+        Assert.assertEquals(0, intValues.size());
+    }
+
     private void setTestConfigSourceValue(String key, String value)
     {
         ConfigSource[] configSources = ConfigResolver.getConfigSources();


Mime
View raw message