From f61d547e3ebbdef3394590cc6fff89c9c9eb6813 Mon Sep 17 00:00:00 2001 From: exceptionfactory Date: Wed, 29 Mar 2023 17:06:31 -0500 Subject: [PATCH] NIFI-11363 Fixed precision number handling in Flow Encryption Commands Signed-off-by: Bence Simon This closes #11363 --- .../java/org/apache/nifi/flow/encryptor/JsonFlowEncryptor.java | 2 +- .../apache/nifi/flow/encryptor/StandardFlowEncryptorTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nifi-commons/nifi-flow-encryptor/src/main/java/org/apache/nifi/flow/encryptor/JsonFlowEncryptor.java b/nifi-commons/nifi-flow-encryptor/src/main/java/org/apache/nifi/flow/encryptor/JsonFlowEncryptor.java index 39062b81f4..dd3dfd7a5e 100644 --- a/nifi-commons/nifi-flow-encryptor/src/main/java/org/apache/nifi/flow/encryptor/JsonFlowEncryptor.java +++ b/nifi-commons/nifi-flow-encryptor/src/main/java/org/apache/nifi/flow/encryptor/JsonFlowEncryptor.java @@ -82,7 +82,7 @@ public class JsonFlowEncryptor extends AbstractFlowEncryptor { generator.writeNumber(parser.getIntValue()); break; case VALUE_NUMBER_FLOAT: - generator.writeNumber(parser.getFloatValue()); + generator.writeRawValue(parser.getValueAsString()); break; case VALUE_TRUE: generator.writeBoolean(true); diff --git a/nifi-commons/nifi-flow-encryptor/src/test/java/org/apache/nifi/flow/encryptor/StandardFlowEncryptorTest.java b/nifi-commons/nifi-flow-encryptor/src/test/java/org/apache/nifi/flow/encryptor/StandardFlowEncryptorTest.java index 45cea4ece6..e0f1f45a04 100644 --- a/nifi-commons/nifi-flow-encryptor/src/test/java/org/apache/nifi/flow/encryptor/StandardFlowEncryptorTest.java +++ b/nifi-commons/nifi-flow-encryptor/src/test/java/org/apache/nifi/flow/encryptor/StandardFlowEncryptorTest.java @@ -143,7 +143,7 @@ public class StandardFlowEncryptorTest { private String getSampleFlowJson(final String password) { Objects.requireNonNull(password); - return String.format("{\"properties\":{\"username\":\"sample_username\",\"password\":\"%s\"}}", password); + return String.format("{\"properties\":{\"username\":\"sample_username\",\"password\":\"%s\",\"position\":1.123456789123456789}}", password); } private String getSampleFlowXml(final String password) {