Skip to content

#12362-factory-method-for-JSONbuilders - #1

Open
TillJan wants to merge 9 commits into
developfrom
#12362-factory-method-for-JSONbuilders
Open

#12362-factory-method-for-JSONbuilders#1
TillJan wants to merge 9 commits into
developfrom
#12362-factory-method-for-JSONbuilders

Conversation

@TillJan

@TillJan TillJan commented Jul 17, 2026

Copy link
Copy Markdown
Owner

What this PR does / why we need it:
The PR adds methods in the JsonUtil for creating a JsonObjectBuilder and a JsonArrayBuilder. JsonUtil caches a JsonBuilderFactory which is shared by both methods.
All usage of Json.createArrayBuilder() and Json.createObjectBuilder has been replaced by the new methods.
This avoids repeatedly loading a Jakarta JSON-P implementation through the ServiceLoader which caused inefficiency.
Which issue(s) this PR closes:

Special notes for your reviewer:
The JsonBuilderFactory is shared and only created one time, while the methods are returning new Builder everytime.
Suggestions on how to test this:

  • run existing tests
    Does this PR introduce a user interface change? If mockups are available, please link/include them here:
    no
    Is there a release notes update needed for this change?:
    no
    Additional documentation:

TillJan pushed a commit that referenced this pull request Jul 17, 2026
get `podman compose up` working
t.jansen and others added 2 commits July 17, 2026 13:44
use JsonUtil.createObjectBuilder and JsonUtil.createArrayBuilder to reuse JsonUtil.builderFactory and avoid inefficient usage of JSON providers/builders.
@TillJan
TillJan force-pushed the #12362-factory-method-for-JSONbuilders branch from bff606e to 04f565f Compare July 17, 2026 12:13
@coveralls

coveralls commented Jul 17, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 14

Coverage increased (+0.003%) to 24.977%

Details

  • Coverage increased (+0.003%) from the base build.
  • Patch coverage: 520 uncovered changes across 79 files (129 of 649 lines covered, 19.88%).
  • 1 coverage regression across 1 file.

Uncovered Changes

Top 10 Files by Coverage Impact Changed Covered %
src/main/java/edu/harvard/iq/dataverse/api/Datasets.java 71 2 2.82%
src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java 66 25 37.88%
src/main/java/edu/harvard/iq/dataverse/engine/command/impl/GetUserTracesCommand.java 35 0 0.0%
src/main/java/edu/harvard/iq/dataverse/api/Admin.java 34 0 0.0%
src/main/java/edu/harvard/iq/dataverse/util/bagit/OREMap.java 28 0 0.0%
src/main/java/edu/harvard/iq/dataverse/api/Index.java 23 0 0.0%
src/main/java/edu/harvard/iq/dataverse/datasetutility/AddReplaceFileHelper.java 20 0 0.0%
src/main/java/edu/harvard/iq/dataverse/search/IndexBatchServiceBean.java 19 0 0.0%
src/main/java/edu/harvard/iq/dataverse/api/Dataverses.java 17 0 0.0%
src/main/java/edu/harvard/iq/dataverse/search/SolrSearchResult.java 16 1 6.25%
Total (94 files) 649 129 19.88%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
src/main/java/edu/harvard/iq/dataverse/search/savedsearch/SavedSearchServiceBean.java 1 0.0%

Coverage Stats

Coverage Status
Relevant Lines: 95429
Covered Lines: 23835
Line Coverage: 24.98%
Coverage Strength: 0.25 hits per line

💛 - Coveralls

t.jansen added 2 commits July 17, 2026 14:39
refactored the start import to specific imports
replaced all Json.createObjectBuilder() and Json.createArrayBuilder() calls with the matching JsonUtil methods.
@TillJan
TillJan force-pushed the #12362-factory-method-for-JSONbuilders branch from 04f565f to ac66224 Compare July 17, 2026 12:45
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

Test Results

403 tests  +403   388 ✅ +388   34m 11s ⏱️ + 34m 11s
 55 suites + 55    15 💤 + 15 
 55 files   + 55     0 ❌ ±  0 

Results for commit de6eb0d. ± Comparison against base commit df71344.

♻️ This comment has been updated with latest results.

poikilotherm and others added 5 commits July 17, 2026 16:25
For now, enable less invasive bundled checks.
In addition, adding first rules to disallow usage of JSON-P Json.createX() API.
Disallow more methods for object and array builders using copy-style arguments.
…sonProvider.

replaced all remaining Json.createObjectBuilder() and Json.createArrayBuilder() calls with the matching JsonUtil methods.
use JsonUtil.createValue to reuse JsonUtil.provider and avoid usage of Json.createValue.
Replaced all Json.createValue to JsonUtil.createValue.
…ch fixes the forbiddenapis signature parsing failure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Performance: inefficient usage of JSON providers/builders

3 participants