fix: replace deprecated X509Certificate.getSubjectDN() and getIssuerDN() with X500Principal equivalents#3283
Open
itsmohitnarayan wants to merge 1 commit intoAutoMQ:mainfrom
Conversation
55efd62 to
ce083ec
Compare
Replace deprecated methods with their X500Principal equivalents: - getSubjectDN() → getSubjectX500Principal() - getIssuerDN() → getIssuerX500Principal() Both deprecated methods have implementation-dependent behavior, while X500Principal provides well-defined RFC 2253 output via getName(). Added @SuppressWarnings for overriding deprecated abstract methods with clarifying comments explaining the necessity. Updated test assertions to use X500Principal for proper comparison. Fixes AutoMQ#3282
ce083ec to
1219140
Compare
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
Replace deprecated
X509Certificate.getSubjectDN()andX509Certificate.getIssuerDN()methods with their recommendedX500Principalequivalents inCommonNameLoggingTrustManagerFactoryWrapper.java.Changes
getSubjectDN()→getSubjectX500Principal()getIssuerDN()→getIssuerX500Principal()java.security.PrincipalimportWhy
Per JDK-4959744, both methods have been deprecated since JDK 16 because:
Principalwith implementation-dependentgetName()outputX500Principalprovides well-defined RFC 2253 output, making the behavior consistent across JVMsThis eliminates the deprecation warnings reported in #3282:
Testing
Principal→X500Principalis binary compatible sinceX500PrincipalimplementsPrincipalX500Principal.getName()returns the same DN formatFixes #3282