@@ -98,6 +98,8 @@ private URLDecoder() {}
9898 * default charset. Instead, use the decode(String,String) method
9999 * to specify the encoding.
100100 * @return the newly decoded {@code String}
101+ * @throws IllegalArgumentException if the implementation encounters malformed
102+ * escape sequences
101103 */
102104 @ Deprecated
103105 public static String decode (String s ) {
@@ -113,9 +115,6 @@ public static String decode(String s) {
113115 * except that it will {@linkplain Charset#forName look up the charset}
114116 * using the given encoding name.
115117 *
116- * @implNote This implementation will throw an {@link java.lang.IllegalArgumentException}
117- * when illegal strings are encountered.
118- *
119118 * @param s the {@code String} to decode
120119 * @param enc The name of a supported
121120 * <a href="../lang/package-summary.html#charenc">character
@@ -124,6 +123,8 @@ public static String decode(String s) {
124123 * @throws UnsupportedEncodingException
125124 * If character encoding needs to be consulted, but
126125 * named character encoding is not supported
126+ * @throws IllegalArgumentException if the implementation encounters malformed
127+ * escape sequences
127128 * @see URLEncoder#encode(java.lang.String, java.lang.String)
128129 * @since 1.4
129130 */
@@ -144,24 +145,23 @@ public static String decode(String s, String enc) throws UnsupportedEncodingExce
144145 * Decodes an {@code application/x-www-form-urlencoded} string using
145146 * a specific {@linkplain Charset Charset}.
146147 * 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}.
149152 * <p>
150153 * <em><strong>Note:</strong> The <a href=
151154 * "http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars">
152155 * World Wide Web Consortium Recommendation</a> states that
153156 * UTF-8 should be used. Not doing so may introduce
154157 * incompatibilities.</em>
155158 *
156- * @implNote This implementation will throw an {@link java.lang.IllegalArgumentException}
157- * when illegal strings are encountered.
158- *
159159 * @param s the {@code String} to decode
160160 * @param charset the given charset
161161 * @return the newly decoded {@code String}
162162 * @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
165165 *
166166 * @spec https://www.w3.org/TR/html4 HTML 4.01 Specification
167167 * @see URLEncoder#encode(java.lang.String, Charset)
0 commit comments