Commit Graph

287 Commits

Author SHA1 Message Date
Yuki Matsuhashi 94e340002b Ignore static fields in JSONObject.fromJson() 2026-03-13 01:23:59 +09:00
Sean Leary a37aa69480 Merge pull request #1039 from pratiktiwari13/bugfix/empty-force-list
Fixes the issue of losing the array if an empty forceList element or a tag is in the middle or the end
2026-02-03 11:15:58 -06:00
Pratik Tiwari 510a03ac36 Fixes #1040, Aligns non-forceList behaviour with forceList 2026-01-31 10:34:24 +05:30
Sean Leary 538afc3d78 Merge pull request #1038 from OwenSanzas/fix-xmltokener-unescapeentity
Fix input validation in XMLTokener.unescapeEntity()
2026-01-30 08:13:34 -06:00
Pratik Tiwari 7a8da886e7 Remove unnecessary conditions 2026-01-30 19:29:46 +05:30
OwenSanzas 6c1bfbc7a5 Refactor XMLTokener.unescapeEntity() to reduce complexity
Extracted hex and decimal parsing logic into separate methods to
address SonarQube complexity warning:
- parseHexEntity(): handles ઼ format
- parseDecimalEntity(): handles { format

This reduces cyclomatic complexity while maintaining identical
functionality and all validation checks.
2026-01-28 09:52:25 +00:00
OwenSanzas 534ce3c4d1 Fix input validation in XMLTokener.unescapeEntity()
Fix StringIndexOutOfBoundsException and NumberFormatException in
XMLTokener.unescapeEntity() when parsing malformed XML numeric
character references.

Issues:
- &#; (empty numeric reference) caused StringIndexOutOfBoundsException
- &#txx; (invalid decimal) caused NumberFormatException
- &#xGGG; (invalid hex) caused NumberFormatException

Changes:
- Add length validation before accessing character positions
- Add isValidHex() and isValidDecimal() helper methods
- Throw proper JSONException with descriptive messages

Fixes #1035, Fixes #1036
2026-01-27 11:40:18 +00:00
OwenSanzas 9d14246bee Fix ClassCastException in JSONML.toJSONArray and toJSONObject
Add type checking before casting parse() results to JSONArray/JSONObject.
When parse() returns an unexpected type (e.g., String for malformed input),
the code now throws a descriptive JSONException instead of ClassCastException.

This prevents unchecked exceptions from propagating to callers who only
expect JSONException from these methods.

Fixes #1034
2026-01-27 11:36:46 +00:00
Pratik Tiwari 995fb840f7 Fixes the issue of losing the array if an empty forceList element or a tag is in the middle or the end 2026-01-02 21:20:53 +05:30
Simulant 8cbb4d5bb3 Fix sonarqube reliability issues 2025-12-20 22:57:24 +01:00
Sean Leary a6ca84074a Merge pull request #1020 from Abhineshhh/fix/support-java-records
Fix: Support Java record accessors in JSONObject
2025-11-11 20:19:42 -06:00
Sean Leary 8c14e96c44 Merge pull request #1017 from Md-Yasir/enhancement/refactors
Code Refactors
2025-11-09 19:02:49 -06:00
AbhineshJha 8f3b0f1c13 Add runtime record detection for backward compatibility 2025-11-02 22:32:44 +05:30
AbhineshJha f2acf8af69 Optimize method name exclusion using Set lookup instead of multiple equals checks 2025-11-01 19:33:29 +05:30
AbhineshJha 2550c692cf Refactor: Extract isRecordStyleAccessor helper method 2025-11-01 19:33:29 +05:30
AbhineshJha 20f5200000 Fix: Support Java record accessors in JSONObject 2025-11-01 19:33:29 +05:30
sk02241994 42800c208a Updating to work with java 1.6 2025-10-28 13:06:11 +11:00
md-yasir 0cdc5e5170 Reverted Constructor access to public 2025-10-25 20:51:50 +05:30
md-yasir ac65ee0490 Revert "Refactored stop conditions to be invariant by using while loop."
This issue can be ignored
2025-10-25 20:37:54 +05:30
md-yasir 39e8ead7cd Added java doc for deprecated decoration 2025-10-24 09:37:46 +05:30
md-yasir 6dd878d3c9 Deprecated public constructors instead of making it private. 2025-10-24 09:10:53 +05:30
md-yasir 2c6082a0a2 Refactored stop conditions to be invariant by using while loop. 2025-10-23 22:50:12 +05:30
md-yasir 5dc1031d17 Made JSONMl constructor to private and refactored ternary operations to independent statement in L243 2025-10-23 22:38:01 +05:30
md-yasir 1de42aa4fd Made CookieList constructor to private. 2025-10-23 22:37:00 +05:30
md-yasir c13b57ca26 Made Cookie constructor to private. 2025-10-23 22:36:53 +05:30
sk02241994 f92f281620 Updating to work with java 1.6 2025-10-23 17:33:37 +11:00
sk02241994 8ccf5d7525 Removing the interface classes and simplifying the implementation to use if else instead 2025-10-23 17:32:07 +11:00
sk02241994 a7c193090a Updating docs 2025-10-16 14:23:30 +11:00
sk02241994 c4c2beb874 Limiting implemetation by removing the new classes. 2025-10-16 14:19:19 +11:00
sk02241994 9adea9e12d Updating to work with java 1.6 2025-10-13 12:39:15 +11:00
sk02241994 7465da858c - Updating for java 1.6
- Resolving Sonar cube issues.
2025-10-13 12:39:15 +11:00
sk02241994 0521928463 - Added implementation for Enum and Map
- Moving the CustomClass to data folder.
- Removing JSONBuilder.java
- Moving the implementation of JSONBuilder to JSONObject.
2025-10-13 12:39:14 +11:00
sk02241994 fbb6b3158e Updating to work with java 1.6 2025-10-13 12:39:14 +11:00
sk02241994 ebc13d6685 Updating to work with java 1.6 2025-10-13 12:39:13 +11:00
sk02241994 7d28955216 Updating to work with java 1.6 2025-10-13 12:39:13 +11:00
sk02241994 83a0e34be5 1003: Implement JSONObject.fromJson() with unit tests 2025-10-13 12:39:12 +11:00
md-yasir 1a2c50b40c changed string checking logic >> string.length() > 0 to !string.isEmpty() 2025-10-11 19:48:33 +05:30
marilynel 05867c4b0b Merge branch 'master' of https://github.com/marilynel/JSON-java 2025-09-21 16:37:20 -08:00
marilynel c6efa080c0 more cleanup sonarqube JSONArray 2025-09-21 16:36:52 -08:00
Sean Leary aff59d06fa Merge pull request #1011 from marilynel/master
more sonarcube fixes
2025-09-18 20:13:43 -05:00
Sean Leary b258ea3d46 Merge pull request #1008 from eleumik/eleumik-patch-1007-array
Update JSONArray.java for #1007
2025-09-18 20:12:55 -05:00
Sean Leary a5e234aa19 Merge pull request #1009 from eleumik/eleumik-patch-1
Update JSONTokener.java for #1007
2025-09-18 20:12:03 -05:00
marilynel f2af220cb4 more sonarcube fixes 2025-09-14 10:59:39 -08:00
Michele Vivoda 686c084897 Update JSONTokener.java for #1007
fixed parse of `0.` in strict mode
2025-09-10 02:30:19 +02:00
Michele Vivoda 9de3005566 Update JSONArray.java for #1007
fix array content starting with ',' in strict mode
2025-09-10 02:21:16 +02:00
marilynel 69c87dc4db more sonarcube optimization in jsonobject.java 2025-09-07 12:52:59 -08:00
marilynel 53cfa742a7 more sonarcube optimization in jsonobject.java 2025-09-07 12:41:37 -08:00
marilynel 4e0f62b1a6 more sonarcube optimization in jsonobject.java 2025-09-07 12:28:52 -08:00
marilynel 6ed2880f55 more sonarcube cleanup 2025-08-24 12:55:49 -08:00
marilynel 9bb26bdb34 sonar cube stuff 2025-08-03 11:52:20 -08:00