From bffc93847ee3f5d78f624964fcb33a77d9ab7bfb Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 4 Jan 2023 11:52:25 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-87013=20=E8=AE=BE=E8=AE=A1=E5=99=A811.0.?= =?UTF-8?q?11=E6=9B=B4=E6=96=B0=E6=97=A5=E5=BF=97=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E4=BF=A1=E6=81=AF=E6=98=AF=E9=87=8D=E5=A4=8D=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/update/ui/dialog/UpdateMainDialog.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java b/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java index 1fa37f60f8..033e2cb07f 100644 --- a/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java +++ b/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java @@ -118,6 +118,8 @@ public class UpdateMainDialog extends UIDialog { private ArrayList updateInfoList; + private Set 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 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) {