Skip to content

Bug: com.ctc.wstx.exc.WstxIOException: Invalid white space character or com.ctc.wstx.exc.WstxIOException: Invalid null character in text to output for request contain binary data #6761

Description

@milamberspace

Expected behavior

Since the move of xmlpull to Woodstox, test element or sample result with value contains "binary data" generate Exception Invalid white space/null character

in attachments with JMeter snapshots:

  • jmeter-6.0.0-snapshot-bug.log with the full error messages (recording + saving)
  • test script with recording setup: 01-recording-test-6_0_0.jmx

Attachement with JMeter 5.6.3:

  • jmx script with binary data from mozilla: 01-recording-test-5_6_3.jmx
  • record session : debug-recording-5_6_3-01.xml (jtl)
  • jmeter-5.6.3.log with Warnings about binary data (not relevant for this issue).
WARN o.a.j.p.h.v.RequestViewHTTP: Error decoding query, maybe your request parameters should be encoded: XXXXXXXXXXXXXXXXXXXXXXX
java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - Error at index 0 in: "YR"

Actual behavior

In two ways:

  1. Recording (and writing a .jtl result) with HTTP Test Script Recorder or a listener that writes records request to file.
  2. Try to save the .jmx test plan

With JMeter 6.0.0-SNAPSHOT
=> Probably related to this commit "chore: replace xmlpull with Woodstox" 920fa60
=> From manual: https://jmeter.apache.org/usermanual/component_reference.html#listeners

XML files written by JMeter have version 1.0 declared in header while actual file is serialized with 1.1 rules. (see bug 59973 #4056 and 58679 #3708) This causes strict XML parsers to fail. Consider using non-strict XML parsers to read JTL files.

=> Woodstox is a strict XML parser I think

  • 1/ Recording a sample:
ERROR o.a.j.r.ResultCollector: Error trying to record a sample
java.lang.IllegalArgumentException: Failed marshalling:class:class org.apache.jmeter.protocol.http.sampler.HTTPSampleResult,content:016 - /submit/firefox-desktop/newtab/1/15
0d5ef2-9e19-418e-b22b-a282db11e7fa ()
        at org.apache.jmeter.save.SaveService.saveSampleResult(SaveService.java:355)
        [...]
Caused by: com.thoughtworks.xstream.io.StreamException: 
        at com.thoughtworks.xstream.io.xml.StaxWriter.setValue(StaxWriter.java:160)
        at org.apache.jmeter.save.converters.SampleResultConverter.writeString(SampleResultConverter.java:360)
        ... 4 more
Caused by: com.ctc.wstx.exc.WstxIOException: Invalid white space character (0x1f) in text to output (in xml 1.1, could output as a character entity)
        at com.ctc.wstx.sw.BaseStreamWriter.writeCharacters(BaseStreamWriter.java:469)
        at com.sun.xml.txw2.output.DelegatingXMLStreamWriter.writeCharacters(DelegatingXMLStreamWriter.java:151)
        at com.sun.xml.txw2.output.IndentingXMLStreamWriter.writeCharacters(IndentingXMLStreamWriter.java:181)
        at org.apache.jmeter.save.XMLStreamWriterSkipHeader.writeCharacters(XMLStreamWriterSkipHeader.kt)
        at com.thoughtworks.xstream.io.xml.StaxWriter.setValue(StaxWriter.java:158)
        ... 14 more
Caused by: java.io.IOException: Invalid white space character (0x1f) in text to output (in xml 1.1, could output as a character entity)
        at com.ctc.wstx.api.InvalidCharHandler$FailingHandler.convertInvalidChar(InvalidCharHandler.java:56)
  • 2/ Saving a JMX plan:
ERROR o.a.j.g.a.ActionRouter: Error processing org.apache.jmeter.gui.action.Save@c0b4edf
com.thoughtworks.xstream.io.StreamException: 
        at com.thoughtworks.xstream.io.xml.StaxWriter.setValue(StaxWriter.java:160)

[01-recording-test-5_6_3.jmx.xml](https://github.com/user-attachments/files/31680230/01-recording-test-5_6_3.jmx.xml)
[debug-recording-5_6_3-01.xml](https://github.com/user-attachments/files/31680231/debug-recording-5_6_3-01.xml)

        at com.thoughtworks.xstream.io.WriterWrapper.setValue(WriterWrapper.java:45)
        at org.apache.jmeter.save.converters.StringPropertyConverter.marshal(StringPropertyConverter.java:53)
    [...]
Caused by: com.ctc.wstx.exc.WstxIOException: Invalid null character in text to output
        at com.ctc.wstx.sw.BaseStreamWriter.writeCharacters(BaseStreamWriter.java:469)
    [...]
Caused by: java.io.IOException: Invalid null character in text to output
        at com.ctc.wstx.api.InvalidCharHandler$FailingHandler.convertInvalidChar(InvalidCharHandler.java:52)


Steps to reproduce the problem

To Reproduce:

jmeter-6.0.0-snapshot-bug.log

01-recording-test-6_0_0.jmx.xml

1- Prepare a Firefox (last version) with with Proxy set to JMeter HTTP Test Script Recorder, and stop Firefox
2- Open the example file .jmx, start the HTTP Test Script Recorder.
2- Start firefox (last version), and see the jmeter.log about the incoming.telemetry.mozilla.org requests

For example :

Host: incoming.telemetry.mozilla.org
Path: /submit/firefox-desktop/events/1/97647d0d-fbe5-49ba-ab9c-fb321bb204db
Body data: <binary data>

JMeter Version

6.0.0

Java Version

java version "17.0.14" 2025-01-21 LTS Java(TM) SE Runtime Environment (build 17.0.14+8-LTS-191) Java HotSpot(TM) 64-Bit Server VM (build 17.0.14+8-LTS-191, mixed mode, sharing)

OS Version

Debian GNU/Linux 13 (trixie)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions