svn commit: r16876 - trunk/src/argouml-app/src/org/argouml/persistence/UmlFilePersister.java

Thomas Neustupny <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: thn
Date: 2009-03-09 14:02:43-0700
New Revision: 16876

Modified:
   trunk/src/argouml-app/src/org/argouml/persistence/UmlFilePersister.java

Log:
fix for issue 5720: .uml: mess with newlines causes load error

Modified: trunk/src/argouml-app/src/org/argouml/persistence/UmlFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/persistence/UmlFilePersister.java?view=diff&pathrev=16876&r1=16875&r2=16876
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/persistence/UmlFilePersister.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/persistence/UmlFilePersister.java	2009-03-09 14:02:43-0700
@@ -774,7 +774,15 @@
             
             Matcher matcher = xmlDeclarationPattern.matcher(outCB);
             // Remove anything that matches our pattern
-            String headerRemainder = matcher.replaceAll("").trim() + '\n';
+            String headerRemainder = matcher.replaceAll("");
+            int index = headerRemainder.length() - 1;
+            if (headerRemainder.charAt(index) == '\0') {
+                // Remove null characters at the end
+                do {
+                    index--;
+                } while (index >= 0 && headerRemainder.charAt(index) == '\0');
+                headerRemainder = headerRemainder.substring(0, index + 1);
+            }
 
             // Reencode the remaining characters as bytes again
             ByteBuffer bb = decoder.charset().encode(headerRemainder);

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=1298871

To unsubscribe from this discussion, e-mail: [[email protected]].
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.