|
|
|
@ -118,6 +118,8 @@ public class UpdateMainDialog extends UIDialog {
|
|
|
|
|
|
|
|
|
|
private ArrayList<Object[]> updateInfoList; |
|
|
|
|
|
|
|
|
|
private Set<String> titleSet; |
|
|
|
|
|
|
|
|
|
private boolean getUpdateInfoSuccess; |
|
|
|
|
|
|
|
|
|
private UpdateInfoCachePropertyManager cacheProperty; |
|
|
|
@ -267,6 +269,7 @@ public class UpdateMainDialog extends UIDialog {
|
|
|
|
|
String keyword = searchUpdateInfoKeyword.getText(); |
|
|
|
|
if (ComparatorUtils.equals(keyword, StringUtils.EMPTY) && getUpdateInfoSuccess) { |
|
|
|
|
updateInfoList.clear(); |
|
|
|
|
titleSet.clear(); |
|
|
|
|
getUpdateInfo(keyword).execute(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -281,6 +284,7 @@ public class UpdateMainDialog extends UIDialog {
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
if (getUpdateInfoSuccess) { |
|
|
|
|
updateInfoList.clear(); |
|
|
|
|
titleSet.clear(); |
|
|
|
|
getUpdateInfo(searchUpdateInfoKeyword.getText()).execute(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -388,6 +392,7 @@ public class UpdateMainDialog extends UIDialog {
|
|
|
|
|
|
|
|
|
|
private SwingWorker<JSONArray, Void> getUpdateInfo(final String keyword) { |
|
|
|
|
updateInfoList = new ArrayList<>(); |
|
|
|
|
titleSet = new HashSet<>(); |
|
|
|
|
lastUpdateCacheTime = UpdateConstants.CHANGELOG_X_START; |
|
|
|
|
String cacheConfigPath = getUpdateCacheConfig(); |
|
|
|
|
cacheProperty = new UpdateInfoCachePropertyManager(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), "resources", "offlineres", cacheConfigPath)); |
|
|
|
@ -489,6 +494,7 @@ public class UpdateMainDialog extends UIDialog {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (isValid(updateInfo, GeneralUtils.objectToString(curJarDate))) { |
|
|
|
|
titleSet.add(updateInfo[UpdateInfoTable.UPDATE_TITLE_INDEX]); |
|
|
|
|
updateInfoList.add(new Object[]{UPDATELOG_FORMAT.format(updateTime), updateInfo[UpdateInfoTable.UPDATE_VERSION_INDEX], updateInfo[UpdateInfoTable.UPDATE_TITLE_INDEX], updateTime.after(curJarDate)}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -501,7 +507,7 @@ public class UpdateMainDialog extends UIDialog {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isValid(String[] updateInfo, String curJarDate) { |
|
|
|
|
return isValidLogInfo(updateInfo[UpdateInfoTable.UPDATE_TITLE_INDEX]) && curJarDate != null && curJarDate.compareTo(updateInfo[UpdateInfoTable.UPDATE_DATE_INDEX]) <= 0; |
|
|
|
|
return isValidLogInfo(updateInfo[UpdateInfoTable.UPDATE_TITLE_INDEX]) && curJarDate != null && curJarDate.compareTo(updateInfo[UpdateInfoTable.UPDATE_DATE_INDEX]) <= 0 && !titleSet.contains(updateInfo[UpdateInfoTable.UPDATE_TITLE_INDEX]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updateCachedInfoFile(JSONArray jsonArray) throws Exception { |
|
|
|
@ -561,6 +567,7 @@ public class UpdateMainDialog extends UIDialog {
|
|
|
|
|
} |
|
|
|
|
Date curDate = UPDATE_INFO_TABLE_FORMAT.parse(currentNO, new ParsePosition(currentNO.indexOf("-") + 1)); |
|
|
|
|
if (isValid4GenerateInfo(updateTitle, GeneralUtils.objectToString(curDate), updateTimeStr)) { |
|
|
|
|
titleSet.add(updateTitle); |
|
|
|
|
updateInfoList.add(new Object[]{updateTimeStr, updateVersionStr, updateTitle, updateTime.after(curJarDate)}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -568,7 +575,7 @@ public class UpdateMainDialog extends UIDialog {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean isValid4GenerateInfo(String updateTitle, String curDate, String updateTimeStr) { |
|
|
|
|
return isValidLogInfo(updateTitle) && curDate.compareTo(updateTimeStr) <= 0; |
|
|
|
|
return isValidLogInfo(updateTitle) && curDate.compareTo(updateTimeStr) <= 0 && !titleSet.contains(updateTitle); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean containsKeyword(String str, String keyword) { |
|
|
|
|