Bumped bld to version 2.2.0

This commit is contained in:
Erik C. Thauvin 2025-01-14 12:50:32 -08:00
parent b0f9c5a4ed
commit 8383f75ad9
Signed by: erik
GPG key ID: 776702A6A2DA330E
8 changed files with 30 additions and 7 deletions

View file

@ -139,7 +139,7 @@ public final class RenderUtils {
var capitalizeNext = true;
for (var i = 0; i < src.length(); i++) {
char c = src.charAt(i);
var c = src.charAt(i);
if (Character.isWhitespace(c)) {
capitalizeNext = true;
result.append(c);
@ -248,8 +248,9 @@ public final class RenderUtils {
public static String fetchUrl(String url, String defaultContent) {
try {
var fetchUrl = new URL(url);
HttpURLConnection connection = null;
try {
var connection = (HttpURLConnection) fetchUrl.openConnection();
connection = (HttpURLConnection) fetchUrl.openConnection();
connection.setRequestProperty("User-Agent", DEFAULT_USER_AGENT);
var code = connection.getResponseCode();
if (code >= 200 && code <= 399) {
@ -265,10 +266,15 @@ public final class RenderUtils {
if (LOGGER.isLoggable(Level.WARNING)) {
LOGGER.log(Level.WARNING, "An IO error occurred while connecting to " + fetchUrl.getHost(), ioe);
}
} finally {
if (connection != null) {
connection.disconnect();
}
}
} catch (MalformedURLException ignored) {
// do nothing
}
return defaultContent;
}