Commit Graph

1186 Commits

Author SHA1 Message Date
Valentyn Kolesnikov 2c674be1b6 Update pipeline.yml 2023-08-28 19:06:27 +03:00
Valentyn Kolesnikov be33deb7d5 Update README.md 2023-08-28 19:04:30 +03:00
Valentyn Kolesnikov 48089a4da7 Update pipeline.yml 2023-08-28 19:04:30 +03:00
Valentyn Kolesnikov a4e152f4f0 Update pipeline.yml 2023-08-28 19:03:43 +03:00
dburbrid 3dd8f2ecd5 Correction of bug when compiling/testing on Windows: Issue537 file must be read as UTF-8 (Issue 745) 2023-08-28 19:03:40 +03:00
Valentyn Kolesnikov bae0b0dac9 Updated mockito 2023-08-28 19:01:47 +03:00
Valentyn Kolesnikov e563dbcaaa Setup java 8 as minimum version 2023-08-28 19:00:00 +03:00
Ethan McCue 50dfcc59b3 Remove automatic module name 2023-08-16 11:25:15 -04:00
Ethan McCue b2943eb395 Add module-info to maven build 2023-08-16 11:24:57 -04:00
Sean Leary 60662e2f83 Merge pull request #759 from eamonnmcmanus/eofnull
JSON parsing should detect embedded `\0` values
2023-08-05 08:33:26 -05:00
Éamonn McManus 2a4bc3420a Apply simplification suggested by @johnjaylward. 2023-08-01 14:38:45 -07:00
Éamonn McManus b6ff0db984 Fix indentation in test. 2023-08-01 13:49:59 -07:00
Éamonn McManus c8a9e15a57 Don't skip past \0 when parsing JSON objects.
A better solution might be to use -1 instead 0 to represent EOF everywhere,
which of course means changing `char` variables to `int`. The solution here is
enough to solve the immediate problem, though.

Fixes #758.
2023-08-01 13:11:25 -07:00
Sean Leary 402db6ad84 Merge pull request #753 from davejbur/add-object-methods-and-test
Updated new object methods
2023-07-14 20:03:13 -05:00
dburbrid 4951ec48c8 Renamed object methods from ...Obj to ...Object.
Added object method for optDoubleObject (returns Double vice double).
Added similar methods in JSONArray.
Added test methods.
2023-06-29 09:39:34 +01:00
Sean Leary 8ce0019a5d Merge pull request #752 from davejbur/issue-745-compile-error
Correction of bug when compiling/testing on Windows
2023-06-28 20:45:05 -05:00
dburbrid 3d524349a1 Correction of bug when compiling/testing on Windows: Issue537 file must be read as UTF-8 (Issue 745) 2023-06-26 09:33:03 +01:00
Sean Leary a963115ac2 Update pom.xml for maven deploy
Deploy failed on the mac pro with: gpg: signing failed: Inappropriate ioctl for device

Somehow I had a different gpg version installed. This change fixed it.
20230618
2023-06-18 12:58:32 -05:00
Sean Leary f959baa3cb Merge pull request #749 from stleary/pre-release-20230618
Prep for release 20230618
2023-06-18 12:24:27 -05:00
Sean Leary c048b36516 Update pom.xml for 20230618 2023-06-18 12:18:36 -05:00
Sean Leary f6e5bfa2db Update RELEASES.md for 20230618 2023-06-18 12:17:56 -05:00
Sean Leary 084b24cbe7 Update README.md for 20230618 2023-06-18 12:16:14 -05:00
Sean Leary 22ccf1b8e5 Merge pull request #740 from michael-o/proper-encoding
JSONTokener(InputStream) violates rfc8259#section-8.1 (#739)
2023-05-28 14:11:41 -05:00
Michael Osipov 133c0cc75f JSONTokener(InputStream) violates rfc8259#section-8.1 (#739)
Always use UTF-8 when an InputStream is passed.

This fixes #739.
2023-05-24 11:45:25 +02:00
Sean Leary 0578285036 Merge pull request #734 from superMaaax/fix_flaky
Fixed Flaky Tests Caused by JSON permutations
2023-03-27 16:25:57 -05:00
superMaaax 48fb5261fe Fixed Flaky Tests Caused by JSON permutations
###Description
Flaky Tests found using NonDex by running the commands -
mvn -pl . edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dtest=org.json.junit.XMLTest#testIndentComplicatedJsonObject

mvn -pl . edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dtest=org.json.junit.XMLTest#testIndentSimpleJsonArray

mvn -pl . edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dtest=org.json.junit.XMLTest#testIndentSimpleJsonObject

The logged failure was-

[ERROR] Failures:
[ERROR] XMLTest.testIndentSimpleJsonObject:1193 expected:<...>
<employee>
<[married>true</married>
<name>sonoo</name>
<salary>56000</salary]>
</employee>
</Te...> but was:<...>
<employee>
<[name>sonoo</name>
<salary>56000</salary>
<married>true</married]>
</employee>
</Te...>

