You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2021/05/02 19:57:55 UTC

[maven-shared-utils] branch MSHARED-985 created (now 0e36497)

This is an automated email from the ASF dual-hosted git repository.

elharo pushed a change to branch MSHARED-985
in repository https://gitbox.apache.org/repos/asf/maven-shared-utils.git.


      at 0e36497  make XmlWriterUtil platform independent and consistent with its documentation

This branch includes the following new commits:

     new 0e36497  make XmlWriterUtil platform independent and consistent with its documentation

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[maven-shared-utils] 01/01: make XmlWriterUtil platform independent and consistent with its documentation

Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch MSHARED-985
in repository https://gitbox.apache.org/repos/asf/maven-shared-utils.git

commit 0e36497a78c5795aa8e844030d281b7df58c257b
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Sun May 2 15:57:38 2021 -0400

    make XmlWriterUtil platform independent and consistent with its documentation
---
 .../maven/shared/utils/xml/XmlWriterUtil.java      |  41 +++----
 .../maven/shared/utils/xml/XmlWriterUtilTest.java  | 118 ++++++++++-----------
 2 files changed, 81 insertions(+), 78 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/utils/xml/XmlWriterUtil.java b/src/main/java/org/apache/maven/shared/utils/xml/XmlWriterUtil.java
index d9dd49e..985b604 100644
--- a/src/main/java/org/apache/maven/shared/utils/xml/XmlWriterUtil.java
+++ b/src/main/java/org/apache/maven/shared/utils/xml/XmlWriterUtil.java
@@ -32,6 +32,9 @@ public class XmlWriterUtil
 {
     /** The vm line separator */
     public static final String LS = System.getProperty( "line.separator" );
+    
+    /** Platform independent line separator */
+    private static final String CRLF = "\r\n";
 
     /** The default line indenter size i.e. 2. */
     public static final int DEFAULT_INDENTATION_SIZE = 2;
@@ -43,7 +46,7 @@ public class XmlWriterUtil
      * Convenience method to write one <code>CRLF</code>.
      *
      * @param writer not null writer
-     * @throws IOException if writing fails.
+     * @throws IOException if writing fails
      */
     public static void writeLineBreak( XMLWriter writer ) throws IOException
     {
@@ -55,13 +58,13 @@ public class XmlWriterUtil
      *
      * @param writer not null
      * @param repeat positive number
-     * @throws IOException if writing fails.
+     * @throws IOException if writing fails
      */
     public static void writeLineBreak( XMLWriter writer, int repeat ) throws IOException
     {
         for ( int i = 0; i < repeat; i++ )
         {
-            writer.writeMarkup( LS );
+            writer.writeMarkup( CRLF );
         }
     }
 
@@ -73,7 +76,7 @@ public class XmlWriterUtil
      * @param indent positive number
      * @see #DEFAULT_INDENTATION_SIZE
      * @see #writeLineBreak(XMLWriter, int, int, int)
-     * @throws IOException if writing fails.
+     * @throws IOException if writing fails
      */
     public static void writeLineBreak( XMLWriter writer, int repeat, int indent ) throws IOException
     {
@@ -87,7 +90,7 @@ public class XmlWriterUtil
      * @param repeat The number of repetitions of the indent
      * @param indent positive number
      * @param indentSize positive number
-     * @throws IOException if writing fails.
+     * @throws IOException if writing fails
      */
     public static void writeLineBreak( XMLWriter writer, int repeat, int indent, int indentSize ) throws IOException
     {
@@ -112,7 +115,7 @@ public class XmlWriterUtil
      * @param writer not null
      * @see #DEFAULT_COLUMN_LINE
      * @see #writeCommentLineBreak(XMLWriter, int)
-     * @throws IOException if writing fails.
+     * @throws IOException if writing fails
      */
     public static void writeCommentLineBreak( XMLWriter writer ) throws IOException
     {
@@ -124,7 +127,7 @@ public class XmlWriterUtil
      *
      * @param writer not null
      * @param columnSize positive number
-     * @throws IOException if writing fails.
+     * @throws IOException if writing fails
      */
     public static void writeCommentLineBreak( XMLWriter writer, int columnSize ) throws IOException
     {
@@ -133,7 +136,7 @@ public class XmlWriterUtil
             columnSize = DEFAULT_COLUMN_LINE;
         }
 
-        writer.writeMarkup( "<!-- " + StringUtils.repeat( "=", columnSize - 10 ) + " -->" + LS );
+        writer.writeMarkup( "<!-- " + StringUtils.repeat( "=", columnSize - 10 ) + " -->" + CRLF );
     }
 
     /**
@@ -144,7 +147,7 @@ public class XmlWriterUtil
      * @param comment The comment to write
      * @see #DEFAULT_INDENTATION_SIZE
      * @see #writeComment(XMLWriter, String, int, int)
-     * @throws IOException if writing fails.
+     * @throws IOException if writing fails
      */
     public static void writeComment( XMLWriter writer, String comment ) throws IOException
     {
@@ -160,7 +163,7 @@ public class XmlWriterUtil
      * @param indent positive number
      * @see #DEFAULT_INDENTATION_SIZE
      * @see #writeComment(XMLWriter, String, int, int)
-     * @throws IOException if writing fails.
+     * @throws IOException if writing fails
      */
     public static void writeComment( XMLWriter writer, String comment, int indent ) throws IOException
     {
@@ -177,7 +180,7 @@ public class XmlWriterUtil
      * @param indentSize positive number
      * @see #DEFAULT_COLUMN_LINE
      * @see #writeComment(XMLWriter, String, int, int, int)
-     * @throws IOException if writing fails.
+     * @throws IOException if writing fails
      */
     public static void writeComment( XMLWriter writer, String comment, int indent, int indentSize ) throws IOException
     {
@@ -193,7 +196,7 @@ public class XmlWriterUtil
      * @param indent positive number
      * @param indentSize positive number
      * @param columnSize positive number
-     * @throws IOException if writing fails.
+     * @throws IOException if writing fails
      */
     public static void writeComment( XMLWriter writer, String comment, int indent, int indentSize, int columnSize )
         throws IOException
@@ -220,7 +223,7 @@ public class XmlWriterUtil
 
         String indentation = StringUtils.repeat( " ", indent * indentSize );
         int magicNumber = indentation.length() + columnSize - "-->".length() - 1;
-        String[] sentences = StringUtils.split( comment, LS );
+        String[] sentences = StringUtils.split( comment, CRLF );
 
         StringBuffer line = new StringBuffer( indentation + "<!-- " );
         for ( String sentence : sentences )
@@ -239,7 +242,7 @@ public class XmlWriterUtil
                             line.append( StringUtils.repeat( " ", magicNumber - line.length() ) );
                         }
 
-                        line.append( "-->" ).append( LS );
+                        line.append( "-->" ).append( CRLF );
                         writer.writeMarkup( line.toString() );
                     }
                     line = new StringBuffer( indentation + "<!-- " );
@@ -262,7 +265,7 @@ public class XmlWriterUtil
             line.append( StringUtils.repeat( " ", magicNumber - line.length() ) );
         }
 
-        line.append( "-->" ).append( LS );
+        line.append( "-->" ).append( CRLF );
 
         writer.writeMarkup( line.toString() );
     }
@@ -275,7 +278,7 @@ public class XmlWriterUtil
      * @param comment The comment to write
      * @see #DEFAULT_INDENTATION_SIZE
      * @see #writeCommentText(XMLWriter, String, int, int)
-     * @throws IOException if writing fails.
+     * @throws IOException if writing fails
      */
     public static void writeCommentText( XMLWriter writer, String comment ) throws IOException
     {
@@ -292,7 +295,7 @@ public class XmlWriterUtil
      * @param indent positive number
      * @see #DEFAULT_INDENTATION_SIZE
      * @see #writeCommentText(XMLWriter, String, int, int)
-     * @throws IOException if writing fails.
+     * @throws IOException if writing fails
      */
     public static void writeCommentText( XMLWriter writer, String comment, int indent ) throws IOException
     {
@@ -309,7 +312,7 @@ public class XmlWriterUtil
      * @param indentSize positive number
      * @see #DEFAULT_COLUMN_LINE
      * @see #writeCommentText(XMLWriter, String, int, int, int)
-     * @throws IOException if writing fails.
+     * @throws IOException if writing fails
      */
     public static void writeCommentText( XMLWriter writer, String comment, int indent, int indentSize )
         throws IOException
@@ -327,7 +330,7 @@ public class XmlWriterUtil
      * @param indent positive number
      * @param indentSize positive number
      * @param columnSize positive number
-     * @throws IOException if writing fails.
+     * @throws IOException if writing fails
      */
     public static void writeCommentText( XMLWriter writer, String comment, int indent, int indentSize, int columnSize )
         throws IOException
diff --git a/src/test/java/org/apache/maven/shared/utils/xml/XmlWriterUtilTest.java b/src/test/java/org/apache/maven/shared/utils/xml/XmlWriterUtilTest.java
index 9a050da..433e5fe 100644
--- a/src/test/java/org/apache/maven/shared/utils/xml/XmlWriterUtilTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/xml/XmlWriterUtilTest.java
@@ -62,7 +62,7 @@ public class XmlWriterUtilTest
     {
         XmlWriterUtil.writeLineBreak( xmlWriter );
         writer.close();
-        assertEquals( 1, StringUtils.countMatches( output.toString(), XmlWriterUtil.LS ) );
+        assertEquals( 1, StringUtils.countMatches( output.toString(), "\r\n" ) );
     }
 
     /**
@@ -75,7 +75,7 @@ public class XmlWriterUtilTest
     {
         XmlWriterUtil.writeLineBreak( xmlWriter, 10 );
         writer.close();
-        assertEquals( 10, StringUtils.countMatches( output.toString(), XmlWriterUtil.LS ) );
+        assertEquals( 10, StringUtils.countMatches( output.toString(), "\r\n" ) );
     }
 
     /**
@@ -88,7 +88,7 @@ public class XmlWriterUtilTest
     {
         XmlWriterUtil.writeLineBreak( xmlWriter, 10, 2 );
         writer.close();
-        assertEquals( 10, StringUtils.countMatches( output.toString(), XmlWriterUtil.LS ) );
+        assertEquals( 10, StringUtils.countMatches( output.toString(), "\r\n" ) );
         assertEquals( 1, StringUtils.countMatches( output.toString(), StringUtils
             .repeat( " ", 2 * XmlWriterUtil.DEFAULT_INDENTATION_SIZE ) ) );
     }
@@ -103,7 +103,7 @@ public class XmlWriterUtilTest
     {
         XmlWriterUtil.writeLineBreak( xmlWriter, 10, 2, 4 );
         writer.close();
-        assertEquals( 10, StringUtils.countMatches( output.toString(), XmlWriterUtil.LS ) );
+        assertEquals( 10, StringUtils.countMatches( output.toString(), "\r\n" ) );
         assertEquals( 1, StringUtils.countMatches( output.toString(), StringUtils.repeat( " ", 2 * 4 ) ) );
     }
 
@@ -118,9 +118,9 @@ public class XmlWriterUtilTest
         XmlWriterUtil.writeCommentLineBreak( xmlWriter );
         writer.close();
         StringBuilder sb = new StringBuilder();
-        sb.append( "<!-- ====================================================================== -->" ).append( XmlWriterUtil.LS );
+        sb.append( "<!-- ====================================================================== -->" ).append( "\r\n" );
         assertEquals( output.toString(), sb.toString() );
-        assertEquals( output.toString().length(), XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + XmlWriterUtil.LS.length() );
+        assertEquals( output.toString().length(), XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + "\r\n".length() );
     }
 
     /**
@@ -133,13 +133,13 @@ public class XmlWriterUtilTest
     {
         XmlWriterUtil.writeCommentLineBreak( xmlWriter, 20 );
         writer.close();
-        assertEquals( output.toString(), "<!-- ========== -->" + XmlWriterUtil.LS );
+        assertEquals( output.toString(), "<!-- ========== -->" + "\r\n" );
     }
 
     public void testWriteCommentLineBreak() throws IOException {
         XmlWriterUtil.writeCommentLineBreak( xmlWriter, 10 );
         writer.close();
-        assertEquals( output.toString(), output.toString(), "<!--  -->" + XmlWriterUtil.LS );
+        assertEquals( output.toString(), output.toString(), "<!--  -->" + "\r\n" );
     }
 
     /**
@@ -153,9 +153,9 @@ public class XmlWriterUtilTest
         XmlWriterUtil.writeComment( xmlWriter, "hello" );
         writer.close();
         StringBuffer sb = new StringBuffer();
-        sb.append( "<!-- hello                                                                  -->" ).append( XmlWriterUtil.LS );
+        sb.append( "<!-- hello                                                                  -->" ).append( "\r\n" );
         assertEquals( output.toString(), sb.toString() );
-        assertEquals( output.toString().length(), XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + XmlWriterUtil.LS.length() );
+        assertEquals( output.toString().length(), XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + "\r\n".length() );
     }
 
     
@@ -165,7 +165,7 @@ public class XmlWriterUtilTest
         writer.close();
         StringBuffer sb = new StringBuffer();
         sb.append( "<!-- hellooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo -->" )
-            .append( XmlWriterUtil.LS );
+            .append( "\r\n" );
         assertEquals( output.toString(), sb.toString() );
         assertTrue( output.toString().length() >= XmlWriterUtil.DEFAULT_COLUMN_LINE );
     }
@@ -174,10 +174,10 @@ public class XmlWriterUtilTest
         XmlWriterUtil.writeComment( xmlWriter, "hello\nworld" );
         writer.close();
         StringBuffer sb = new StringBuffer();
-        sb.append( "<!-- hello                                                                  -->" ).append( XmlWriterUtil.LS );
-        sb.append( "<!-- world                                                                  -->" ).append( XmlWriterUtil.LS );
+        sb.append( "<!-- hello                                                                  -->" ).append( "\r\n" );
+        sb.append( "<!-- world                                                                  -->" ).append( "\r\n" );
         assertEquals( output.toString(), sb.toString() );
-        assertEquals( output.toString().length(), 2 * ( XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + XmlWriterUtil.LS.length() ) );
+        assertEquals( output.toString().length(), 2 * ( XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + "\r\n".length() ) );
     }
 
     /**
@@ -194,9 +194,9 @@ public class XmlWriterUtilTest
         writer.close();
         StringBuffer sb = new StringBuffer();
         sb.append( indent );
-        sb.append( "<!-- hello                                                                  -->" ).append( XmlWriterUtil.LS );
+        sb.append( "<!-- hello                                                                  -->" ).append( "\r\n" );
         assertEquals( output.toString(), sb.toString() );
-        assertEquals( output.toString().length(), XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + XmlWriterUtil.LS.length() + 2
+        assertEquals( output.toString().length(), XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + "\r\n".length() + 2
             * XmlWriterUtil.DEFAULT_INDENTATION_SIZE );
 
     }
@@ -207,11 +207,11 @@ public class XmlWriterUtilTest
         writer.close();
         StringBuffer sb = new StringBuffer();
         sb.append( indent );
-        sb.append( "<!-- hello                                                                  -->" ).append( XmlWriterUtil.LS );
+        sb.append( "<!-- hello                                                                  -->" ).append( "\r\n" );
         sb.append( indent );
-        sb.append( "<!-- world                                                                  -->" ).append( XmlWriterUtil.LS );
+        sb.append( "<!-- world                                                                  -->" ).append( "\r\n" );
         assertEquals( output.toString(), sb.toString() );
-        assertEquals( output.toString().length(), 2 * ( XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + XmlWriterUtil.LS.length() ) + 2 * indent.length() );
+        assertEquals( output.toString().length(), 2 * ( XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + "\r\n".length() ) + 2 * indent.length() );
     }
 
     /**
@@ -228,9 +228,9 @@ public class XmlWriterUtilTest
         writer.close();
         StringBuffer sb = new StringBuffer();
         sb.append( repeat );
-        sb.append( "<!-- hello                                                                  -->" ).append( XmlWriterUtil.LS );
+        sb.append( "<!-- hello                                                                  -->" ).append( "\r\n" );
         assertEquals( output.toString(), sb.toString() );
-        assertEquals( output.toString().length(), XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + XmlWriterUtil.LS.length() + 2 * 4 );
+        assertEquals( output.toString().length(), XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + "\r\n".length() + 2 * 4 );
     }
     
     
@@ -240,11 +240,11 @@ public class XmlWriterUtilTest
         writer.close();
         StringBuffer sb = new StringBuffer();
         sb.append( repeat );
-        sb.append( "<!-- hello                                                                  -->" ).append( XmlWriterUtil.LS );
+        sb.append( "<!-- hello                                                                  -->" ).append( "\r\n" );
         sb.append( repeat );
-        sb.append( "<!-- world                                                                  -->" ).append( XmlWriterUtil.LS );
+        sb.append( "<!-- world                                                                  -->" ).append( "\r\n" );
         assertEquals( output.toString(), sb.toString() );
-        assertTrue( output.toString().length() == 2 * ( XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + XmlWriterUtil.LS.length() ) + 2 * repeat.length() );
+        assertTrue( output.toString().length() == 2 * ( XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + "\r\n".length() ) + 2 * repeat.length() );
     }
 
     /**
@@ -261,9 +261,9 @@ public class XmlWriterUtilTest
         writer.close();
         StringBuffer sb = new StringBuffer();
         sb.append( indent );
-        sb.append( "<!-- hello                                    -->" ).append( XmlWriterUtil.LS );
+        sb.append( "<!-- hello                                    -->" ).append( "\r\n" );
         assertEquals( output.toString(), sb.toString() );
-        assertTrue( output.toString().length() == 50 - 1 + XmlWriterUtil.LS.length() + 2 * 4 );
+        assertTrue( output.toString().length() == 50 - 1 + "\r\n".length() + 2 * 4 );
     }
     
     public void testWriteCommentXMLWriterStringIntIntInt_2() throws IOException
@@ -273,7 +273,7 @@ public class XmlWriterUtilTest
         writer.close();
         StringBuffer sb = new StringBuffer();
         sb.append( indent );
-        sb.append( "<!-- hello -->" ).append( XmlWriterUtil.LS );
+        sb.append( "<!-- hello -->" ).append( "\r\n" );
         assertEquals( output.toString(), sb.toString() );
         assertTrue( output.toString().length() >= 10 + 2 * 4 );
     }
@@ -289,13 +289,13 @@ public class XmlWriterUtilTest
         XmlWriterUtil.writeCommentText( xmlWriter, "hello", 0 );
         writer.close();
         StringBuffer sb = new StringBuffer();
-        sb.append( XmlWriterUtil.LS );
-        sb.append( "<!-- ====================================================================== -->" ).append( XmlWriterUtil.LS );
-        sb.append( "<!-- hello                                                                  -->" ).append( XmlWriterUtil.LS );
-        sb.append( "<!-- ====================================================================== -->" ).append( XmlWriterUtil.LS );
-        sb.append( XmlWriterUtil.LS );
+        sb.append( "\r\n" );
+        sb.append( "<!-- ====================================================================== -->" ).append( "\r\n" );
+        sb.append( "<!-- hello                                                                  -->" ).append( "\r\n" );
+        sb.append( "<!-- ====================================================================== -->" ).append( "\r\n" );
+        sb.append( "\r\n" );
         assertEquals( output.toString(), sb.toString() );
-        assertEquals( output.toString().length(), 3 * ( 80 - 1 + XmlWriterUtil.LS.length() ) + 2 * XmlWriterUtil.LS.length() );
+        assertEquals( output.toString().length(), 3 * ( 80 - 1 + "\r\n".length() ) + 2 * "\r\n".length() );
     }
     
     public void testWriteCommentTextXMLWriterStringInt_2() throws IOException {
@@ -305,20 +305,20 @@ public class XmlWriterUtilTest
             + "loooooooooooooooooooooooooooooooooooooooooooooooooooooonnnnnnnnnnong line", 2 );
         writer.close();
         StringBuffer sb = new StringBuffer();
-        sb.append( XmlWriterUtil.LS );
+        sb.append( "\r\n" );
         sb.append( indent ).append( "<!-- ====================================================================== -->" )
-            .append( XmlWriterUtil.LS );
+            .append( "\r\n" );
         sb.append( indent ).append( "<!-- hello world with end of line                                           -->" )
-            .append( XmlWriterUtil.LS );
+            .append( "\r\n" );
         sb.append( indent ).append( "<!-- and                                                                    -->" )
-            .append( XmlWriterUtil.LS );
+            .append( "\r\n" );
         sb.append( indent ).append( "<!-- loooooooooooooooooooooooooooooooooooooooooooooooooooooonnnnnnnnnnong   -->" )
-            .append( XmlWriterUtil.LS );
+            .append( "\r\n" );
         sb.append( indent ).append( "<!-- line                                                                   -->" )
-            .append( XmlWriterUtil.LS );
+            .append( "\r\n" );
         sb.append( indent ).append( "<!-- ====================================================================== -->" )
-            .append( XmlWriterUtil.LS );
-        sb.append( XmlWriterUtil.LS );
+            .append( "\r\n" );
+        sb.append( "\r\n" );
         sb.append( indent );
         assertEquals( output.toString(), sb.toString() );
     }
@@ -337,17 +337,17 @@ public class XmlWriterUtilTest
         XmlWriterUtil.writeCommentText( xmlWriter, "hello", 2, 4 );
         writer.close();
         StringBuilder sb = new StringBuilder();
-        sb.append( XmlWriterUtil.LS );
+        sb.append( "\r\n" );
         sb.append( indent ).append( "<!-- ====================================================================== -->" )
-            .append( XmlWriterUtil.LS );
+            .append( "\r\n" );
         sb.append( indent ).append( "<!-- hello                                                                  -->" )
-            .append( XmlWriterUtil.LS );
+            .append( "\r\n" );
         sb.append( indent ).append( "<!-- ====================================================================== -->" )
-            .append( XmlWriterUtil.LS );
-        sb.append( XmlWriterUtil.LS );
+            .append( "\r\n" );
+        sb.append( "\r\n" );
         sb.append( indent );
         assertEquals( output.toString(), sb.toString() );
-        assertEquals( output.toString().length(), 3 * ( 80 - 1 + XmlWriterUtil.LS.length() ) + 4 * 2 * 4 + 2 * XmlWriterUtil.LS.length() );
+        assertEquals( output.toString().length(), 3 * ( 80 - 1 + "\r\n".length() ) + 4 * 2 * 4 + 2 * "\r\n".length() );
     }
 
     /**
@@ -363,14 +363,14 @@ public class XmlWriterUtilTest
         XmlWriterUtil.writeCommentText( xmlWriter, "hello", 2, 4, 50 );
         writer.close();
         StringBuilder sb = new StringBuilder();
-        sb.append( XmlWriterUtil.LS );
-        sb.append( indent ).append( "<!-- ======================================== -->" ).append( XmlWriterUtil.LS );
-        sb.append( indent ).append( "<!-- hello                                    -->" ).append( XmlWriterUtil.LS );
-        sb.append( indent ).append( "<!-- ======================================== -->" ).append( XmlWriterUtil.LS );
-        sb.append( XmlWriterUtil.LS );
+        sb.append( "\r\n" );
+        sb.append( indent ).append( "<!-- ======================================== -->" ).append( "\r\n" );
+        sb.append( indent ).append( "<!-- hello                                    -->" ).append( "\r\n" );
+        sb.append( indent ).append( "<!-- ======================================== -->" ).append( "\r\n" );
+        sb.append( "\r\n" );
         sb.append( indent );
         assertEquals( output.toString(), sb.toString() );
-        assertEquals( output.toString().length(), 3 * ( 50 - 1 + XmlWriterUtil.LS.length() ) + 4 * 2 * 4 + 2 * XmlWriterUtil.LS.length() );
+        assertEquals( output.toString().length(), 3 * ( 50 - 1 + "\r\n".length() ) + 4 * 2 * 4 + 2 * "\r\n".length() );
     }
 
     /**
@@ -384,7 +384,7 @@ public class XmlWriterUtilTest
         XmlWriterUtil.writeComment( xmlWriter, null );
         writer.close();
         StringBuilder sb = new StringBuilder();
-        sb.append( "<!-- null                                                                   -->" ).append( XmlWriterUtil.LS );
+        sb.append( "<!-- null                                                                   -->" ).append( "\r\n" );
         assertEquals( output.toString(), sb.toString() );
     }
 
@@ -399,7 +399,7 @@ public class XmlWriterUtilTest
         XmlWriterUtil.writeComment( xmlWriter, "This is a short text" );
         writer.close();
         StringBuilder sb = new StringBuilder();
-        sb.append( "<!-- This is a short text                                                   -->" ).append( XmlWriterUtil.LS );
+        sb.append( "<!-- This is a short text                                                   -->" ).append( "\r\n" );
         assertEquals( output.toString(), sb.toString() );
     }
 
@@ -416,10 +416,10 @@ public class XmlWriterUtilTest
             + "and documentation from a central piece of information." );
         writer.close();
         StringBuilder sb = new StringBuilder();
-        sb.append( "<!-- Maven is a software project management and comprehension tool. Based   -->" ).append( XmlWriterUtil.LS );
-        sb.append( "<!-- on the concept of a project object model (POM), Maven can manage a     -->" ).append( XmlWriterUtil.LS );
-        sb.append( "<!-- project's build, reporting and documentation from a central piece of   -->" ).append( XmlWriterUtil.LS );
-        sb.append( "<!-- information.                                                           -->" ).append( XmlWriterUtil.LS );
+        sb.append( "<!-- Maven is a software project management and comprehension tool. Based   -->" ).append( "\r\n" );
+        sb.append( "<!-- on the concept of a project object model (POM), Maven can manage a     -->" ).append( "\r\n" );
+        sb.append( "<!-- project's build, reporting and documentation from a central piece of   -->" ).append( "\r\n" );
+        sb.append( "<!-- information.                                                           -->" ).append( "\r\n" );
         assertEquals( output.toString(), sb.toString() );
     }
 }