diff --git a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java
index 8882c9af..ebfa1428 100644
--- a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java
+++ b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java
@@ -39,6 +39,20 @@ public class UpdateUtils {
}
return thisVersion;
}
+
+ private static String getChangeList(JSONObject rj) {
+ JSONArray jsonChangeList = rj.getJSONArray("changeList");
+ StringBuilder changeList = new StringBuilder();
+ for (int i = 0; i < jsonChangeList.length(); i++) {
+ String change = jsonChangeList.getString(i);
+ if (change.startsWith(UpdateUtils.getThisJarVersion() + ":")) {
+ break;
+ }
+ changeList.append("\n").append(change);
+ }
+ return changeList.toString();
+ }
+
public static void updateProgramCLI() {
logger.info("Checking for update...");
@@ -61,16 +75,10 @@ public class UpdateUtils {
}
String jsonString = doc.body().html().replaceAll(""", "\"");
ripmeJson = new JSONObject(jsonString);
- JSONArray jsonChangeList = ripmeJson.getJSONArray("changeList");
- StringBuilder changeList = new StringBuilder();
- for (int i = 0; i < jsonChangeList.length(); i++) {
- String change = jsonChangeList.getString(i);
- if (change.startsWith(UpdateUtils.getThisJarVersion() + ":")) {
- break;
- }
- changeList.append("\n").append(change);
- }
- logger.info("Change log: \n" + changeList.toString());
+
+ String changeList = getChangeList(ripmeJson);
+
+ logger.info("Change log: \n" + changeList);
String latestVersion = ripmeJson.getString("latestVersion");
if (UpdateUtils.isNewerVersion(latestVersion)) {
@@ -112,15 +120,8 @@ public class UpdateUtils {
}
String jsonString = doc.body().html().replaceAll(""", "\"");
ripmeJson = new JSONObject(jsonString);
- JSONArray jsonChangeList = ripmeJson.getJSONArray("changeList");
- StringBuilder changeList = new StringBuilder();
- for (int i = 0; i < jsonChangeList.length(); i++) {
- String change = jsonChangeList.getString(i);
- if (change.startsWith(UpdateUtils.getThisJarVersion() + ":")) {
- break;
- }
- changeList.append("
+ ").append(change);
- }
+
+ String changeList = getChangeList(ripmeJson);
String latestVersion = ripmeJson.getString("latestVersion");
if (UpdateUtils.isNewerVersion(latestVersion)) {
@@ -128,7 +129,7 @@ public class UpdateUtils {
int result = JOptionPane.showConfirmDialog(
null,
"New version (" + latestVersion + ") is available!"
- + "
Recent changes:" + changeList.toString()
+ + "
Recent changes:" + changeList
+ "
Do you want to download and run the newest version?",
"RipMe Updater",
JOptionPane.YES_NO_OPTION);