Skip to content

Stacktraces larger than maxStringLength are not truncated #57

Closed
@waldeinburg

Description

@waldeinburg

Stacktraces larger than resolverContext.writerCapacity causes an ArrayIndexOutOfBoundsException in the call to System::arraycopy from BufferedWriter::write because it attempts to write past the end of the buffer. The message is lost.
For stacktraces, maxStringLength has different semantics than for normal values: Instead of causing truncation, the buffer capacity is set from maxStringLength instead of maxByteCount if set.

The minimal solution would be that BufferedWriter detects if it is going to write past the buffer size and truncates.
The ideal solution would be to truncate as described based on maxStringLength if set and also use a growable buffer to avoid message loss. You could use the same mechanism as ByteArrayOutputStream (c.f. the private method grow) instead of char[].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions