Thanks to visit codestin.com
Credit goes to github.com

Skip to content

JSONTokener reference is retained in JSONObject/JSONArray in 20241224 #927

@osobolev

Description

@osobolev

The JSONTokener object can have references to large objects like i/o buffers. And it's not really used after JSONObject/JSONArray constructor finishes. At least references to JSONTokener (and JSONParserConfiguration) can be nulled at the end of constructor.

Or you can introduce constructor like this:
private JSONObject(JSONTokener x, JSONParserConfiguration jsonParserConfiguration, boolean requireInputEnd)
that checks for the absense of trailing chars (by the way this check is duplicated in JSONObject(String source) constructor since it delegates to another constructor which checks for the same thing). This new constructor could use JSONTokener/JSONParserConfiguration without introducing fields.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions