Author: bayard
Date: Tue Feb 6 14:04:01 2007
New Revision: 504319
URL: http://svn.apache.org/viewvc?view=rev&rev=504319
Log:
I don't know why we declared new escape(StringWriter, String) methods. I've
removed these and inlined their code into the escape(String, String) type
methods
Modified:
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/Entities.java
Modified:
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/Entities.java
URL:
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/Entities.java?view=diff&rev=504319&r1=504318&r2=504319
==============================================================================
---
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/Entities.java
(original)
+++
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/Entities.java
Tue Feb 6 14:04:01 2007
@@ -795,7 +795,13 @@
*/
public String escape(String str) {
StringWriter stringWriter = createStringWriter(str);
- this.escape(stringWriter, str);
+ try {
+ this.escape(stringWriter, str);
+ } catch (IOException e) {
+ // This should never happen because ALL the StringWriter methods
called by #escape(Writer, String) do not
+ // throw IOExceptions.
+ throw new UnhandledException(e);
+ }
return stringWriter.toString();
}
@@ -839,32 +845,6 @@
/**
* <p>
- * Escapes the characters in the <code>String</code> passed and writes the
result to the <code>StringWriter</code>
- * passed.
- * </p>
- *
- * @param writer
- * The <code>StringWriter</code> to write the results of the
escaping to. Assumed to be a non-null
- * value.
- * @param str
- * The <code>String</code> to escape. Assumed to be a non-null
value.
- *
- * @see #escape(String)
- * @see Writer
- * @since 2.3
- */
- public void escape(StringWriter writer, String str) {
- try {
- this.escape((Writer) writer, str);
- } catch (IOException e) {
- // This should never happen because ALL the StringWriter methods
called by #escape(Writer, String) do not
- // throw IOExceptions.
- throw new UnhandledException(e);
- }
- }
-
- /**
- * <p>
* Unescapes the entities in a <code>String</code>.
* </p>
*
@@ -879,38 +859,19 @@
*/
public String unescape(String str) {
StringWriter stringWriter = createStringWriter(str);
- this.unescape(stringWriter, str);
- return stringWriter.toString();
- }
-
- private StringWriter createStringWriter(String str) {
- // Make the StringWriter 10% larger than the source String to avoid
growing the writer
- return new StringWriter((int) (str.length() + (str.length() * 0.1)));
- }
-
- /**
- * <p>
- * Unescapes the escaped entities in the <code>String</code> passed and
writes the result to the
- * <code>StringWriter</code> passed.
- * </p>
- *
- * @param writer
- * The <code>StringWriter</code> to write the results to;
assumed to be non-null.
- * @param string
- * The <code>String</code> to write the results to; assumed to
be non-null.
- *
- * @see #escape(String)
- * @see Writer
- * @since 2.3
- */
- public void unescape(StringWriter writer, String string) {
try {
- this.unescape((Writer) writer, string);
+ this.unescape(stringWriter, str);
} catch (IOException e) {
// This should never happen because ALL the StringWriter methods
called by #escape(Writer, String) do not
// throw IOExceptions.
throw new UnhandledException(e);
}
+ return stringWriter.toString();
+ }
+
+ private StringWriter createStringWriter(String str) {
+ // Make the StringWriter 10% larger than the source String to avoid
growing the writer
+ return new StringWriter((int) (str.length() + (str.length() * 0.1)));
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]