@@ -98,6 +98,8 @@ private URLDecoder() {}
98
98
* default charset. Instead, use the decode(String,String) method
99
99
* to specify the encoding.
100
100
* @return the newly decoded {@code String}
101
+ * @throws IllegalArgumentException if the implementation encounters malformed
102
+ * escape sequences
101
103
*/
102
104
@ Deprecated
103
105
public static String decode (String s ) {
@@ -113,9 +115,6 @@ public static String decode(String s) {
113
115
* except that it will {@linkplain Charset#forName look up the charset}
114
116
* using the given encoding name.
115
117
*
116
- * @implNote This implementation will throw an {@link java.lang.IllegalArgumentException}
117
- * when illegal strings are encountered.
118
- *
119
118
* @param s the {@code String} to decode
120
119
* @param enc The name of a supported
121
120
* <a href="../lang/package-summary.html#charenc">character
@@ -124,6 +123,8 @@ public static String decode(String s) {
124
123
* @throws UnsupportedEncodingException
125
124
* If character encoding needs to be consulted, but
126
125
* named character encoding is not supported
126
+ * @throws IllegalArgumentException if the implementation encounters malformed
127
+ * escape sequences
127
128
* @see URLEncoder#encode(java.lang.String, java.lang.String)
128
129
* @since 1.4
129
130
*/
@@ -144,24 +145,23 @@ public static String decode(String s, String enc) throws UnsupportedEncodingExce
144
145
* Decodes an {@code application/x-www-form-urlencoded} string using
145
146
* a specific {@linkplain Charset Charset}.
146
147
* The supplied charset is used to determine
147
- * what characters are represented by any consecutive sequences of the
148
- * form "<i>{@code %xy}</i>".
148
+ * what characters are represented by any consecutive escape sequences of
149
+ * the form "<i>{@code %xy}</i>". Erroneous bytes are replaced with the
150
+ * supplied {@code Charset}'s {@linkplain java.nio.charset.CharsetDecoder##cae
151
+ * replacement value}.
149
152
* <p>
150
153
* <em><strong>Note:</strong> The <a href=
151
154
* "http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars">
152
155
* World Wide Web Consortium Recommendation</a> states that
153
156
* UTF-8 should be used. Not doing so may introduce
154
157
* incompatibilities.</em>
155
158
*
156
- * @implNote This implementation will throw an {@link java.lang.IllegalArgumentException}
157
- * when illegal strings are encountered.
158
- *
159
159
* @param s the {@code String} to decode
160
160
* @param charset the given charset
161
161
* @return the newly decoded {@code String}
162
162
* @throws NullPointerException if {@code s} or {@code charset} is {@code null}
163
- * @throws IllegalArgumentException if the implementation encounters illegal
164
- * characters
163
+ * @throws IllegalArgumentException if the implementation encounters malformed
164
+ * escape sequences
165
165
*
166
166
* @spec https://www.w3.org/TR/html4 HTML 4.01 Specification
167
167
* @see URLEncoder#encode(java.lang.String, Charset)
0 commit comments