Skip to content

Commit

Permalink
minor fixes of deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
albogdano committed Oct 28, 2024
1 parent 04bb3ed commit b3f6db0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public static ClassLoader getParaClassLoader() {
jars.add(file.toURI().toURL());
}
}
paraClassLoader = new URLClassLoader(jars.toArray(new URL[0]), currentClassLoader);
paraClassLoader = new URLClassLoader(jars.toArray(URL[]::new), currentClassLoader);
// Thread.currentThread().setContextClassLoader(paraClassLoader);
} catch (Exception e) {
logger.error(null, e);
Expand Down
11 changes: 6 additions & 5 deletions para-core/src/main/java/com/erudika/para/core/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.vladsch.flexmark.util.data.MutableDataHolder;
import com.vladsch.flexmark.util.data.MutableDataSet;
import com.vladsch.flexmark.util.html.MutableAttributes;
import jakarta.validation.constraints.NotNull;
import java.io.IOException;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
Expand All @@ -48,6 +49,7 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLDecoder;
Expand All @@ -68,7 +70,6 @@
import java.util.regex.Pattern;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import jakarta.validation.constraints.NotNull;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.LocaleUtils;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -561,9 +562,9 @@ public void setAttributes(@NotNull Node node, @NotNull AttributablePart part, @N

private Boolean isIgnoredDomain(String value) {
try {
var href = new URL(value);
var href = new URI(value).toURL();
return Arrays.binarySearch(Para.getConfig().markdownAllowFollowDomains(), href.getHost()) >= 0;
} catch (MalformedURLException e) {
} catch (MalformedURLException | URISyntaxException e) {
return false;
}
}
Expand Down Expand Up @@ -813,8 +814,8 @@ private static URL toURL(String url) {
}
URL u;
try {
u = new URL(url);
} catch (MalformedURLException e) {
u = new URI(url).toURL();
} catch (MalformedURLException | URISyntaxException e) {
// the URL is not in a valid form
u = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URL;
import java.net.URI;
import java.security.spec.InvalidKeySpecException;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -124,7 +124,7 @@ public Authentication attemptAuthentication(HttpServletRequest request, HttpServ
if (StringUtils.isBlank(idpMetaUrl)) {
samlSettings = getSAMLSettings(app);
} else {
samlSettings = parseRemoteXML(new URL(idpMetaUrl), request.getParameter("entityid"));
samlSettings = parseRemoteXML(new URI(idpMetaUrl).toURL(), request.getParameter("entityid"));
samlSettings.putAll(getSAMLSettings(app)); // override IDP meta with config values
}

Expand Down

0 comments on commit b3f6db0

Please sign in to comment.