[Jiemamy-notify:1432] commit [2661] シリアライズストリームまわりの修正。ロックしてた。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 2月 13日 (金) 01:42:07 JST


Revision: 2661
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2661
Author:   daisuke_m
Date:     2009-02-13 01:42:07 +0900 (Fri, 13 Feb 2009)

Log Message:
-----------
シリアライズストリームまわりの修正。ロックしてた。

Modified Paths:
--------------
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/wizard/NewDiagramWizard.java


-------------- next part --------------
Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/wizard/NewDiagramWizard.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/wizard/NewDiagramWizard.java	2009-02-12 16:23:18 UTC (rev 2660)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/wizard/NewDiagramWizard.java	2009-02-12 16:42:07 UTC (rev 2661)
@@ -18,10 +18,11 @@
  */
 package org.jiemamy.eclipse.wizard;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
 
+import org.apache.commons.io.IOUtils;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
@@ -139,18 +140,17 @@
 			Jiemamy jiemamy = JiemamyPlugin.getJiemamy();
 			RootModel rootModel = jiemamy.getFactory().getRootModel();
 			
+			ByteArrayOutputStream out = null;
 			try {
-				PipedInputStream in = new PipedInputStream();
-				PipedOutputStream out = new PipedOutputStream(in);
-				
+				out = new ByteArrayOutputStream();
 				jiemamy.getSerializer().serialize(rootModel, out);
 				
-				out.close();
-				
-				return in;
+				return new ByteArrayInputStream(out.toByteArray());
 			} catch (Exception e) {
 				ExceptionHandler.handleException(e);
 				return null;
+			} finally {
+				IOUtils.closeQuietly(out);
 			}
 		}
 		



Jiemamy-notify メーリングリストの案内
Back to archive index