1. Deploy the attached portlet and add it to a page ("Test Preferences").
2. Enter "once upon a time" (two spaces between each word) into the text area and press "submit".
3. Go to the Communities portlet in the control panel and export the pages of the community.
4. Import the LAR generated into step 3.
5. Navigate back to the page where you added the portlet.
You will notice that the value in the text area is changed to "once upon a time" (one space between each word). This is due to a bug where the default pretty printer from DOM4J (which is used to format the XML exported to the LAR) trims whitespaces, causing Liferay to trim multiple space characters down to a single space character, so when the LAR is reimported, the extra spaces are lost.
To address the issue, we should setTrimText to false before formatting the XML.