|
|
@ -87,7 +87,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 +431,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 +448,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 +462,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")) { |
|
|
@ -478,7 +477,7 @@ public class UpdateMainDialog extends UIDialog { |
|
|
|
String[] updateInfo = readStr.split("\\t"); |
|
|
|
String[] updateInfo = readStr.split("\\t"); |
|
|
|
if (updateInfo.length == 2) { |
|
|
|
if (updateInfo.length == 2) { |
|
|
|
updateTimeStr = updateInfo[0]; |
|
|
|
updateTimeStr = updateInfo[0]; |
|
|
|
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)); |
|
|
@ -492,6 +491,8 @@ public class UpdateMainDialog extends UIDialog { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(e, e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -520,7 +521,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("jiraId") + " " + jo.get("info")); |
|
|
|
bufferWriter.newLine(); |
|
|
|
bufferWriter.newLine(); |
|
|
|
bufferWriter.flush(); |
|
|
|
bufferWriter.flush(); |
|
|
|
} |
|
|
|
} |
|
|
|