Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove calls to deprecated URL constructor #4551

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

mherwege
Copy link
Contributor

@mherwege mherwege commented Jan 10, 2025

As part of #4546, it was pointed out the URL constructor has been deprecated in Java 21.

This PR removes all uses of the URL constructor in core.

It starts from #4546, which only looks at one class in HttpUtil (and also solves a different problem), so that should be reviewed first (and this one rebased afterwards).

@holgerfriedrich Let me know what you think.

Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
@mherwege mherwege requested a review from a team as a code owner January 10, 2025 08:05
@@ -215,7 +215,7 @@ protected List<Addon> getRemoteAddons() {

// retrieve from remote
try {
URL url = new URL(String.format("%s%s", COMMUNITY_TOPIC_URL, uid.replace(ADDON_ID_PREFIX, "")));
URL url = URI.create(String.format("%s%s", COMMUNITY_TOPIC_URL, uid.replace(ADDON_ID_PREFIX, ""))).toURL();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're there, String.format("%s%s", COMMUNITY_TOPIC_URL, uid.replace(ADDON_ID_PREFIX, "")) could be replaced by "%s%s".formatted(COMMUNITY_TOPIC_URL, uid.replace(ADDON_ID_PREFIX, ""))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or COMMUNITY_TOPIC_URL + uid.replace(ADDON_ID_PREFIX, "") 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously

Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants