Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 329326

Summary: OPTION_FORMATTED does not work for final line break
Product: [Modeling] EMF Reporter: David Michonneau <davidmichonneau>
Component: XML/XMIAssignee: Ed Merks <Ed.Merks>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows Server 2003   
Whiteboard:

Description David Michonneau CLA 2010-11-03 04:50:05 EDT
Build Identifier: M20080911-1700

The serialization OPTION_FORMATTED in XMI does not remove the last line break. This prevents to have a cross-platform identical serialization (as unix and windows will either use \r\n or \n for the line break)

Reproducible: Always

Steps to Reproduce:
1. Use XMIResourceImpl and set OPTION_FORMATTED to false
2. Serialize an EObject
3. There is a \r\n at the end of the serialized stream. There should be no line break characters.
Comment 1 Ed Merks CLA 2010-11-05 07:51:28 EDT
I'm not sure it's a good idea to try to produce a serialization without a line terminator on the last line.  Most editors would not produce such a result and will add such a character as soon as you try to edit a file without it.  Also, I can imagine changing this behavior adversely affecting existing clients too.  Looking closely, the xml header is on a different line too, so I'm not sure how removing the final linebreak is a good thing.

The whole point of this option was to eliminate the large amount of whitespace, i.e., to reduce significantly the number of bytes that need to be transmitted, not to produce a result that's the same across platforms because it includes no line separators.