Skip to content

Commit 4d546b5

Browse files
committed
Fixed JavaDoc
1 parent d72d0d9 commit 4d546b5

File tree

2 files changed

+67
-67
lines changed

2 files changed

+67
-67
lines changed

core/src/main/java/org/owasp/encoder/Encode.java

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* Encode -- fluent interface for contextual encoding. Example usage in a JSP:
4444
*
4545
* <pre>
46-
* &lt;input value="&lt;%=Encode.forHtml(value)%>" />
46+
* &lt;input value="&lt;%=Encode.forHtml(value)%&gt;" /&gt;
4747
* </pre>
4848
*
4949
* <p>There are two versions of each contextual encoding method. The first
@@ -71,15 +71,15 @@ private Encode() {}
7171
* bytes or are writing a framework that utilizes this
7272
* package.</p>
7373
*
74-
* <h5>Example JSP Usage</h5>
74+
* <b>Example JSP Usage</b>
7575
* <pre>
76-
* &lt;div>&lt;%=Encode.forHtml(unsafeData)%>&lt;/div>
76+
* &lt;div&gt;&lt;%=Encode.forHtml(unsafeData)%&gt;&lt;/div&gt;
7777
*
78-
* &lt;input value="&lt;%=Encode.forHtml(unsafeData)%>" />
78+
* &lt;input value="&lt;%=Encode.forHtml(unsafeData)%&gt;" /&gt;
7979
* </pre>
8080
*
81-
* <h5>Encoding Table</h5>
82-
* <table border="0">
81+
* <table border="0" summary="Shows the input and results of encoding">
82+
* <caption><b>Encoding&nbsp;Table</b></caption>
8383
* <thead>
8484
* <tr bgcolor="#ccf">
8585
* <th align="left">Input</th>
@@ -110,7 +110,7 @@ private Encode() {}
110110
* </tbody>
111111
* </table>
112112
*
113-
* <h5>Additional Notes</h5>
113+
* <b>Additional Notes</b>
114114
* <ul>
115115
*
116116
* <li>The encoding of the greater-than sign ({@code >}) is not
@@ -160,12 +160,12 @@ public static void forHtml(Writer out, String input) throws IOException {
160160
* HTML attributes. Use either forHtml or forHtmlAttribute for those
161161
* methods.</p>
162162
*
163-
* <h5>Example JSP Usage</h5>
163+
* <b>Example JSP Usage</b>
164164
* <pre>
165-
* &lt;div>&lt;%=Encode.forHtmlContent(unsafeData)%>&lt;/div>
165+
* &lt;div&gt;&lt;%=Encode.forHtmlContent(unsafeData)%&gt;&lt;/div&gt;
166166
* </pre>
167-
* <h5>Encoding Table</h5>
168-
* <table border="0">
167+
* <table border="0" summary="Shows the input and results of encoding">
168+
* <caption><b>Encoding Table</b></caption>
169169
* <thead>
170170
* <tr bgcolor="#ccf">
171171
* <th align="left">Input</th>
@@ -188,7 +188,7 @@ public static void forHtml(Writer out, String input) throws IOException {
188188
* </tbody>
189189
* </table>
190190
*
191-
* <h5>Additional Notes</h5>
191+
* <b>Additional Notes</b>
192192
* <ul>
193193
*
194194
* <li>Single-quote character ({@code '}) and double-quote
@@ -238,13 +238,13 @@ public static void forHtmlContent(Writer out, String input)
238238
/**
239239
* <p>This method encodes for HTML text attributes.</p>
240240
*
241-
* <h5>Example JSP Usage</h5>
241+
* <b>Example JSP Usage</b>
242242
* <pre>
243-
* &lt;div>&lt;%=Encode.forHtml(unsafeData)%>&lt;/div>
243+
* &lt;div&gt;&lt;%=Encode.forHtml(unsafeData)%&gt;&lt;/div&gt;
244244
* </pre>
245245
*
246-
* <h5>Encoding Table</h5>
247-
* <table border="0">
246+
* <table border="0" summary="Shows the input and results of encoding">
247+
* <caption><b>Encoding Table</b></caption>
248248
* <thead>
249249
* <tr bgcolor="#ccf">
250250
* <th align="left">Input</th>
@@ -271,7 +271,7 @@ public static void forHtmlContent(Writer out, String input)
271271
* </tbody>
272272
* </table>
273273
*
274-
* <h5>Additional Notes</h5>
274+
* <b>Additional Notes</b>
275275
* <ul>
276276
*
277277
* <li>Both the single-quote character ({@code '}) and the
@@ -339,13 +339,13 @@ public static void forHtmlAttribute(Writer out, String input)
339339
* attempt has been made to optimize this encoding, though it is
340340
* still probably faster than other encoding libraries.</p>
341341
*
342-
* <h5>Example JSP Usage</h5>
342+
* <b>Example JSP Usage</b>
343343
* <pre>
344-
* &lt;input value=&lt;%=Encode.forHtmlUnquotedAttribute(input)%> >
344+
* &lt;input value=&lt;%=Encode.forHtmlUnquotedAttribute(input)%&gt; &gt;
345345
* </pre>
346346
*
347-
* <h5>Encoding Table</h5>
348-
* <table border="0">
347+
* <table border="0" summary="Shows the input and results of encoding">
348+
* <caption><b>Encoding Table</b></caption>
349349
* <thead>
350350
* <tr bgcolor="#ccf">
351351
* <th align="left">Input</th>
@@ -372,7 +372,7 @@ public static void forHtmlAttribute(Writer out, String input)
372372
* </tbody>
373373
* </table>
374374
*
375-
* <h5>Additional Notes</h5>
375+
* <b>Additional Notes</b>
376376
* <ul>
377377
*
378378
* <li>The following characters are <i>not</i> encoded:
@@ -436,16 +436,16 @@ public static void forHtmlUnquotedAttribute(Writer out, String input)
436436
* characters. It is safe for use in both style blocks and attributes in
437437
* HTML.
438438
*
439-
* <h5>Example JSP Usage</h5>
439+
* <b>Example JSP Usage</b>
440440
* <pre>
441-
* &lt;div style="background: url('&lt;=Encode.forCssString(...)%>');">
441+
* &lt;div style="background: url('&lt;=Encode.forCssString(...)%&gt;');"&gt;
442442
*
443-
* &lt;style type="text/css">
444-
* background: url('&lt;%=Encode.forCssString(...)%>');
445-
* &lt;/style>
443+
* &lt;style type="text/css"&gt;
444+
* background: url('&lt;%=Encode.forCssString(...)%&gt;');
445+
* &lt;/style&gt;
446446
* </pre>
447447
*
448-
* <h5>Encoding Notes</h5>
448+
* <b>Encoding Notes</b>
449449
* <ul>
450450
*
451451
* <li>The following characters are encoded using hexidecimal
@@ -515,15 +515,15 @@ public static void forCssString(Writer out, String input)
515515
* itself. The caller should insure that the URL is safe for embedding
516516
* (e.g. input validation) by other means.
517517
*
518-
* <h5>Example JSP Usage</h5>
518+
* <b>Example JSP Usage</b>
519519
* <pre>
520-
* &lt;div style="background:url(&lt;=Encode.forCssUrl(...)%>);">
520+
* &lt;div style="background:url(&lt;=Encode.forCssUrl(...)%&gt;);"&gt;
521521
*
522-
* &lt;style type="text/css">
523-
* background: url(&lt;%=Encode.forCssUrl(...)%>);
524-
* &lt;/style>
522+
* &lt;style type="text/css"&gt;
523+
* background: url(&lt;%=Encode.forCssUrl(...)%&gt;);
524+
* &lt;/style&gt;
525525
* </pre>
526-
* <h5>Encoding Notes</h5>
526+
* <b>Encoding Notes</b>
527527
* <ul>
528528
*
529529
* <li>The following characters are encoded using hexidecimal
@@ -592,15 +592,15 @@ public static void forCssUrl(Writer out, String input)
592592
* example a "javascript:" URL provided by a malicious user would be
593593
* "properly" escaped, and still execute.
594594
*
595-
* <h5>Encoding Table</h5>
595+
* <b>Encoding Table</b>
596596
* <p>The following characters are <i>not</i> encoded:</p>
597597
* <pre>
598-
* U+20: ! # $ & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; = ?
598+
* U+20: ! # $ &amp; ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; = ?
599599
* U+40: @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ ] _
600600
* U+60: a b c d e f g h i j k l m n o p q r s t u v w x y z ~
601601
* </pre>
602602
*
603-
* <h5>Encoding Notes</h5>
603+
* <b>Encoding Notes</b>
604604
* <ul>
605605
*
606606
* <li>The single-quote character({@code '}) <b>is not encoded</b>.</li>
@@ -657,20 +657,20 @@ public static void forCssUrl(Writer out, String input)
657657
* interpreted as part of another component.
658658
*
659659
* <pre>
660-
* &lt;a href="http://www.owasp.org/&lt;%=Encode.forUriComponent(...)%>?query#fragment">
660+
* &lt;a href="http://www.owasp.org/&lt;%=Encode.forUriComponent(...)%&gt;?query#fragment"&gt;
661661
*
662-
* &lt;a href="/search?value=&lt;%=Encode.forUriComponent(...)%>&order=1#top">
662+
* &lt;a href="/search?value=&lt;%=Encode.forUriComponent(...)%&gt;&amp;order=1#top"&gt;
663663
* </pre>
664664
*
665-
* <h5>Encoding Table</h5>
665+
* <b>Encoding Table</b>
666666
* <p>The following characters are <i>not</i> encoded:</p>
667667
* <pre>
668668
* U+20: - . 0 1 2 3 4 5 6 7 8 9
669669
* U+40: @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z _
670670
* U+60: a b c d e f g h i j k l m n o p q r s t u v w x y z ~
671671
* </pre>
672672
*
673-
* <h5>Encoding Notes</h5>
673+
* <b>Encoding Notes</b>
674674
* <ul>
675675
*
676676
* <li>Unlike {@link #forUri(String)} this method is safe to be
@@ -810,10 +810,10 @@ public static void forXmlAttribute(Writer out, String input)
810810
* caller will need to come up with their own encode/decode system.</p>
811811
*
812812
* <pre>
813-
* out.println("&lt;?xml version='1.0'?>");
814-
* out.println("&lt;data>");
815-
* out.println("&;lt;!-- "+Encode.forXmlComment(comment)+" -->");
816-
* out.println("&lt;/data>");
813+
* out.println("&lt;?xml version='1.0'?&gt;");
814+
* out.println("&lt;data&gt;");
815+
* out.println("&lt;!-- "+Encode.forXmlComment(comment)+" --&gt;");
816+
* out.println("&lt;/data&gt;");
817817
* </pre>
818818
*
819819
* @param input the input to encode
@@ -846,7 +846,7 @@ public static void forXmlComment(Writer out, String input)
846846
* provide the CDATA section boundaries.
847847
*
848848
* <pre>
849-
* &lt;xml-data>&lt;![CDATA[&lt;%=Encode.forCDATA(...)%>]]>&lt;/xml-data>
849+
* &lt;xml-data&gt;&lt;![CDATA[&lt;%=Encode.forCDATA(...)%&gt;]]&gt;&lt;/xml-data&gt;
850850
* </pre>
851851
*
852852
* @param input the input to encode
@@ -920,16 +920,16 @@ public static void forJava(Writer out, String input)
920920
* are writing a framework on top of this library, it is recommend
921921
* that you use this method over the others.</p>
922922
*
923-
* <h5>Example JSP Usage:</h5>
923+
* <b>Example JSP Usage:</b>
924924
* <pre>
925-
* &lt;button onclick="alert('&lt;%=Encode.forJavaScript(data)%>');">
926-
* &lt;script type="text/javascript">
927-
* var data = "&lt;%=Encode.forJavaScript(data)%>";
928-
* &lt;/script>
925+
* &lt;button onclick="alert('&lt;%=Encode.forJavaScript(data)%&gt;');"&gt;
926+
* &lt;script type="text/javascript"&gt;
927+
* var data = "&lt;%=Encode.forJavaScript(data)%&gt;";
928+
* &lt;/script&gt;
929929
* </pre>
930930
*
931-
* <h5>Encoding Description</h5>
932931
* <table cellspacing="1" cellpadding="1" border="0">
932+
* <caption><b>Encoding Description</b></caption>
933933
* <thead>
934934
* <tr bgcolor="#ccf">
935935
* <th align="left" colspan="2">Input Character</th>
@@ -972,7 +972,7 @@ public static void forJava(Writer out, String input)
972972
* "\&amp;quot;".)</td>
973973
* </tr>
974974
* <tr>
975-
* <td>U+0026</td><td><code>&</code></td>
975+
* <td>U+0026</td><td><code>&amp;</code></td>
976976
* <td><code>\x26</code></td>
977977
* <td>Ampersand character</td>
978978
* </tr>
@@ -988,7 +988,7 @@ public static void forJava(Writer out, String input)
988988
* <td>U+002F</td><td><code>/</code></td>
989989
* <td><code>\/</code></td>
990990
* <td>This encoding is used to avoid an input sequence
991-
* "&lt;/" from prematurely terminating a &lt;/script>
991+
* "&lt;/" from prematurely terminating a &lt;/script&gt;
992992
* block.</td>
993993
* </tr>
994994
* <tr>
@@ -1041,9 +1041,9 @@ public static void forJavaScript(Writer out, String input)
10411041
* recommend that you use {@link #forJavaScript(String)} over this
10421042
* method.</strong></p>
10431043
*
1044-
* <h5>Example JSP Usage:</h5>
1044+
* <b>Example JSP Usage:</b>
10451045
* <pre>
1046-
* &lt;button onclick="alert('&lt;%=Encode.forJavaScriptAttribute(data)%>');">
1046+
* &lt;button onclick="alert('&lt;%=Encode.forJavaScriptAttribute(data)%&gt;');"&gt;
10471047
* </pre>
10481048
*
10491049
* @param input the input string to encode
@@ -1084,11 +1084,11 @@ public static void forJavaScriptAttribute(Writer out, String input)
10841084
* recommend that you use {@link #forJavaScript(String)} over this
10851085
* method.</strong></p>
10861086
*
1087-
* <h5>Example JSP Usage:</h5>
1087+
* <b>Example JSP Usage:</b>
10881088
* <pre>
1089-
* &lt;script type="text/javascript">
1090-
* var data = "&lt;%=Encode.forJavaScriptBlock(data)%>";
1091-
* &lt;/script>
1089+
* &lt;script type="text/javascript"&gt;
1090+
* var data = "&lt;%=Encode.forJavaScriptBlock(data)%&gt;";
1091+
* &lt;/script&gt;
10921092
* </pre>
10931093
*
10941094
* @param input the input string to encode
@@ -1129,19 +1129,19 @@ public static void forJavaScriptBlock(Writer out, String input)
11291129
* recommend that you use {@link #forJavaScript(String)} over this
11301130
* method.</strong></p>
11311131
*
1132-
* <h5>Example JSP Usage:</h5>
1132+
* <b>Example JSP Usage:</b>
11331133
* This example is serving up JavaScript source directly:
11341134
* <pre>
1135-
* &lt;%@page contentType="text/javascript; charset=UTF-8"%>
1136-
* var data = "&lt;%=Encode.forJavaScriptSource(data)%>";
1135+
* &lt;%@page contentType="text/javascript; charset=UTF-8"%&gt;
1136+
* var data = "&lt;%=Encode.forJavaScriptSource(data)%&gt;";
11371137
* </pre>
11381138
*
11391139
* This example is serving up JSON data (users of this use-case
11401140
* are encouraged to read up on "JSON Hijacking"):
11411141
* <pre>
1142-
* &lt;%@page contentType="application/json; charset=UTF-8"%>
1143-
* &lt;% myapp.jsonHijackingPreventionMeasure(); %>
1144-
* {"data":"&lt;%=Encode.forJavaScriptSource(data)%>"}
1142+
* &lt;%@page contentType="application/json; charset=UTF-8"%&gt;
1143+
* &lt;% myapp.jsonHijackingPreventionMeasure(); %&gt;
1144+
* {"data":"&lt;%=Encode.forJavaScriptSource(data)%&gt;"}
11451145
* </pre>
11461146
*
11471147
* @param input the input string to encode

core/src/main/java/org/owasp/encoder/Encoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public abstract class Encoder {
110110
* true}). This will happen when the encoder needs to see more
111111
* input before determining what to do--for example when encoding
112112
* for CDATA, if the input ends with {@code "foo]]"}, the encoder
113-
* will need to see the next character to determine if it is a ">"
113+
* will need to see the next character to determine if it is a "&gt;"
114114
* or not.</p>
115115
*
116116
* <p>Example usage:</p>

0 commit comments

Comments
 (0)