Browse Source

Pull request #9518: REPORT-76403【迭代】更新日志-更新内容为空,报错Unparseable date: "null"

Merge in DESIGN/design from ~LINK.ZHAO/design:feature/x to feature/x

* commit '20add96662c17f9262a4c7536d6f2edde8c5180e':
  REPORT-76403【迭代】更新日志-更新内容为空,报错Unparseable date: "null" 1、处理下异常
  REPORT-76403【迭代】更新日志-更新内容为空,报错Unparseable date: "null" 1、规范下代码
  REPORT-76403【迭代】更新日志-更新内容为空,报错Unparseable date: "null" 1、兼容下本地缓存更新日志的逻辑
feature/x
Link.Zhao 2 years ago
parent
commit
de5e792bbe
  1. 13
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java

13
designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java

@ -87,7 +87,6 @@ public class UpdateMainDialog extends UIDialog {
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 UPDATE_INFO_TABLE_FORMAT = new SimpleDateFormat("yyyy.MM.dd");
@ -432,7 +431,7 @@ public class UpdateMainDialog extends UIDialog {
}
return array;
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
return JSONArray.create();
}
@ -449,7 +448,7 @@ public class UpdateMainDialog extends UIDialog {
updateCachedInfoFile(jsonArray);
} catch (Exception e) {
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();
File cacheFile = new File(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), "resources", "offlineres", cacheInfoPath));
if (!ComparatorUtils.equals(lastUpdateCacheState, "success")) {
@ -478,7 +477,7 @@ public class UpdateMainDialog extends UIDialog {
String[] updateInfo = readStr.split("\\t");
if (updateInfo.length == 2) {
updateTimeStr = updateInfo[0];
Date updateTime = CHANGELOG_FORMAT.parse(updateTimeStr);
Date updateTime = UPDATELOG_FORMAT.parse(updateTimeStr);
//形如 Build#release-2018.07.31.03.03.52.80
String currentNO = GeneralUtils.readBuildNO();
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)) {
for (int i = 0; i < jsonArray.length(); 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.flush();
}

Loading…
Cancel
Save