@@ -660,7 +660,7 @@ public static void encode(String s, Appendable dest) throws IOException {
660660 char c = s .charAt (i );
661661 if (c > 127 || c == '"' || c == '<' || c == '>' || c == '&' || c == '\'' ) {
662662 // special html characters
663- dest .append ("&#" ).append ("" + ( int ) c ).append (";" );
663+ dest .append ("&#" ).append (Integer . toString ( c ) ).append (";" );
664664 } else if (c == ' ' ) {
665665 // non-breaking space
666666 dest .append (" " );
@@ -917,24 +917,22 @@ public static void writeHAD(Writer out, String ctxE, String entry) throws IOExce
917917 /**
918918 * Wrapper around UTF-8 URL encoding of a string.
919919 *
920- * @param q query to be encoded. If {@code null}, an empty string will be used instead.
921- * @return null if failed, otherwise the encoded string
920+ * @param string to be encoded. If {@code null}, an empty string will be used instead.
921+ * @return {@code null} if failed, otherwise the encoded string
922922 * @see URLEncoder#encode(String, String)
923923 */
924- public static String uriEncode (String q ) {
925- return q == null ? "" : URLEncoder .encode (q , StandardCharsets .UTF_8 );
924+ public static String uriEncode (String string ) {
925+ return string == null ? "" : URLEncoder .encode (string , StandardCharsets .UTF_8 );
926926 }
927927
928928 /**
929- * Append to {@code dest} the UTF-8 URL-encoded representation of
930- * {@code str}.
929+ * Append to {@code dest} the UTF-8 URL-encoded representation of {@code str}.
931930 * @param str a defined instance
932931 * @param dest a defined target
933932 * @throws IOException I/O
934933 */
935934 public static void uriEncode (String str , Appendable dest ) throws IOException {
936- String uenc = uriEncode (str );
937- dest .append (uenc );
935+ dest .append (uriEncode (str ));
938936 }
939937
940938 /**
@@ -948,7 +946,6 @@ public static void uriEncode(String str, Appendable dest) throws IOException {
948946 * @see #uriEncode(String)
949947 */
950948 public static void appendQuery (StringBuilder buf , String key , String value ) {
951-
952949 if (value != null ) {
953950 buf .append (AMP ).append (key ).append ('=' ).append (uriEncode (value ));
954951 }
@@ -1647,15 +1644,13 @@ public static String linkifyPattern(String text, Pattern pattern, String url) {
16471644 /**
16481645 * Try to complete the given URL part into full URL with server name, port, scheme, ...
16491646 * <dl>
1650- * <dt>for request http://localhost:8080/source/xref/xxx and part
1651- * /cgi-bin/user=</dt>
1652- * <dd>http://localhost:8080/cgi-bin/user=</dd>
1653- * <dt>for request http://localhost:8080/source/xref/xxx and part
1654- * cgi-bin/user=</dt>
1655- * <dd>http://localhost:8080/source/xref/xxx/cgi-bin/user=</dd>
1656- * <dt>for request http://localhost:8080/source/xref/xxx and part
1657- * http://users.com/user=</dt>
1658- * <dd>http://users.com/user=</dd>
1647+ * <dt>for request {@code http://localhost:8080/source/xref/xxx} and part {@code /cgi-bin/user=}</dt>
1648+ * <dd>{@code http://localhost:8080/cgi-bin/user=}</dd>
1649+ * <dt>for request {@code http://localhost:8080/source/xref/xxx} and part {@code cgi-bin/user=}</dt>
1650+ * <dd>{@code http://localhost:8080/source/xref/xxx/cgi-bin/user=}</dd>
1651+ * <dt>for request {@code http://localhost:8080/source/xref/xxx} and part
1652+ * {@code http://users.com/user=}</dt>
1653+ * <dd>{@code http://users.com/user=}</dd>
16591654 * </dl>
16601655 *
16611656 * @param url the given URL part, may be already full URL
0 commit comments