You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@johnzon.apache.org by rm...@apache.org on 2020/02/09 19:23:07 UTC

[johnzon] branch master updated: avoid uninitialized MapperBuilder for pojo<->JsonValue mapping

This is an automated email from the ASF dual-hosted git repository.

rmannibucau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/johnzon.git


The following commit(s) were added to refs/heads/master by this push:
     new 5325f9f  avoid uninitialized MapperBuilder for pojo<->JsonValue mapping
5325f9f is described below

commit 5325f9f8d9f02ac4b9b121b28fdda928fabb3e01
Author: Romain Manni-Bucau <rm...@apache.org>
AuthorDate: Sun Feb 9 20:22:51 2020 +0100

    avoid uninitialized MapperBuilder for pojo<->JsonValue mapping
---
 .../java/org/apache/johnzon/mapper/MapperBuilder.java     | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MapperBuilder.java b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MapperBuilder.java
index 3482e5a..93decfb 100644
--- a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MapperBuilder.java
+++ b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MapperBuilder.java
@@ -193,12 +193,15 @@ public class MapperBuilder {
             if (encoding != null) {
                 config.put("org.apache.johnzon.encoding", encoding.name());
             }
-            if (readerFactory == null) {
-                readerFactory = provider.createReaderFactory(config);
-            }
-            if (builderFactory == null) {
-                builderFactory = provider.createBuilderFactory(emptyMap());
-            }
+        }
+        if (this.provider == null) {
+            this.provider = JsonProvider.provider();
+        }
+        if (readerFactory == null) {
+            readerFactory = provider.createReaderFactory(emptyMap());
+        }
+        if (builderFactory == null) {
+            builderFactory = provider.createBuilderFactory(emptyMap());
         }
 
         if (accessMode == null) {