You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2017/09/28 20:06:32 UTC

[07/14] incubator-tamaya-extensions git commit: TAMAYA-260: Fixed classcast exception.

TAMAYA-260: Fixed classcast exception.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/089043d9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/089043d9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/089043d9

Branch: refs/heads/master
Commit: 089043d9ef940635e27c94d1123a0cff533cc1a7
Parents: 72c37c5
Author: anatole <an...@apache.org>
Authored: Mon Aug 14 01:40:33 2017 +0200
Committer: anatole <an...@apache.org>
Committed: Mon Aug 14 01:40:33 2017 +0200

----------------------------------------------------------------------
 .../tamaya/spisupport/SystemPropertySource.java | 22 +++++++++++---------
 1 file changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/089043d9/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/SystemPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/SystemPropertySource.java b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/SystemPropertySource.java
index de83a82..bc5f99e 100644
--- a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/SystemPropertySource.java
+++ b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/SystemPropertySource.java
@@ -133,16 +133,18 @@ public class SystemPropertySource extends BasePropertySource {
         final String prefix = this.prefix;
         Map<String, PropertyValue> entries = new HashMap<>();
         for (Map.Entry<Object,Object> entry : sysProps.entrySet()) {
-            if(prefix==null) {
-                entries.put((String) entry.getKey(),
-                        PropertyValue.of((String) entry.getKey(),
-                                (String) entry.getValue(),
-                                getName()));
-            }else {
-                entries.put(prefix + entry.getKey(),
-                        PropertyValue.of(prefix + entry.getKey(),
-                                (String) entry.getValue(),
-                                getName()));
+            if(entry.getKey() instanceof String && entry.getValue() instanceof String) {
+                if (prefix == null) {
+                    entries.put((String) entry.getKey(),
+                            PropertyValue.of((String) entry.getKey(),
+                                    (String) entry.getValue(),
+                                    getName()));
+                } else {
+                    entries.put(prefix + entry.getKey(),
+                            PropertyValue.of(prefix + entry.getKey(),
+                                    (String) entry.getValue(),
+                                    getName()));
+                }
             }
         }
         return entries;