From: <wan...@us...> - 2003-07-17 21:14:27
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/util In directory sc8-pr-cvs1:/tmp/cvs-serv29619 Modified Files: HTMLEscaper.java Log Message: Fix to allow null strings to be parsed, resulting in null. Index: HTMLEscaper.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/util/HTMLEscaper.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** HTMLEscaper.java 12 Jun 2003 00:47:48 -0000 1.7 --- HTMLEscaper.java 17 Jul 2003 21:14:24 -0000 1.8 *************** *** 31,53 **** /** - * A little bit of unit testing - */ - public static void main (String[] args) - { - - String text = - "This is a test of the html escaper & let's hope it really, " + - "really <B><I>works</I></B>! Is there an \u00f7 with an umlaut in the house?" + - "This code is \u00a9copyleft. I like to be paid in \u00fa\u00fa\u00fas"; - - System.out.println("NOTE: Due to differences in ASCII fonts, the text " + - "sent to the escaper may not display properly. Hopefully you will be " + - "able to tell what it should have looked like from the escaped output."); - System.out.println("in: " + text); - - System.out.println("out: " + escape(text)); - } - - /** * This method will take the input and escape characters that have * an HTML entity representation. --- 31,34 ---- *************** *** 59,62 **** --- 40,46 ---- public static final String escape (String nonHTMLsrc) { + if (nonHTMLsrc == null) + return null; + StringBuffer res = new StringBuffer(); int l = nonHTMLsrc.length(); |