1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 09:09:38 +02:00

Remove usage of deprecated URL constructor

Although those URL constructors are only deprecated with Java 20, this
already removes their usage.
This commit is contained in:
Florian Schmaus 2024-10-15 15:45:47 +02:00
parent 8b9cd98756
commit 0ee5acc494
6 changed files with 33 additions and 13 deletions

View file

@ -18,10 +18,11 @@
package org.jivesoftware.smackx.muc;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
@ -215,9 +216,9 @@ public class RoomInfo {
if (urlField != null && !urlField.getValues().isEmpty()) {
String urlString = urlField.getFirstValue();
try {
logs = new URL(urlString);
} catch (MalformedURLException e) {
LOGGER.log(Level.SEVERE, "Could not parse URL", e);
logs = new URI(urlString).toURL();
} catch (MalformedURLException | URISyntaxException e) {
throw new IllegalArgumentException("Could not parse '" + urlString + "' to URL", e);
}
}