Adding Parse Limit#2
Conversation
| /etc/config/copyright-exclude | ||
| /etc/config/copyright.txt | ||
| /bundles/dist/src/main/resources/README.txt | ||
| /impl/src/test/java/org/eclipse/parsson/tests/JsonDocumentParseLimitTest.java |
There was a problem hiding this comment.
Given that file has copyright, can we remove this line?
There was a problem hiding this comment.
Currently the copyright checker is only set to accept the Oracle license. The tricky part with the Eclipse AI license is the last line is variable depending on which AI model was used. As far as I could tell the copyright checker plugin has no way to handle variable text other than the year.
Unless the copyright checker is updated to support this, it will probably be best to remove the plugin for the next release (aligning with EE12). That seemed beyond the scope of this PR though, so I just had it ignore this file for now.
| // which is higher than the literal JSON source length due to lookahead | ||
| // operations needed to determine parsing completion (e.g., detecting EOF after the | ||
| // last token). See JsonConfig.MAX_PARSING_LIMIT for details. | ||
| private long documentParseCount = 0; |
There was a problem hiding this comment.
This value cannot be higher than readEnd, and this one is an int. You can set documentParseCount to int too, and then you can remove the static methods you added in JsonContext, and use the existing integer ones.
There was a problem hiding this comment.
I had chosen long to give users the option of reading extremely large files if the had the memory available, but this is good point, I'll get it changed to int.
Assisted-by: IBM Bob 1.0.2
Adds a config property with default value to limit the total number of parsing operations done on a Json document. If this limit is exceeded an Exception is throw.