Skip to content

Milestone 2: Add XML.toJSONObject(...) with replacement logic and test cases #978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

RJCheuk
Copy link

@RJCheuk RJCheuk commented May 12, 2025

Summary

This pull request implements Milestone 2, Task 2 for SWE262P.

✅ Changes made:

  • Added a new overloaded static method:
    XML.toJSONObject(Reader reader, JSONPointer path, JSONObject replacement)
  • Implemented internal replacement logic in a new method:
    parseMilestone2(...)
  • Modified XML parsing so that the replacement is done during parsing, without reading the entire XML content into memory first.
  • Added a new test class:
    XMLPointerReplaceTest.java
    • Includes tests for:
      • successful replacement
      • invalid path
      • null reader

📌 Notes

  • All existing test suites remain untouched and pass.
  • The new test cases were added in src/test/java/org/json/junit/XMLPointerReplaceTest.java
  • README-M2.md (not yet added) will explain the design and performance considerations in detail.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
32.6% Duplication on New Code (required ≤ 3%)
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@stleary
Copy link
Owner

stleary commented May 12, 2025

Closed due to failing tests

@stleary stleary closed this May 12, 2025
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.

3 participants