From a574cb0b6de6a0c358581086c4e659707f2f8182 Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 28 Apr 2017 10:10:50 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-2343=20[=E4=BB=A3=E7=A0=81=E8=B4=A8?= =?UTF-8?q?=E9=87=8F]=3D>=E5=8E=BB=E6=8E=89=E5=A4=9A=E4=BD=99=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templateinfo/TemplateInfoCollector.java | 33 +------------------ 1 file changed, 1 insertion(+), 32 deletions(-) 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 1a06d82c3..17d785a43 100644 --- a/designer_base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java +++ b/designer_base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java @@ -8,8 +8,6 @@ import com.fr.design.mainframe.JTemplate; import com.fr.env.RemoteEnv; import com.fr.general.*; import com.fr.general.http.HttpClient; -import com.fr.json.JSONArray; -import com.fr.json.JSONException; import com.fr.stable.*; import com.fr.stable.xml.*; import com.fr.third.javax.xml.stream.XMLStreamException; @@ -19,7 +17,6 @@ import java.io.*; import java.text.SimpleDateFormat; import java.util.*; import java.util.HashMap; -import java.util.Iterator; /** * 做模板的过程和耗时收集,辅助类 @@ -177,40 +174,13 @@ public class TemplateInfoCollector implements Serializable, XM */ private void saveInfo() { try { - ByteArrayOutputStream out = new ByteArrayOutputStream(); + FileOutputStream out = new FileOutputStream(getInfoFile()); XMLTools.writeOutputStreamXML(this, out); - out.flush(); - out.close(); - String fileContent = new String(out.toByteArray(), EncodeConstants.ENCODING_UTF_8); - writeContentToFile(fileContent, getInfoFile()); } catch (Exception ex) { FRLogger.getLogger().error(ex.getMessage()); } } - /** - * 将文件内容写到输出流中 - */ - private static void writeContentToFile(String fileContent, File file){ - BufferedWriter bw = null; - try { - FileOutputStream fos = new FileOutputStream(file); - OutputStreamWriter osw = new OutputStreamWriter(fos, EncodeConstants.ENCODING_UTF_8); - bw = new BufferedWriter(osw); - bw.write(fileContent); - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage()); - } finally { - if(bw != null){ - try { - bw.close(); - } catch (IOException e) { - } - } - } - - } - /** * 更新 day_count:打开设计器却未编辑模板的连续日子 */ @@ -258,7 +228,6 @@ public class TemplateInfoCollector implements Serializable, XM // 保存模板时,让 day_count 归零 templateInfo.put(ATTR_DAY_COUNT, 0); - templateInfoList.put(templateID, templateInfo); saveInfo(); // 每次更新之后,都同步到暂存文件中