@@ -660,7 +660,7 @@ public static void encode(String s, Appendable dest) throws IOException {
660
660
char c = s .charAt (i );
661
661
if (c > 127 || c == '"' || c == '<' || c == '>' || c == '&' || c == '\'' ) {
662
662
// special html characters
663
- dest .append ("&#" ).append ("" + ( int ) c ).append (";" );
663
+ dest .append ("&#" ).append (Integer . toString ( c ) ).append (";" );
664
664
} else if (c == ' ' ) {
665
665
// non-breaking space
666
666
dest .append (" " );
@@ -917,24 +917,22 @@ public static void writeHAD(Writer out, String ctxE, String entry) throws IOExce
917
917
/**
918
918
* Wrapper around UTF-8 URL encoding of a string.
919
919
*
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
922
922
* @see URLEncoder#encode(String, String)
923
923
*/
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 );
926
926
}
927
927
928
928
/**
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}.
931
930
* @param str a defined instance
932
931
* @param dest a defined target
933
932
* @throws IOException I/O
934
933
*/
935
934
public static void uriEncode (String str , Appendable dest ) throws IOException {
936
- String uenc = uriEncode (str );
937
- dest .append (uenc );
935
+ dest .append (uriEncode (str ));
938
936
}
939
937
940
938
/**
@@ -948,7 +946,6 @@ public static void uriEncode(String str, Appendable dest) throws IOException {
948
946
* @see #uriEncode(String)
949
947
*/
950
948
public static void appendQuery (StringBuilder buf , String key , String value ) {
951
-
952
949
if (value != null ) {
953
950
buf .append (AMP ).append (key ).append ('=' ).append (uriEncode (value ));
954
951
}
@@ -1647,15 +1644,13 @@ public static String linkifyPattern(String text, Pattern pattern, String url) {
1647
1644
/**
1648
1645
* Try to complete the given URL part into full URL with server name, port, scheme, ...
1649
1646
* <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>
1659
1654
* </dl>
1660
1655
*
1661
1656
* @param url the given URL part, may be already full URL
0 commit comments