The issue is the same for all three tests, so here I only show the failure message for the third test (to reduce the length of the error message).

### Investigation

The tests fail with a comparison error while comparing an expected JSON String and the result from the value returned from XML.toString(). The toString function of XML makes no guarantees as to the iteration order of the attributes in the object. This makes the test outcome non-deterministic, and the test fails whenever the function returns a mismatch in order of the elements in the JSON String. To fix this, the expected and actual keys should be checked in a more deterministic way so that the assertions do not fail.

### Fix

Expected and Actual values can be converted into JSONObject and the similar function can be used to compare these objects. As this function compares the values inside the JSONObjects without needing order, the test becomes deterministic and ensures that the flakiness from the test is removed.

The PR does not introduce a breaking change.
2023-03-21 20:58:32 -05:00
Sean Leary 8353b9c3f0 Merge pull request #731 from JoaoGFarias/patch-1
Removing commented out code in JSONObject optDouble()
2023-03-11 19:28:01 -06:00
Sean Leary fe22b242b5 Merge pull request #733 from haribabu-dev/jsontokener_closable
JSONTokener implemented java.io.Closeable
2023-03-11 19:26:55 -06:00
HariBabu t 7eca507d13 Removed overriding closable interface. 2023-03-07 13:58:30 +08:00
HariBabu t e1eabc9c27 JSONTokener implemented java.io.Closeable 2023-03-04 23:08:32 +08:00
João Farias 0d436d92e2 Removing commented out code 2023-03-02 16:39:11 +01:00
Sean Leary 45bcba518f Merge pull request #729 from TamasPergerDWP/f-parserconfig
Refactor ParserConfiguration class hierarchy
2023-02-28 12:49:42 -06:00
Sean Leary 47fb49b6a8 Update for release 20230227 20230227 2023-02-27 07:21:11 -06:00
Sean Leary 0df034c9fd Update for release 20230227 2023-02-27 07:20:10 -06:00
Sean Leary f0a05e6911 Update README.md 2023-02-27 07:17:51 -06:00
Tamas Perger 24093491a8 refactor: introduce ParserConfiguration class hierarchy 2023-02-21 19:13:07 +00:00
Sean Leary 1275f6809d Merge pull request #723 from TamasPergerDWP/master
JSONML should be protected from stack overflow exceptions caused by recursion, resolving #722
2023-02-17 13:47:36 -06:00
Tamas Perger 9234eab00a refactor: make JSONMLParserConfiguration all-args constructor private, enforcing the builder pattern. 2023-02-13 01:09:29 +00:00
Tamas Perger 72f4c3e646 refactor: rename XMLtoJSONMLParserConfiguration to JSONMLParserConfiguration 2023-02-12 01:32:34 +00:00
Tamas Perger df2d6f8363 fix: introduce optional XMLtoJSONMLParserConfiguration parameter for JSONML.toJSONArray(...) functions, to facilitate max nesting depth override. 2023-02-11 01:52:13 +00:00
Tamas Perger a6e412bded fix: limit the nesting depth in JSONML
Limit the XML nesting depth for CVE-2022-45688 when using the JsonML transform.
2023-02-10 01:46:44 +00:00
Tamas Perger 2391d248cc fix: amend XMLParserConfiguration.clone() to include the new maxNestingDepth param.
Amend Javadoc for XML and XMLParserConfiguration classes.
2023-02-10 01:45:34 +00:00
Sean Leary 401495ae86 Merge pull request #720 from cleydyr/issue-708
Limit the XML nesting depth for CVE-2022-45688
2023-02-05 19:30:04 -06:00
Cleydyr de Albuquerque 448e204186 docs: remove wrong description of parse method 2023-02-02 20:16:16 +01:00
Cleydyr de Albuquerque eb56704e68 fix: set default maximum nesting depth as 512 2023-02-02 18:15:03 +01:00
Cleydyr de Albuquerque 651511f500 tests: add new test to verify that an XML having the permitted nesting depth can be converted 2023-02-01 20:22:47 +01:00
Cleydyr de Albuquerque a14cb12c85 refactor: keep consistence with other tests and tidy up constant 2023-02-01 20:22:32 +01:00
Cleydyr de Albuquerque f566a1d9ee fix: limit the nesting depth 2023-02-01 16:26:58 +01:00
Sean Leary 5920eca2d7 Merge pull request #711 from 6d64/revert-pull-707-interviewbit-spam
Revert pull 707 - interviewbit spam
2022-11-30 20:20:39 -06:00
6d64 3b097d051a Revert pull 707 - interviewbit spam
Reverted commit that was added by a bot adding interviewbit spam to
repos on github
2022-12-01 03:21:26 +11:00