From ec76806d476de5ea50ceb6fed066ace0ae910e7a Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 5 Apr 2017 15:42:49 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-1916=20=E6=A8=A1=E6=9D=BF=E8=80=97?= =?UTF-8?q?=E6=97=B6=3D=E3=80=8B=E8=A7=A3=E5=86=B3=E5=8F=A6=E5=AD=98?= =?UTF-8?q?=E4=B8=BA=E4=B8=8D=E4=BA=A7=E7=94=9F=E6=96=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=9A=84bug=EF=BC=9B=E5=BD=93id=E4=B8=BAnull=E6=97=B6=EF=BC=88?= =?UTF-8?q?=E6=97=A7=E6=A8=A1=E6=9D=BF=EF=BC=89=EF=BC=8C=E4=B8=8D=E6=90=9C?= =?UTF-8?q?=E9=9B=86=E6=95=B0=E6=8D=AE=EF=BC=9B=E8=B0=83=E6=95=B4=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=89=93=E5=8D=B0=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/mainframe/JTemplate.java | 9 +++++---- .../mainframe/templateinfo/TemplateInfoCollector.java | 9 ++++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/JTemplate.java b/designer_base/src/com/fr/design/mainframe/JTemplate.java index b0b9f7b5a9..d6dc2f0b16 100644 --- a/designer_base/src/com/fr/design/mainframe/JTemplate.java +++ b/designer_base/src/com/fr/design/mainframe/JTemplate.java @@ -111,14 +111,15 @@ public abstract class JTemplate> ex // 为收集模版信息作准备 private void initForCollect() { - if (template.getTemplateID() == null) { - template.initTemplateID(); // 为新模板设置 templateID 属性 - } + template.initTemplateID(); // 为新模板设置 templateID 属性 if (openTime == 0) { openTime = System.currentTimeMillis(); } } private void collectInfo() { // 执行收集操作 + if (template.getTemplateID() == null) { // 旧模板 + return; + } long saveTime = System.currentTimeMillis(); // 保存模板的时间点 tic.collectInfo(template, this, openTime, saveTime); openTime = saveTime; // 更新 openTime,准备下一次计算 @@ -533,7 +534,7 @@ public abstract class JTemplate> ex boolean result = this.saveFile(); if (result) { DesignerFrameFileDealerPane.getInstance().refresh(); - initForCollect(); // 如果是旧模板另存为新模板,则添加 templateID + initForCollect(); // 如果另存为新模板,则添加 templateID collectInfo(); } //更换最近打开 diff --git a/designer_base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java b/designer_base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java index 4f7069205c..39a7e22abd 100644 --- a/designer_base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java +++ b/designer_base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java @@ -113,7 +113,14 @@ public class TemplateInfoCollector implements Serializable { private void saveInfo() { try { ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(getInfoFile())); - FRLogger.getLogger().info("writing: " + instance.templateInfoList); + String log = ""; + int count = 1; + for (String key : templateInfoList.keySet()) { + String createTime = ((HashMap)templateInfoList.get(key).get("consumingMap")).get("create_time").toString(); + log += (count + ". id: " + key + " " + createTime + "\n" + templateInfoList.get(key).toString() + "\n"); + count ++; + } + FRLogger.getLogger().info("writing tplInfo: \n" + log); os.writeObject(instance); os.close(); } catch (Exception ex) {