rsitze 2002/06/04 15:07:59
Modified: java/src/org/apache/axis/utils DOM2Writer.java CLUtil.java
Log:
Cleanup use of literals and system properties
Revision Changes Path
1.8 +15 -12 xml-axis/java/src/org/apache/axis/utils/DOM2Writer.java
Index: DOM2Writer.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/DOM2Writer.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DOM2Writer.java 30 Oct 2001 16:46:41 -0000 1.7
+++ DOM2Writer.java 4 Jun 2002 22:07:59 -0000 1.8
@@ -83,11 +83,14 @@
*/
private static String NS_URI_XMLNS = "http://www.w3.org/2000/xmlns/";
+ private static final char NL = '\n';
+ private static final char CR = '\r';
+
/**
* The prefered line separator
*/
- private static final String lineSeparator =
- System.getProperty("line.separator",
"\n");
+ private static final String LS = System.getProperty("line.separator",
+ (new
Character(NL)).toString());
/**
* Return a string containing this node serialized as XML.
@@ -245,7 +248,7 @@
{
out.print('>');
if (pretty)
- out.print(lineSeparator);
+ out.print(LS);
}
for (int i = 0; i < numChildren; i++)
@@ -263,7 +266,7 @@
{
out.print("/>");
if (pretty)
- out.print(lineSeparator);
+ out.print(LS);
}
break;
}
@@ -296,7 +299,7 @@
out.print(node.getNodeValue());
out.print("-->");
if (pretty)
- out.print(lineSeparator);
+ out.print(LS);
break;
}
@@ -315,7 +318,7 @@
out.println("?>");
if (pretty)
- out.print(lineSeparator);
+ out.print(LS);
break;
}
}
@@ -330,7 +333,7 @@
out.print(node.getNodeName());
out.print('>');
if (pretty)
- out.print(lineSeparator);
+ out.print(LS);
hasChildren = false;
}
}
@@ -410,24 +413,24 @@
str.append(""");
break;
}
- case '\n' :
+ case NL :
{
if (i > 0)
{
char lastChar = str.charAt(str.length() - 1);
- if (lastChar != '\r')
+ if (lastChar != CR)
{
- str.append(lineSeparator);
+ str.append(LS);
}
else
{
- str.append('\n');
+ str.append(NL);
}
}
else
{
- str.append(lineSeparator);
+ str.append(LS);
}
break;
}
1.2 +5 -4 xml-axis/java/src/org/apache/axis/utils/CLUtil.java
Index: CLUtil.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/CLUtil.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CLUtil.java 19 Mar 2002 15:42:01 -0000 1.1
+++ CLUtil.java 4 Jun 2002 22:07:59 -0000 1.2
@@ -18,6 +18,8 @@
public final class CLUtil
{
private final static int MAX_DESCRIPTION_COLUMN_LENGTH = 60;
+
+ private static final String LS = System.getProperty( "line.separator" );
/**
* Format options into StringBuffer and return. This is typically used to
@@ -28,7 +30,6 @@
*/
public final static StringBuffer describeOptions( final CLOptionDescriptor[]
options )
{
- final String lSep = System.getProperty( "line.separator" );
final StringBuffer sb = new StringBuffer();
for( int i = 0; i < options.length; i++ )
@@ -73,7 +74,7 @@
{
sb.append("=<value>");
}
- sb.append( lSep );
+ sb.append( LS );
}
if( null != description )
@@ -86,12 +87,12 @@
description.substring( MAX_DESCRIPTION_COLUMN_LENGTH );
sb.append( "\t\t" );
sb.append( descriptionPart );
- sb.append( lSep );
+ sb.append( LS );
}
sb.append( "\t\t" );
sb.append( description );
- sb.append( lSep );
+ sb.append( LS );
}
}
return sb;