You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by pv...@apache.org on 2021/07/21 09:46:56 UTC

[nifi] branch main updated: NIFI-8933 Configure Jersey's ObjectMapper to ingnore unknown fields

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

pvillard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 74c0a91  NIFI-8933 Configure Jersey's ObjectMapper to ingnore unknown fields
74c0a91 is described below

commit 74c0a91b6c9c25f348518c8700f998b422a341f9
Author: Bryan Bende <bb...@apache.org>
AuthorDate: Tue Jul 20 14:44:31 2021 -0400

    NIFI-8933 Configure Jersey's ObjectMapper to ingnore unknown fields
    
    Signed-off-by: Pierre Villard <pi...@gmail.com>
    
    This closes #5236.
---
 .../src/main/java/org/apache/nifi/web/util/ObjectMapperResolver.java  | 4 +++-
 .../java/org/apache/nifi/registry/flow/VersionedProcessGroup.java     | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/nifi-commons/nifi-web-utils/src/main/java/org/apache/nifi/web/util/ObjectMapperResolver.java b/nifi-commons/nifi-web-utils/src/main/java/org/apache/nifi/web/util/ObjectMapperResolver.java
index d1b4036..9333913 100644
--- a/nifi-commons/nifi-web-utils/src/main/java/org/apache/nifi/web/util/ObjectMapperResolver.java
+++ b/nifi-commons/nifi-web-utils/src/main/java/org/apache/nifi/web/util/ObjectMapperResolver.java
@@ -18,6 +18,7 @@ package org.apache.nifi.web.util;
 
 import com.fasterxml.jackson.annotation.JsonInclude.Include;
 import com.fasterxml.jackson.annotation.JsonInclude.Value;
+import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
 
@@ -29,10 +30,11 @@ public class ObjectMapperResolver implements ContextResolver<ObjectMapper> {
 
     private final ObjectMapper mapper;
 
-    public ObjectMapperResolver() throws Exception {
+    public ObjectMapperResolver() {
         mapper = new ObjectMapper();
         mapper.setDefaultPropertyInclusion(Value.construct(Include.NON_NULL, Include.ALWAYS));
         mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector(mapper.getTypeFactory()));
+        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
     }
 
     @Override
diff --git a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedProcessGroup.java b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedProcessGroup.java
index c3df8ca..06ce83f 100644
--- a/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedProcessGroup.java
+++ b/nifi-registry/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedProcessGroup.java
@@ -200,7 +200,7 @@ public class VersionedProcessGroup extends VersionedComponent {
 
     @ApiModelProperty(value = "Default value used in this Process Group for the maximum data size of objects that can be queued before back pressure is applied.")
     public String getDefaultBackPressureDataSizeThreshold() {
-        return defaultBackPressureDataSizeThreshold == null ? "" : defaultBackPressureDataSizeThreshold;
+        return defaultBackPressureDataSizeThreshold;
     }
 
     public void setDefaultBackPressureDataSizeThreshold(final String defaultBackPressureDataSizeThreshold) {