Modernize dependencies, upgrade Java target to 25, and fix deprecated API usage#6
Open
mbjones wants to merge 16 commits into
Open
Modernize dependencies, upgrade Java target to 25, and fix deprecated API usage#6mbjones wants to merge 16 commits into
mbjones wants to merge 16 commits into
Conversation
…and cleaned up imports.
…deploy to maven.dataone.org
There was a problem hiding this comment.
Pull request overview
This PR updates the project’s build/dependency configuration (including a Java target bump) and modernizes several production/test code paths to remove deprecated API usages (notably Commons IO charset-implicit overloads and older HttpClient/BouncyCastle APIs).
Changes:
- Modernize
pom.xml(dependency upgrades/pruning, repository/SCM/deployment updates, Java release target change). - Update production code to use explicit UTF-8 overloads and newer BouncyCastle APIs.
- Update test code to use explicit UTF-8 overloads and newer HttpClient construction patterns.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
pom.xml |
Updates versions/deps/build config, sets Java release target, and changes distribution/scm/repo configuration. |
src/main/java/org/dataone/client/auth/CertificateManager.java |
Updates BouncyCastle usage to work with newer jdk18on artifacts and adjusts certificate parsing/conversion. |
src/main/java/org/dataone/client/utils/HttpConnectionMonitorService.java |
Minor cleanup (explicit init; logger constant). |
src/main/java/org/dataone/client/v1/itk/DataPackage.java |
Uses explicit UTF-8 when reading the resource map content. |
src/main/java/org/dataone/client/v2/itk/DataPackage.java |
Uses explicit UTF-8 when reading the resource map content. |
src/main/java/org/dataone/ore/ProvResourceMapBuilder.java |
Uses explicit UTF-8 when converting serialized ResourceMap content to an InputStream. |
src/main/resources/buildInfo/buildInfo.properties |
Removes a build info resource file. |
src/main/resources/org/dataone/configuration/config.xml |
Removes reference to Hazelcast properties. |
src/main/resources/org/dataone/configuration/d1hazelcast.properties |
Removes Hazelcast properties file. |
src/test/java/org/dataone/client/impl/rest/EchoTestMultipartRestClientIT.java |
Uses explicit UTF-8 when reading response bodies in integration tests. |
src/test/java/org/dataone/client/impl/rest/EchoTestRestClientIT.java |
Replaces deprecated HttpClient instantiation and uses explicit UTF-8. |
src/test/java/org/dataone/client/v1/itk/D1ObjectTest.java |
Uses explicit UTF-8 when reading DataSource streams in tests. |
src/test/java/org/dataone/client/v1/itk/DataPackageTest.java |
Uses explicit UTF-8; adjusts exception handling around IOUtils changes. |
src/test/java/org/dataone/client/v2/itk/D1ObjectTest.java |
Uses explicit UTF-8 when reading DataSource streams in tests. |
src/test/java/org/dataone/client/v2/itk/DataPackageTest.java |
Uses explicit UTF-8; adjusts exception handling around IOUtils changes. |
src/test/java/org/dataone/ore/ProvResourceMapBuilderTest.java |
Uses explicit UTF-8 when converting RDF/XML strings to InputStreams. |
.gitignore |
Adds .vscode/ to ignored files. |
Comments suppressed due to low confidence (3)
pom.xml:174
buildInfo/buildInfo.propertiesis still listed as a filtered resource include, but the file was removed in this PR. Keeping this resource block is misleading and duplicates resource handling; it should be removed (or the file restored).
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>buildInfo/buildInfo.properties</include>
</includes>
</resource>
src/test/java/org/dataone/client/v2/itk/DataPackageTest.java:174
- Catching
RuntimeExceptionhere and converting it tofail(e.getMessage())loses the original exception as the test failure cause (and can make debugging harder). Let the RuntimeException propagate so the test fails with the original stack trace.
} catch (RuntimeException e) {
e.printStackTrace();
fail(e.getMessage());
}
src/test/java/org/dataone/client/v1/itk/DataPackageTest.java:174
- Catching
RuntimeExceptionhere and converting it tofail(e.getMessage())loses the original exception as the test failure cause (and can make debugging harder). Let the RuntimeException propagate so the test fails with the original stack trace.
} catch (RuntimeException e) {
e.printStackTrace();
fail(e.getMessage());
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR modernizes the build configuration, upgrades key dependencies to address security vulnerabilities, and eliminates a set of deprecated API usages across production and test code.
Changes
Build / Dependency cleanup (pom.xml)
maven.compiler.release=25as the compile target (tested with Java 17, 21, and 25).httpclientandhttpclient-cacheto 4.5.14 across all transitive paths.jakarta.xml.bind-apiandjaxb-runtime2.3.2 to support the module system on Java 17+.wagon-ssh-external3.5.3 deploying toscpexe://maven.dataone.org/var/www/maven, matching the configuration used ind1_common_java. Removed the Sonatype repository entry.2.4.3-SNAPSHOT; addedtest-jarclassifier dependency to restore test infrastructure.buildInfo.propertiesresource, and unused Maven plugin declarations. Updated SCM URLs to current GitHub addresses.Security fix: BouncyCastle upgrade (
CertificateManager.java, pom.xml)bcprov-jdk15on/bcpkix-jdk15on1.52 withbcprov-jdk18on/bcpkix-jdk18on1.84 (the currentjdk18online).CertificateManager: replaced removedX509CertificateObjectconstructor withJcaX509CertificateConverter; replaced removedDERUTF8StringwithASN1UTF8String; guardedSecurity.addProvider()to avoid duplicate registration; updated catch clause fromCertificateParsingExceptiontoCertificateException.bcprov-jdk15onpulled in byd1_test_resourcesto avoid classpath conflicts.Deprecated API cleanup (production code)
ProvResourceMapBuilder.java,DataPackagev1/v2: replacedIOUtils.toInputStream(String)andIOUtils.toString(InputStream)with explicitStandardCharsets.UTF_8overloads.HttpConnectionMonitorService.java: minor cleanup of deprecated usage.Deprecated API cleanup (test code)
DataPackageTestv1/v2,D1ObjectTestv1/v2,ProvResourceMapBuilderTest: replaced allIOUtilscharset-implicit overloads withStandardCharsets.UTF_8.EchoTestRestClientIT: replacednew DefaultHttpClient()withHttpClients.createDefault(); introduced anewRestClient()helper to centralize construction; updated allIOUtilscalls with explicit charset.EchoTestMultipartRestClientIT: updated 8IOUtils.toString(InputStream)calls with explicitStandardCharsets.UTF_8.Testing
mvn clean test).Not included (deferred)
AutoCloseInputStreamdeprecations inMultipartD1Node(6 sites) — requires architectural decision on the local wrapper class.BaseException.getPid()deprecations in in-memory test nodes (2 sites).CertificateManagerbroader deprecation cluster:Observable, legacySSLSocketFactory/ALLOW_ALL_HOSTNAME_VERIFIER,getSubjectDN(),Runtime.exec()— deferred for a focused TLS/auth modernization pass.