Skip to content

Forbid use of library methods overridden in XMLUtil - #12637

Open
qqmyers wants to merge 1 commit into
IQSS:developfrom
GlobalDataverseCommunityConsortium:Require-XMLUtil-use
Open

Forbid use of library methods overridden in XMLUtil#12637
qqmyers wants to merge 1 commit into
IQSS:developfrom
GlobalDataverseCommunityConsortium:Require-XMLUtil-use

Conversation

@qqmyers

@qqmyers qqmyers commented Aug 21, 2026

Copy link
Copy Markdown
Member

What this PR does / why we need it: After the cleanup in #12567, this PR helps to make sure that new code will also use our XMLUtil methods.

Which issue(s) this PR closes:

  • Closes #

Special notes for your reviewer: Leverages the same method as for JsonUtil. The XMLUtil class has to be added to the excludes section because it calls the forbidden methods in its override methods (whereas the JSONUtil class doesn't call the static Json.* methods it replaces since it is calling the methods on the provider class it caches).

Suggestions on how to test this: Run the auto-tests. Note that this PR should fail until #12567 is merged and we pick up the changes from it.

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

Is there a release notes update needed for this change?: just dev related, no change for users.

Additional documentation:

@qqmyers qqmyers moved this to Ready for Triage in IQSS Dataverse Project Aug 21, 2026
@qqmyers

qqmyers commented Aug 21, 2026

Copy link
Copy Markdown
Member Author

So close to test-driven dev: The PR is currently failing the forbidden checks since #12567 isn't yet merged:```
[INFO] --- forbiddenapis:3.10:check (for-classes) @ dataverse ---
[INFO] Scanning for classes to check...
[INFO] Reading bundled API signatures: jdk-non-portable
[INFO] Reading bundled API signatures: jdk-internal-21
[INFO] Reading API signatures: /home/runner/work/dataverse/dataverse/src/maven/forbiddenapis.txt
[INFO] Loading classes to check...
[INFO] Scanning classes for violations...
[ERROR] Forbidden method invocation: javax.xml.stream.XMLInputFactory#newInstance() [Use edu.harvard.iq.dataverse.util.xml.XmlUtil.getSecureXMLInputFactory() instead]
[ERROR] in edu.harvard.iq.dataverse.authorization.providers.shib.ShibServiceBean (ShibServiceBean.java:224)
[ERROR] Forbidden method invocation: javax.xml.parsers.DocumentBuilderFactory#newInstance() [Use edu.harvard.iq.dataverse.util.xml.XmlUtil.getSecureDocumentBuilderFactory() instead]
[ERROR] in edu.harvard.iq.dataverse.authorization.providers.oauth2.impl.OrcidOAuth2AP (OrcidOAuth2AP.java:283)
[ERROR] Forbidden method invocation: javax.xml.parsers.DocumentBuilderFactory#newInstance() [Use edu.harvard.iq.dataverse.util.xml.XmlUtil.getSecureDocumentBuilderFactory() instead]
[ERROR] in edu.harvard.iq.dataverse.api.ldn.COARNotifyRelationshipAnnouncement (COARNotifyRelationshipAnnouncement.java:276)
[ERROR] Forbidden method invocation: javax.xml.stream.XMLInputFactory#newInstance() [Use edu.harvard.iq.dataverse.util.xml.XmlUtil.getSecureXMLInputFactory() instead]
[ERROR] in edu.harvard.iq.dataverse.authorization.AuthenticationProvidersRegistrationServiceBean (AuthenticationProvidersRegistrationServiceBean.java:398)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for Triage

Development

Successfully merging this pull request may close these issues.

1 participant