svn commit: r16065 - branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/persistence/DiagramMemberFilePersister.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: linus
Date: 2008-11-18 14:00:15-0800
New Revision: 16065

Modified:
   branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/persistence/DiagramMemberFilePersister.java

Log:
Issue 5434: Merging Toms patch from trunk into the branch.

Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/persistence/DiagramMemberFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/persistence/DiagramMemberFilePersister.java?view=diff&rev=16065&p1=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/persistence/DiagramMemberFilePersister.java&p2=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/persistence/DiagramMemberFilePersister.java&r1=16064&r2=16065
==============================================================================
--- branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/persistence/DiagramMemberFilePersister.java	(original)
+++ branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/persistence/DiagramMemberFilePersister.java	2008-11-18 14:00:15-0800
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Copyright (c) 1996-2008 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -29,10 +29,13 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
 import java.io.Writer;
 import java.net.URL;
 
+import org.argouml.application.api.Argo;
 import org.argouml.kernel.Project;
 import org.argouml.kernel.ProjectMember;
 import org.argouml.uml.diagram.ProjectMemberDiagram;
@@ -138,14 +141,21 @@
         } catch (ExpansionException e) {
             throw new SaveException(e);
         }
-        PrintWriter pw = new PrintWriter(outStream);
+        OutputStreamWriter outputWriter;
+        try {
+            outputWriter = 
+                new OutputStreamWriter(outStream, Argo.getEncoding());
+        } catch (UnsupportedEncodingException e1) {
+            throw new SaveException("Bad encoding", e1);
+        }
+        PrintWriter printWriter = new PrintWriter(outputWriter);
         try {
             // WARNING: the OutputStream version of this doesn't work! - tfm
-            expander.expand(pw, diagramMember.getDiagram());
+            expander.expand(printWriter, diagramMember.getDiagram());
         } catch (ExpansionException e) {
             throw new SaveException(e);
         } finally {
-            pw.flush();
+            printWriter.flush();
         }
         
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.