fix: make URLToStringConversion generate URI.create(String).toURL() instead of new url(/Education?url=https%3A%2F%2Fgithub.com%2Fmapstruct%2Fmapstruct%2Fpull%2FString)#4044
Open
yvasyliev wants to merge 1 commit into
Conversation
…)` instead of `new url(/Education?url=https%3A%2F%2Fgithub.com%2Fmapstruct%2Fmapstruct%2Fpull%2FString)`
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.
This pull request refactors the handling of URL conversions in the codebase, standardizing the approach by using
URI.create(...).toURL()instead of directnew url(/Education?url=https%3A%2F%2Fgithub.com%2Fmapstruct%2Fmapstruct%2Fpull%2F...)construction. This change affects both the internal conversion logic and the related tests, aiming for improved consistency and reliability in URL handling.Refactoring of URL Conversion Logic:
ConversionUtils.urlmethod and related imports ofjava.net.URLwere removed, and all references were updated to useURIand theConversionUtils.urimethod instead.URLToStringConversion.java, the conversion now constructs URLs usingURI.create(<SOURCE>).toURL()rather thannew url(/Education?url=https%3A%2F%2Fgithub.com%2Fmapstruct%2Fmapstruct%2Fpull%2F%26lt%3BSOURCE%26gt%3B). This also updates the import types fromURLtoURI.Test Adjustments for New Conversion Approach:
URLConversionTest.java, all usages ofnew url(/Education?url=https%3A%2F%2Fgithub.com%2Fmapstruct%2Fmapstruct%2Fpull%2F...)were replaced withURI.create(...).toURL()to match the new conversion logic."xxxxxx://mapstruct.org/") instead of arbitrary invalid strings, ensuring the tests accurately reflect the new conversion path.Closes #4041