fix: replace URL with URI in Set to avoid DNS lookups#13
Open
sonarqube-agent[bot] wants to merge 1 commit into
Open
fix: replace URL with URI in Set to avoid DNS lookups#13sonarqube-agent[bot] wants to merge 1 commit into
sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AZZmtiWq2HDYqP_XyoAv for java:S2112 rule Generated by SonarQube Agent (task: e50b25ec-9b82-4ec6-a218-cbbdece5e6b7)
SonarQube reviewer guide
|
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.




Changed Set to Set to prevent unintended DNS lookups during equals and hashCode operations. Using URI instead of URL in collections eliminates blocking network calls that can impact performance and reliability.
View Project in SonarCloud
Fixed Issues
java:S2112 - Use the URI class instead. • MAJOR • View issue
Location:
core/src/main/java/com/webcohesion/enunciate/Enunciate.java:588Why is this an issue?
The
equalsandhashCodemethods ofjava.net.URLmay trigger a name service lookup (typically DNS) to resolve the hostname or IP address. Depending on the configuration, and network status, this lookup can be time-consuming.What changed
This is the direct fix for the issue of using java.net.URL in a Set, which can trigger DNS lookups during equals/hashCode operations. It changes the local variable declaration from Set to Set, eliminating the problematic URL-based Set at the exact line flagged by the static analysis warning.
SonarQube Remediation Agent uses AI. Check for mistakes.