snagy 01/03/12 10:39:35
Modified: src/java/org/apache/ecs ConcreteElement.java
Log:
The attached diff fixes end of line handling while pretty printing, so that
it is correctly uses the line.separator system property to determine end of
line, instead of using a hard coded '\n'.
Could someone take a look at this and commit it.
Thanks,
Magnus Thor Torfason
Submitted by: Magnus Thor Torfason [EMAIL PROTECTED]
Revision Changes Path
1.24 +11 -8 jakarta-ecs/src/java/org/apache/ecs/ConcreteElement.java
Index: ConcreteElement.java
===================================================================
RCS file: /home/cvs/jakarta-ecs/src/java/org/apache/ecs/ConcreteElement.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- ConcreteElement.java 2000/01/26 00:16:09 1.23
+++ ConcreteElement.java 2001/03/12 18:39:34 1.24
@@ -69,12 +69,15 @@
This class is to be subclassed by those elements that are made up of
other elements. i.e. BODY,HEAD,etc.
- @version $Id: ConcreteElement.java,v 1.23 2000/01/26 00:16:09 jonbolt Exp $
+ @version $Id: ConcreteElement.java,v 1.24 2001/03/12 18:39:34 snagy Exp $
@author <a href="mailto:[EMAIL PROTECTED]">Stephan Nagy</a>
@author <a href="mailto:[EMAIL PROTECTED]">Jon S. Stevens</a>
*/
public class ConcreteElement extends ElementAttributes implements Cloneable
{
+ /** The line separator to use for pretty printing */
+ private static String lineSeparator = System.getProperty("line.separator");
+
/** @serial registry registry */
private Hashtable registry = new Hashtable(4); // keep a list of elements that
need to be added to the element
/** Maintain an ordered list of elements */
@@ -315,7 +318,7 @@
{
if ( getNeedLineBreak() )
{
- out.write('\n');
+
out.write(lineSeparator.getBytes());
e.setTabLevel(tabLevel +
1);
}
}
@@ -327,7 +330,7 @@
{
if ( getNeedLineBreak() )
{
- out.write('\n');
+ out.write(lineSeparator.getBytes());
putTabs(tabLevel + 1, out);
}
}
@@ -341,7 +344,7 @@
{
if ( getNeedLineBreak() )
{
- out.write('\n');
+ out.write(lineSeparator.getBytes());
if (tabLevel > 0)
putTabs(tabLevel, out);
}
@@ -363,7 +366,7 @@
{
output ( new PrintWriter(out) );
}
-
+
/**
Override output(BufferedWriter) incase any elements are in the registry.
@param output OutputStream to write to.
@@ -399,7 +402,7 @@
if (prettyPrint && this instanceof Printable)
{
if (getNeedLineBreak()) {
- out.write('\n');
+ out.write(lineSeparator);
e.setTabLevel(tabLevel + 1);
}
}
@@ -410,7 +413,7 @@
if (prettyPrint && this instanceof Printable)
{
if (getNeedLineBreak()) {
- out.write('\n');
+ out.write(lineSeparator);
putTabs(tabLevel + 1, out);
}
}
@@ -426,7 +429,7 @@
if (prettyPrint && this instanceof Printable)
{
if (getNeedLineBreak()) {
- out.write('\n');
+ out.write(lineSeparator);
if (tabLevel > 0)
putTabs(tabLevel, out);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]