Add explicit null checking for charset in SimpleHttpClient#encodeRequestParams (#1589)

This commit is contained in:
HupJ 2020-07-07 09:43:46 +08:00 committed by GitHub
parent 5e1a443663
commit 4f31b2c61b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -156,6 +156,9 @@ public class SimpleHttpClient {
* @return encoded request parameters, or empty string ("") if no parameters are provided
*/
private String encodeRequestParams(Map<String, String> paramsMap, Charset charset) {
if (charset == null) {
throw new IllegalArgumentException("charset is not allowed to be null");
}
if (paramsMap == null || paramsMap.isEmpty()) {
return "";
}