优化 SSL 异常处理 (#5168)

fix #5115 

Co-authored-by: xirren <xirren@outlook.com>
Co-authored-by: 3gf8jv4dv <3gf8jv4dv@gmail.com>
This commit is contained in:
Xirren
2026-01-11 21:28:54 +08:00
committed by GitHub
parent a05b24cfd7
commit 91e4c85a28
12 changed files with 15 additions and 3 deletions

View File

@@ -417,7 +417,7 @@ public final class Accounts {
if (exception.getCause().getMessage() != null && exception.getCause().getMessage().contains("Remote host terminated")) { if (exception.getCause().getMessage() != null && exception.getCause().getMessage().contains("Remote host terminated")) {
return i18n("account.failed.connect_authentication_server"); return i18n("account.failed.connect_authentication_server");
} }
if (exception.getCause().getMessage() != null && exception.getCause().getMessage().contains("No name matching") || exception.getCause().getMessage().contains("No subject alternative DNS name matching")) { if (exception.getCause().getMessage() != null && (exception.getCause().getMessage().contains("No name matching") || exception.getCause().getMessage().contains("No subject alternative DNS name matching"))) {
return i18n("account.failed.dns"); return i18n("account.failed.dns");
} }
return i18n("account.failed.ssl"); return i18n("account.failed.ssl");

View File

@@ -134,7 +134,10 @@ public final class DownloadProviders {
return i18n("install.failed.downloading.detail", uri) + "\n" + i18n("exception.access_denied", ((AccessDeniedException) exception.getCause()).getFile()); return i18n("install.failed.downloading.detail", uri) + "\n" + i18n("exception.access_denied", ((AccessDeniedException) exception.getCause()).getFile());
} else if (exception.getCause() instanceof ArtifactMalformedException) { } else if (exception.getCause() instanceof ArtifactMalformedException) {
return i18n("install.failed.downloading.detail", uri) + "\n" + i18n("exception.artifact_malformed"); return i18n("install.failed.downloading.detail", uri) + "\n" + i18n("exception.artifact_malformed");
} else if (exception.getCause() instanceof SSLHandshakeException) { } else if (exception.getCause() instanceof SSLHandshakeException && !(exception.getCause().getMessage() != null && exception.getCause().getMessage().contains("Remote host terminated"))) {
if (exception.getCause().getMessage() != null && (exception.getCause().getMessage().contains("No name matching") || exception.getCause().getMessage().contains("No subject alternative DNS name matching"))) {
return i18n("install.failed.downloading.detail", uri) + "\n" + i18n("exception.dns.pollution");
}
return i18n("install.failed.downloading.detail", uri) + "\n" + i18n("exception.ssl_handshake"); return i18n("install.failed.downloading.detail", uri) + "\n" + i18n("exception.ssl_handshake");
} else { } else {
return i18n("install.failed.downloading.detail", uri) + "\n" + StringUtils.getStackTrace(exception.getCause()); return i18n("install.failed.downloading.detail", uri) + "\n" + StringUtils.getStackTrace(exception.getCause());

View File

@@ -167,7 +167,7 @@ public final class AddAuthlibInjectorServerPane extends TransitionPane implement
if (exception.getMessage() != null && exception.getMessage().contains("Remote host terminated")) { if (exception.getMessage() != null && exception.getMessage().contains("Remote host terminated")) {
return i18n("account.failed.connect_injector_server"); return i18n("account.failed.connect_injector_server");
} }
if (exception.getMessage() != null && exception.getMessage().contains("No name matching") || exception.getMessage().contains("No subject alternative DNS name matching")) { if (exception.getMessage() != null && (exception.getMessage().contains("No name matching") || exception.getMessage().contains("No subject alternative DNS name matching"))) {
return i18n("account.failed.dns"); return i18n("account.failed.dns");
} }
return i18n("account.failed.ssl"); return i18n("account.failed.ssl");

View File

@@ -382,6 +382,7 @@ exception.access_denied=HMCL is unable to access the file "%s". It may be locked
If not, please check if your user account has adequate permissions to access it. If not, please check if your user account has adequate permissions to access it.
exception.artifact_malformed=Cannot verify the integrity of the downloaded files. exception.artifact_malformed=Cannot verify the integrity of the downloaded files.
exception.ssl_handshake=Failed to establish SSL connection because the SSL certificate is missing from the current Java installation. You can try opening HMCL with another Java installation and try again. exception.ssl_handshake=Failed to establish SSL connection because the SSL certificate is missing from the current Java installation. You can try opening HMCL with another Java installation and try again.
exception.dns.pollution=Failed to establish an SSL connection. DNS resolution may be incorrect. Please try changing your DNS server or using a proxy service.
extension.bat=Windows Batch File extension.bat=Windows Batch File
extension.mod=Mod File extension.mod=Mod File

View File

@@ -360,6 +360,7 @@ exception.access_denied=HMCL غير قادر على الوصول إلى المل
إذا لم يكن الأمر كذلك، يرجى التحقق مما إذا كان حساب المستخدم الخاص بك لديه أذونات كافية للوصول إليه. إذا لم يكن الأمر كذلك، يرجى التحقق مما إذا كان حساب المستخدم الخاص بك لديه أذونات كافية للوصول إليه.
exception.artifact_malformed=لا يمكن التحقق من سلامة الملفات المحملة. exception.artifact_malformed=لا يمكن التحقق من سلامة الملفات المحملة.
exception.ssl_handshake=فشل إنشاء اتصال SSL لأن شهادة SSL مفقودة من تثبيت Java الحالي. يمكنك محاولة فتح HMCL باستخدام تثبيت Java آخر والمحاولة مرة أخرى. exception.ssl_handshake=فشل إنشاء اتصال SSL لأن شهادة SSL مفقودة من تثبيت Java الحالي. يمكنك محاولة فتح HMCL باستخدام تثبيت Java آخر والمحاولة مرة أخرى.
exception.dns.pollution=فشل إنشاء اتصال SSL. قد تكون هناك مشكلة في تحليل أسماء النطاقات (DNS). يرجى محاولة تغيير خادم DNS أو استخدام خدمة وكيل.
extension.bat=ملف Batch لـ Windows extension.bat=ملف Batch لـ Windows
extension.mod=ملف التعديل extension.mod=ملف التعديل

View File

@@ -360,6 +360,7 @@ exception.access_denied=HMCL no puede acceder al archivo %s. Puede estar bloquea
Si no es así, comprueba si tu cuenta tiene permisos suficientes para acceder a ella. Si no es así, comprueba si tu cuenta tiene permisos suficientes para acceder a ella.
exception.artifact_malformed=No se puede verificar la integridad de los archivos descargados. exception.artifact_malformed=No se puede verificar la integridad de los archivos descargados.
exception.ssl_handshake=No se pudo establecer una conexión SSL porque falta el certificado SSL en la instalación actual de Java. Puede intentar abrir HMCL con otro Java y volver a intentarlo. exception.ssl_handshake=No se pudo establecer una conexión SSL porque falta el certificado SSL en la instalación actual de Java. Puede intentar abrir HMCL con otro Java y volver a intentarlo.
exception.dns.pollution=No se pudo establecer una conexión SSL. Es posible que la resolución DNS sea incorrecta. Por favor, intente cambiar el servidor DNS o usar un servicio proxy.
extension.bat=Archivo por lotes de Windows extension.bat=Archivo por lotes de Windows
extension.mod=Archivo mod extension.mod=Archivo mod

View File

@@ -310,6 +310,7 @@ exception.access_denied=ファイル %s にアクセスできないので、HMCL
Windowsユーザーの場合、リソースモニターでプログラムがファイルを占有しているかどうかを確認し、もしそうなら、このファイルを占有している関連プログラムを閉じるか、コンピュータを再起動して、もう一度試してみることも可能です。 Windowsユーザーの場合、リソースモニターでプログラムがファイルを占有しているかどうかを確認し、もしそうなら、このファイルを占有している関連プログラムを閉じるか、コンピュータを再起動して、もう一度試してみることも可能です。
exception.artifact_malformed=ダウンロードしたファイルがチェックサムを通過していない。 exception.artifact_malformed=ダウンロードしたファイルがチェックサムを通過していない。
exception.ssl_handshake=現在のJava仮想マシンに該当するSSL証明書がないため、SSL接続を確立できませんでした。別のJava仮想マシンでHMCLを起動して、もう一度試してみてください。 exception.ssl_handshake=現在のJava仮想マシンに該当するSSL証明書がないため、SSL接続を確立できませんでした。別のJava仮想マシンでHMCLを起動して、もう一度試してみてください。
exception.dns.pollution=SSL 接続を確立できませんでした。DNS 解決が正しくない可能性があります。DNS サーバーを変更するか、プロキシサービスを使用してみてください。
extension.bat=WindowsBatファイル extension.bat=WindowsBatファイル
extension.mod=Modファイル extension.mod=Modファイル

View File

@@ -353,6 +353,7 @@ exception.access_denied=不能訪案「%s」。HMCL 或無權以訪之,抑既
凡有謬,遽求助於右上之鈕。 凡有謬,遽求助於右上之鈕。
exception.artifact_malformed=所引之案未能經校。\n君可求助於右上之鈕 exception.artifact_malformed=所引之案未能經校。\n君可求助於右上之鈕
exception.ssl_handshake=無築 SSL 鏈。爪哇缺證。宜改爪哇,抑制廢爾代。\n君可求助於右上之鈕。 exception.ssl_handshake=無築 SSL 鏈。爪哇缺證。宜改爪哇,抑制廢爾代。\n君可求助於右上之鈕。
exception.dns.pollution=無築 SSL 鏈。或由 DNS 污染、解析有誤也。宜更 DNS 伺服,抑用代理以訪。\n君可求助於右上之鈕。
extension.bat=視窗角本 extension.bat=視窗角本
extension.mod=改囊案 extension.mod=改囊案

View File

@@ -360,6 +360,7 @@ exception.access_denied=Лаунчер не может получить дост
Если нет, проверьте, достаточно ли привилегий у вашего аккаунта для доступа к нему. Если нет, проверьте, достаточно ли привилегий у вашего аккаунта для доступа к нему.
exception.artifact_malformed=Не удалось проверить целостность скачаных файлов. exception.artifact_malformed=Не удалось проверить целостность скачаных файлов.
exception.ssl_handshake=Не удалось установить SSL-соединение из-за отсутствия SSL-сертификатов в текущей установке Java. Вы можете попробовать запустить лаунчер в другой версии Java, а затем повторить попытку. exception.ssl_handshake=Не удалось установить SSL-соединение из-за отсутствия SSL-сертификатов в текущей установке Java. Вы можете попробовать запустить лаунчер в другой версии Java, а затем повторить попытку.
exception.dns.pollution=Не удалось установить SSLсоединение. Возможно, некорректно разрешаются DNSимена. Попробуйте сменить DNSсервер или воспользоваться прокси-службой.
extension.bat=Пакетный файл Windows extension.bat=Пакетный файл Windows
extension.mod=Файл мода extension.mod=Файл мода

View File

@@ -358,6 +358,7 @@ exception.access_denied=HMCL не може отримати доступ до ф
Якщо ні, перевірте, чи має ваш обліковий запис достатні дозволи для доступу до нього. Якщо ні, перевірте, чи має ваш обліковий запис достатні дозволи для доступу до нього.
exception.artifact_malformed=Не вдається перевірити цілісність завантажених файлів. exception.artifact_malformed=Не вдається перевірити цілісність завантажених файлів.
exception.ssl_handshake=Не вдалося встановити SSL-з'єднання, оскільки SSL-сертифікат відсутній у поточній інсталяції Java. Ви можете спробувати відкрити HMCL іншою інсталяцією Java і спробувати знову. exception.ssl_handshake=Не вдалося встановити SSL-з'єднання, оскільки SSL-сертифікат відсутній у поточній інсталяції Java. Ви можете спробувати відкрити HMCL іншою інсталяцією Java і спробувати знову.
exception.dns.pollution=Не вдалося встановити SSL-з'єднання. Можливо, DNS неправильно розв'язується. Спробуйте змінити DNS-сервер або використовувати проксі-сервіс.
extension.bat=Пакетний файл Windows extension.bat=Пакетний файл Windows
extension.mod=Файл мода extension.mod=Файл мода

View File

@@ -372,6 +372,7 @@ exception.access_denied=無法存取檔案「%s」。因為 HMCL 沒有對該檔
對於 Windows 使用者,你還可以嘗試透過資源監視器查看是否有程式占用了該檔案。如果是,你可以關閉占用此檔案的程式,或者重啟電腦再試。 對於 Windows 使用者,你還可以嘗試透過資源監視器查看是否有程式占用了該檔案。如果是,你可以關閉占用此檔案的程式,或者重啟電腦再試。
exception.artifact_malformed=下載的檔案正確,但無法透過校驗。 exception.artifact_malformed=下載的檔案正確,但無法透過校驗。
exception.ssl_handshake=無法建立 SSL 連線。目前 Java 缺少相關的 SSL 證書。你可以嘗試使用其他 Java 或關閉網路代理開啟 HMCL 再試。 exception.ssl_handshake=無法建立 SSL 連線。目前 Java 缺少相關的 SSL 證書。你可以嘗試使用其他 Java 或關閉網路代理開啟 HMCL 再試。
exception.dns.pollution=無法建立 SSL 連線。可能是 DNS 解析有誤。請嘗試更換 DNS 伺服器或使用代理服務。
extension.bat=Windows 批次檔 extension.bat=Windows 批次檔
extension.mod=模組檔案 extension.mod=模組檔案

View File

@@ -375,6 +375,7 @@ exception.access_denied=无法访问文件“%s”。HMCL 没有对该文件的
如遇到问题,你可以点击右上角帮助按钮进行求助。 如遇到问题,你可以点击右上角帮助按钮进行求助。
exception.artifact_malformed=下载的文件无法通过校验。\n你可以点击右上角帮助按钮进行求助。 exception.artifact_malformed=下载的文件无法通过校验。\n你可以点击右上角帮助按钮进行求助。
exception.ssl_handshake=无法建立 SSL 连接。当前 Java 缺少相关的 SSL 证书。你可以尝试使用其他 Java 启动 HMCL 再试。\n你可以点击右上角帮助按钮进行求助。 exception.ssl_handshake=无法建立 SSL 连接。当前 Java 缺少相关的 SSL 证书。你可以尝试使用其他 Java 启动 HMCL 再试。\n你可以点击右上角帮助按钮进行求助。
exception.dns.pollution=无法建立 SSL 连接。可能是 DNS 解析有误。请尝试更换 DNS 服务器或使用代理服务。\n你可以点击右上角帮助按钮进行求助。
extension.bat=Windows 脚本 extension.bat=Windows 脚本
extension.mod=模组文件 extension.mod=模组文件