From 8e5cc8bf4962e331f0c77acb0d5c6f243c719fc9 Mon Sep 17 00:00:00 2001 From: sqersters <109853788+bouclem@users.noreply.github.com> Date: Tue, 26 May 2026 13:23:21 +0200 Subject: [PATCH 1/2] fix: abort update when no matching asset is found Fixes #217 (followup). When the GitHub release assets do not contain a jar matching the running mode (-GUI.jar or -CLI.jar), the loop previously exited silently, then the code spawned the Update process pointing at a non-existent update.jar and called System.exit(0). The user saw RetroMCP just close with no feedback. Now the update aborts with a clear IOException, surfaced through the standard task error dialog. --- .../java/org/mcphackers/mcp/tasks/TaskDownloadUpdate.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/org/mcphackers/mcp/tasks/TaskDownloadUpdate.java b/src/main/java/org/mcphackers/mcp/tasks/TaskDownloadUpdate.java index db5b082..5597854 100644 --- a/src/main/java/org/mcphackers/mcp/tasks/TaskDownloadUpdate.java +++ b/src/main/java/org/mcphackers/mcp/tasks/TaskDownloadUpdate.java @@ -36,6 +36,7 @@ protected Stage[] setStages() { boolean confirmed = mcp.updateDialogue(notes, latestVersion); if (confirmed) { log("Downloading update..."); + boolean downloaded = false; for (Object obj : releaseJson.getJSONArray("assets")) { if (obj instanceof JSONObject) { JSONObject assetObj = (JSONObject) obj; @@ -43,9 +44,15 @@ protected Stage[] setStages() { continue; } FileUtil.downloadFile(assetObj.getString("browser_download_url"), Paths.get(MCPPaths.UPDATE_JAR)); + downloaded = true; break; } } + if (!downloaded) { + IOException t = new IOException("No matching update asset found in release! Aborting"); + Util.throwExceptionInIDE(t); + throw t; + } Path jarPath = Paths.get(MCP.class .getProtectionDomain() .getCodeSource() From 247f6c778bb19f51d0fc2cb8d1a810549a845e78 Mon Sep 17 00:00:00 2001 From: sqersters <109853788+bouclem@users.noreply.github.com> Date: Tue, 26 May 2026 21:48:17 +0200 Subject: [PATCH 2/2] refactor: check update jar existence instead of flag --- .../java/org/mcphackers/mcp/tasks/TaskDownloadUpdate.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/org/mcphackers/mcp/tasks/TaskDownloadUpdate.java b/src/main/java/org/mcphackers/mcp/tasks/TaskDownloadUpdate.java index 5597854..3f66a08 100644 --- a/src/main/java/org/mcphackers/mcp/tasks/TaskDownloadUpdate.java +++ b/src/main/java/org/mcphackers/mcp/tasks/TaskDownloadUpdate.java @@ -36,7 +36,6 @@ protected Stage[] setStages() { boolean confirmed = mcp.updateDialogue(notes, latestVersion); if (confirmed) { log("Downloading update..."); - boolean downloaded = false; for (Object obj : releaseJson.getJSONArray("assets")) { if (obj instanceof JSONObject) { JSONObject assetObj = (JSONObject) obj; @@ -44,11 +43,10 @@ protected Stage[] setStages() { continue; } FileUtil.downloadFile(assetObj.getString("browser_download_url"), Paths.get(MCPPaths.UPDATE_JAR)); - downloaded = true; break; } } - if (!downloaded) { + if (!Files.exists(Paths.get(MCPPaths.UPDATE_JAR))) { IOException t = new IOException("No matching update asset found in release! Aborting"); Util.throwExceptionInIDE(t); throw t;