|
Fix code review findings: shared mappers, toCSV guards, TOML/CSV correctness, and more
- Add shared static final MAPPER/CSV_MAPPER/YAML_MAPPER/TOML_MAPPER/XML_MAPPER
instances to eliminate per-call ObjectMapper construction (thread-safe)
- Add private constructor to JsonUtils (pure static utility class)
- Fix jsonToParameterizedObject to use shared MAPPER for both TypeFactory and
readValue; add ObjectMapper-overload variant
- Guard toCSV against non-array/empty input with IllegalArgumentException
- Remove withoutQuoteChar() from toCSV to restore RFC 4180 quoting
- Remove toTOML's replaceAll("'", "\"") post-processing which corrupted data
- Fix prettyPrint to use explicit "\n" instead of DefaultIndenter.SYS_LF
- Wrap areEqual body in try/catch returning false on invalid JSON
- Remove unused xml-utils dependency from pom.xml
- Add new tests: toCSV non-array/empty (IAE), areEqual with invalid JSON (false),
objectToJson(null), jsonToSet deduplication, jsonToParameterizedObject with mapper
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|---|
|
|
| pom.xml |
|---|
| src/main/java/io/ljunggren/json/utils/JsonUtils.java |
|---|
| src/test/java/io/ljunggren/json/utils/JsonUtilsTest.java |
|---|