cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Updating the basic JSON writer to support explicit nulls (ex, OIDC claims parameter supports them directly, ect)
Date Wed, 24 Feb 2016 12:29:43 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 68808549f -> b5f01c635


Updating the basic JSON writer to support explicit nulls (ex, OIDC claims parameter supports
them directly, ect)


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

Branch: refs/heads/master
Commit: b5f01c6352d901b78c20f220b31f7bc14a9c52f9
Parents: 6880854
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Wed Feb 24 12:29:26 2016 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Wed Feb 24 12:29:26 2016 +0000

----------------------------------------------------------------------
 .../apache/cxf/jaxrs/json/basic/JsonMapObjectReaderWriter.java   | 4 +++-
 .../cxf/jaxrs/json/basic/JsonMapObjectReaderWriterTest.java      | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/b5f01c63/rt/rs/extensions/json-basic/src/main/java/org/apache/cxf/jaxrs/json/basic/JsonMapObjectReaderWriter.java
----------------------------------------------------------------------
diff --git a/rt/rs/extensions/json-basic/src/main/java/org/apache/cxf/jaxrs/json/basic/JsonMapObjectReaderWriter.java
b/rt/rs/extensions/json-basic/src/main/java/org/apache/cxf/jaxrs/json/basic/JsonMapObjectReaderWriter.java
index 4595444..b311ede 100644
--- a/rt/rs/extensions/json-basic/src/main/java/org/apache/cxf/jaxrs/json/basic/JsonMapObjectReaderWriter.java
+++ b/rt/rs/extensions/json-basic/src/main/java/org/apache/cxf/jaxrs/json/basic/JsonMapObjectReaderWriter.java
@@ -96,7 +96,9 @@ public class JsonMapObjectReaderWriter {
     
     @SuppressWarnings("unchecked")
     protected void toJsonInternal(Output out, Object value, boolean hasNext) {
-        if (JsonMapObject.class.isAssignableFrom(value.getClass())) {
+        if (value == null) {
+            out.append(null);
+        } else if (JsonMapObject.class.isAssignableFrom(value.getClass())) {
             out.append(toJson((JsonMapObject)value));
         } else if (value.getClass().isArray()) {
             toJsonInternal(out, (Object[])value);

http://git-wip-us.apache.org/repos/asf/cxf/blob/b5f01c63/rt/rs/extensions/json-basic/src/test/java/org/apache/cxf/jaxrs/json/basic/JsonMapObjectReaderWriterTest.java
----------------------------------------------------------------------
diff --git a/rt/rs/extensions/json-basic/src/test/java/org/apache/cxf/jaxrs/json/basic/JsonMapObjectReaderWriterTest.java
b/rt/rs/extensions/json-basic/src/test/java/org/apache/cxf/jaxrs/json/basic/JsonMapObjectReaderWriterTest.java
index 5a20475..4f03acb 100644
--- a/rt/rs/extensions/json-basic/src/test/java/org/apache/cxf/jaxrs/json/basic/JsonMapObjectReaderWriterTest.java
+++ b/rt/rs/extensions/json-basic/src/test/java/org/apache/cxf/jaxrs/json/basic/JsonMapObjectReaderWriterTest.java
@@ -34,8 +34,9 @@ public class JsonMapObjectReaderWriterTest extends Assert {
         map.put("a", "aValue");
         map.put("b", 123);
         map.put("c", Collections.singletonList("cValue"));
+        map.put("claim", null);
         String json = new JsonMapObjectReaderWriter().toJson(map);
-        assertEquals("{\"a\":\"aValue\",\"b\":123,\"c\":[\"cValue\"]}", 
+        assertEquals("{\"a\":\"aValue\",\"b\":123,\"c\":[\"cValue\"],\"claim\":null}", 
                      json);
     }
     @Test


Mime
View raw message