Skip to content

Commit 384f166

Browse files
Fix parseResponse() to use explicit UTF-8 charset
Prevents platform-dependent test failures on non-UTF-8 systems (e.g., Windows with windows-1252 default). Consistent with the existing toString("UTF-8") call at line 111. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 39d7cc2 commit 384f166

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

modules/json/test/org/apache/axis2/json/streaming/FieldFilteringMessageFormatterTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,12 @@ private void setReturnObject(Object obj) {
346346
}
347347

348348
private JsonElement parseResponse() {
349-
String json = outputStream.toString();
349+
String json;
350+
try {
351+
json = outputStream.toString("UTF-8");
352+
} catch (java.io.UnsupportedEncodingException e) {
353+
throw new AssertionError("UTF-8 encoding not supported", e);
354+
}
350355
JsonElement root = JsonParser.parseString(json);
351356
return root.getAsJsonObject().get("response");
352357
}

0 commit comments

Comments
 (0)