|
|
@ -59,7 +59,6 @@ import java.util.*; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
|
|
|
|
|
|
|
|
|
import static com.fr.design.dialog.FineJOptionPane.OPTION_OK_CANCEL; |
|
|
|
|
|
|
|
import static java.nio.charset.StandardCharsets.*; |
|
|
|
import static java.nio.charset.StandardCharsets.*; |
|
|
|
import static javax.swing.JOptionPane.QUESTION_MESSAGE; |
|
|
|
import static javax.swing.JOptionPane.QUESTION_MESSAGE; |
|
|
|
|
|
|
|
|
|
|
@ -87,7 +86,6 @@ public class UpdateMainDialog extends UIDialog { |
|
|
|
|
|
|
|
|
|
|
|
private static final String HYPHEN = "-"; |
|
|
|
private static final String HYPHEN = "-"; |
|
|
|
|
|
|
|
|
|
|
|
private final SimpleDateFormat CHANGELOG_FORMAT = new SimpleDateFormat("M/d/y, h:m:s a", Locale.ENGLISH); |
|
|
|
|
|
|
|
private final SimpleDateFormat UPDATELOG_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
private final SimpleDateFormat UPDATELOG_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
private final SimpleDateFormat UPDATE_INFO_TABLE_FORMAT = new SimpleDateFormat("yyyy.MM.dd"); |
|
|
|
private final SimpleDateFormat UPDATE_INFO_TABLE_FORMAT = new SimpleDateFormat("yyyy.MM.dd"); |
|
|
|
|
|
|
|
|
|
|
@ -432,7 +430,7 @@ public class UpdateMainDialog extends UIDialog { |
|
|
|
} |
|
|
|
} |
|
|
|
return array; |
|
|
|
return array; |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage()); |
|
|
|
FineLoggerFactory.getLogger().error(e, e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
return JSONArray.create(); |
|
|
|
return JSONArray.create(); |
|
|
|
} |
|
|
|
} |
|
|
@ -449,7 +447,7 @@ public class UpdateMainDialog extends UIDialog { |
|
|
|
updateCachedInfoFile(jsonArray); |
|
|
|
updateCachedInfoFile(jsonArray); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
getUpdateInfoSuccess = true; |
|
|
|
getUpdateInfoSuccess = true; |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage()); |
|
|
|
FineLoggerFactory.getLogger().error(e, e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -463,7 +461,7 @@ public class UpdateMainDialog extends UIDialog { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//从文件中读取缓存的更新信息
|
|
|
|
//从文件中读取缓存的更新信息
|
|
|
|
private void getCachedUpdateInfo(String keyword) throws Exception { |
|
|
|
private void getCachedUpdateInfo(String keyword) { |
|
|
|
String cacheInfoPath = getUpdateCacheInfo(); |
|
|
|
String cacheInfoPath = getUpdateCacheInfo(); |
|
|
|
File cacheFile = new File(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), "resources", "offlineres", cacheInfoPath)); |
|
|
|
File cacheFile = new File(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), "resources", "offlineres", cacheInfoPath)); |
|
|
|
if (!ComparatorUtils.equals(lastUpdateCacheState, "success")) { |
|
|
|
if (!ComparatorUtils.equals(lastUpdateCacheState, "success")) { |
|
|
@ -476,22 +474,26 @@ public class UpdateMainDialog extends UIDialog { |
|
|
|
String readStr, updateTimeStr; |
|
|
|
String readStr, updateTimeStr; |
|
|
|
while ((readStr = br.readLine()) != null) { |
|
|
|
while ((readStr = br.readLine()) != null) { |
|
|
|
String[] updateInfo = readStr.split("\\t"); |
|
|
|
String[] updateInfo = readStr.split("\\t"); |
|
|
|
if (updateInfo.length == 2) { |
|
|
|
if (updateInfo.length == 3) { |
|
|
|
updateTimeStr = updateInfo[0]; |
|
|
|
updateTimeStr = updateInfo[UpdateInfoTable.UPDATE_DATE_INDEX]; |
|
|
|
Date updateTime = CHANGELOG_FORMAT.parse(updateTimeStr); |
|
|
|
Date updateTime = UPDATELOG_FORMAT.parse(updateTimeStr); |
|
|
|
|
|
|
|
|
|
|
|
//形如 Build#release-2018.07.31.03.03.52.80
|
|
|
|
//形如 Build#release-2018.07.31.03.03.52.80
|
|
|
|
String currentNO = GeneralUtils.readBuildNO(); |
|
|
|
String currentNO = GeneralUtils.readBuildNO(); |
|
|
|
Date curJarDate = UPDATE_INFO_TABLE_FORMAT.parse(currentNO, new ParsePosition(currentNO.indexOf("-") + 1)); |
|
|
|
Date curJarDate = UPDATE_INFO_TABLE_FORMAT.parse(currentNO, new ParsePosition(currentNO.indexOf("-") + 1)); |
|
|
|
if (!ComparatorUtils.equals(keyword, StringUtils.EMPTY)) { |
|
|
|
if (!ComparatorUtils.equals(keyword, StringUtils.EMPTY)) { |
|
|
|
if (!containsKeyword(UPDATE_INFO_TABLE_FORMAT.format(updateTime), keyword) && !containsKeyword(updateInfo[1], keyword)) { |
|
|
|
keyword.replace('.','-'); |
|
|
|
|
|
|
|
if (!containsKeyword(UPDATELOG_FORMAT.format(updateTime), keyword) && !containsKeyword(updateInfo[UpdateInfoTable.UPDATE_TITLE_INDEX], keyword)) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (isValidLogInfo(updateInfo[1]) && curJarDate != null) { |
|
|
|
if (isValidLogInfo(updateInfo[UpdateInfoTable.UPDATE_TITLE_INDEX]) && curJarDate != null) { |
|
|
|
updateInfoList.add(new Object[]{UPDATE_INFO_TABLE_FORMAT.format(updateTime), updateInfo[1], updateTime.after(curJarDate)}); |
|
|
|
updateInfoList.add(new Object[]{UPDATELOG_FORMAT.format(updateTime), updateInfo[UpdateInfoTable.UPDATE_VERSION_INDEX], updateInfo[UpdateInfoTable.UPDATE_TITLE_INDEX], updateTime.after(curJarDate)}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(e, e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -520,7 +522,7 @@ public class UpdateMainDialog extends UIDialog { |
|
|
|
try (BufferedWriter bufferWriter = new BufferedWriter(writerStream)) { |
|
|
|
try (BufferedWriter bufferWriter = new BufferedWriter(writerStream)) { |
|
|
|
for (int i = 0; i < jsonArray.length(); i++) { |
|
|
|
for (int i = 0; i < jsonArray.length(); i++) { |
|
|
|
JSONObject jo = (JSONObject) jsonArray.get(i); |
|
|
|
JSONObject jo = (JSONObject) jsonArray.get(i); |
|
|
|
bufferWriter.write((String) jo.get("update") + '\t' + jo.get("title")); |
|
|
|
bufferWriter.write((String) jo.get("updateTime") + '\t' + jo.get("version") + '\t' + jo.get("jiraId") + " " + jo.get("info")); |
|
|
|
bufferWriter.newLine(); |
|
|
|
bufferWriter.newLine(); |
|
|
|
bufferWriter.flush(); |
|
|
|
bufferWriter.flush(); |
|
|
|
} |
|
|
|
} |
|
|
@ -545,13 +547,14 @@ public class UpdateMainDialog extends UIDialog { |
|
|
|
if (curJarDate == null) { |
|
|
|
if (curJarDate == null) { |
|
|
|
curJarDate = updateTime; |
|
|
|
curJarDate = updateTime; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!ComparatorUtils.equals(keyword, StringUtils.EMPTY)) { |
|
|
|
if (!ComparatorUtils.equals(keyword, StringUtils.EMPTY) && keyword != null) { |
|
|
|
if (!containsKeyword(UPDATE_INFO_TABLE_FORMAT.format(updateTime), keyword) && !containsKeyword(updateTitle, keyword)) { |
|
|
|
keyword.replace('.', '-'); |
|
|
|
|
|
|
|
if (!containsKeyword(UPDATELOG_FORMAT.format(updateTime), keyword) && !containsKeyword(updateTitle, keyword)) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (isValidLogInfo(updateTitle)) { |
|
|
|
if (isValidLogInfo(updateTitle)) { |
|
|
|
updateInfoList.add(new Object[]{UPDATE_INFO_TABLE_FORMAT.format(updateTime), updateVersionStr, updateTitle, updateTime.after(curJarDate)}); |
|
|
|
updateInfoList.add(new Object[]{updateTimeStr, updateVersionStr, updateTitle, updateTime.after(curJarDate)}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return new ArrayList<>(updateInfoList); |
|
|
|
return new ArrayList<>(updateInfoList); |
|
|
|