You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ro...@apache.org on 2024/11/12 00:56:09 UTC

(axis-axis2-java-core) branch master updated: AXIS2-5964 AbstractJSONMessageFormatter NOT using CharSetEncoding when reding Json string Bytes

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

robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git


The following commit(s) were added to refs/heads/master by this push:
     new ba8312400a AXIS2-5964 AbstractJSONMessageFormatter NOT using CharSetEncoding when reding Json string Bytes
ba8312400a is described below

commit ba8312400a255884ba4cc65ed55871950a0a7830
Author: Robert Lazarski <ro...@gmail.com>
AuthorDate: Mon Nov 11 14:55:19 2024 -1000

    AXIS2-5964 AbstractJSONMessageFormatter NOT using CharSetEncoding when reding Json string Bytes
---
 .../src/org/apache/axis2/json/AbstractJSONMessageFormatter.java    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/json/src/org/apache/axis2/json/AbstractJSONMessageFormatter.java b/modules/json/src/org/apache/axis2/json/AbstractJSONMessageFormatter.java
index 768f8dcfef..afce0f6938 100644
--- a/modules/json/src/org/apache/axis2/json/AbstractJSONMessageFormatter.java
+++ b/modules/json/src/org/apache/axis2/json/AbstractJSONMessageFormatter.java
@@ -135,7 +135,12 @@ public abstract class AbstractJSONMessageFormatter implements MessageFormatter {
             }
             String jsonToWrite = getStringToWrite(element);
             if (jsonToWrite != null) {
-                out.write(jsonToWrite.getBytes());
+                String encoding = format.getCharSetEncoding();
+                if (encoding != null) {
+                    out.write(jsonToWrite.getBytes(encoding));
+                } else {
+                    out.write(jsonToWrite.getBytes());
+		}
             } else {
                 XMLStreamWriter jsonWriter = getJSONWriter(out, format, msgCtxt);
                 // Jettison v1.2+ relies on writeStartDocument being called (AXIS2-5044)