diff --git a/src/java/org/apache/commons/lang/Entities.java b/src/java/org/apache/commons/lang/Entities.java index 69b5195eb..9a6c8ff5c 100644 --- a/src/java/org/apache/commons/lang/Entities.java +++ b/src/java/org/apache/commons/lang/Entities.java @@ -795,7 +795,13 @@ class Entities { */ 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(); } @@ -837,32 +843,6 @@ class Entities { } } - /** - *
- * Escapes the characters in the String
passed and writes the result to the StringWriter
- * passed.
- *
StringWriter
to write the results of the escaping to. Assumed to be a non-null
- * value.
- * @param str
- * The String
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);
- }
- }
-
/**
*
* Unescapes the entities in a String
.
@@ -879,7 +859,13 @@ class Entities {
*/
public String unescape(String str) {
StringWriter stringWriter = createStringWriter(str);
- this.unescape(stringWriter, str);
+ try {
+ 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();
}
@@ -888,31 +874,6 @@ class Entities {
return new StringWriter((int) (str.length() + (str.length() * 0.1)));
}
- /**
- *
- * Unescapes the escaped entities in the String
passed and writes the result to the
- * StringWriter
passed.
- *
StringWriter
to write the results to; assumed to be non-null.
- * @param string
- * The String
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);
- } 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);
- }
- }
-
/**
*
* Unescapes the escaped entities in the String
passed and writes the result to the