Answer
If a custom Java transformer behaves correctly in your IDE/tests but produces subtly different output once deployed, check for a Java version mismatch between your development environment and the actual runtime the application uses (for example, developing against Java 17 while the platform runs Java 11) — this can silently change default behaviors like line-ending characters. To diagnose it, Base64-encode both the expected and actual output and compare the encoded patterns for newline characters (\n encodes differently than \r\n); a byte-size difference between otherwise-identical content is a strong hint that this is exactly what's happening, and explicitly normalizing the line endings your transformer produces resolves it.