This commit is contained in:
Looly 2021-11-26 22:21:41 +08:00
parent 06cc38734c
commit 496d07c8d7
4 changed files with 16 additions and 0 deletions

View File

@ -33,6 +33,7 @@
* 【core 】 修复FileResource构造fileName参数无效问题issue#1942@Github * 【core 】 修复FileResource构造fileName参数无效问题issue#1942@Github
* 【cache 】 修复WeakCache键值强关联导致的无法回收问题issue#1953@Github * 【cache 】 修复WeakCache键值强关联导致的无法回收问题issue#1953@Github
* 【core 】 修复ZipUtil相对路径父路径获取null问题issue#1961@Github * 【core 】 修复ZipUtil相对路径父路径获取null问题issue#1961@Github
* 【http 】 修复HttpUtil.normalizeParams未判空导致的问题issue#1975@Github
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------

View File

@ -182,6 +182,12 @@ public class ArrayUtilTest {
Assert.assertEquals(9, range[9]); Assert.assertEquals(9, range[9]);
} }
@Test(expected = NegativeArraySizeException.class)
public void rangeMinTest() {
//noinspection ResultOfMethodCallIgnored
ArrayUtil.range(0, Integer.MIN_VALUE);
}
@Test @Test
public void maxTest() { public void maxTest() {
int max = ArrayUtil.max(1, 2, 13, 4, 5); int max = ArrayUtil.max(1, 2, 13, 4, 5);

View File

@ -539,6 +539,9 @@ public class HttpUtil {
* @since 4.5.2 * @since 4.5.2
*/ */
public static String normalizeParams(String paramPart, Charset charset) { public static String normalizeParams(String paramPart, Charset charset) {
if(StrUtil.isEmpty(paramPart)){
return paramPart;
}
final StrBuilder builder = StrBuilder.create(paramPart.length() + 16); final StrBuilder builder = StrBuilder.create(paramPart.length() + 16);
final int len = paramPart.length(); final int len = paramPart.length();
String name = null; String name = null;

View File

@ -302,6 +302,12 @@ public class HttpUtilTest {
Assert.assertEquals("%E5%8F%82%E6%95%B0", encodeResult); Assert.assertEquals("%E5%8F%82%E6%95%B0", encodeResult);
} }
@Test
public void normalizeBlankParamsTest() {
String encodeResult = HttpUtil.normalizeParams("", CharsetUtil.CHARSET_UTF_8);
Assert.assertEquals("", encodeResult);
}
@Test @Test
public void getMimeTypeTest() { public void getMimeTypeTest() {
String mimeType = HttpUtil.getMimeType("aaa.aaa"); String mimeType = HttpUtil.getMimeType("aaa.aaa");