mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
Merge branch 'dromara:v5-dev' into v5-dev
This commit is contained in:
commit
924f6c226d
@ -3,7 +3,7 @@
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# 5.8.9.M1 (2022-10-12)
|
||||
# 5.8.9.M1 (2022-10-13)
|
||||
|
||||
### 🐣新特性
|
||||
* 【core 】 DateUtil增加isLastDayOfMonth、getLastDayOfMonth方法(pr#824@Gitee)
|
||||
@ -11,6 +11,7 @@
|
||||
* 【core 】 CharUtil.isBlank添加Hangul Filler字符(issue#I5UGSQ@Gitee)
|
||||
* 【poi 】 优化合并单元格读取(issue#I5UJZ1@Gitee)
|
||||
* 【extra 】 增加QLExpress支持(issue#2653@Github)
|
||||
* 【core 】 UrlBuilder增加getPortWithDefault方法(pr#835@Gitee)
|
||||
|
||||
### 🐞Bug修复
|
||||
* 【poi 】 修复ExcelReader读取只有标题行报错问题(issue#I5U1JA@Gitee)
|
||||
|
@ -291,6 +291,20 @@ public final class UrlBuilder implements Builder<String> {
|
||||
return port;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取端口,如果未自定义返回协议默认端口
|
||||
*
|
||||
* @return 端口
|
||||
*/
|
||||
public int getPortWithDefault() {
|
||||
int port = getPort();
|
||||
if (port > 0) {
|
||||
return port;
|
||||
}
|
||||
URL url = this.toURL();
|
||||
return url.getDefaultPort();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置端口,默认-1
|
||||
*
|
||||
|
@ -2667,7 +2667,7 @@ public class PrimitiveArrayUtil {
|
||||
return array;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------- shuffle
|
||||
// ---------------------------------------------------------------------- swap
|
||||
|
||||
/**
|
||||
* 交换数组中两个位置的值
|
||||
@ -2821,6 +2821,8 @@ public class PrimitiveArrayUtil {
|
||||
return array;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------- asc and desc
|
||||
|
||||
/**
|
||||
* 检查数组是否升序,即array[i] <= array[i+1],若传入空数组,则返回false
|
||||
*
|
||||
|
@ -16,8 +16,10 @@ public class UrlBuilderTest {
|
||||
|
||||
@Test
|
||||
public void buildTest() {
|
||||
final String buildUrl = UrlBuilder.of().setHost("www.hutool.cn").build();
|
||||
UrlBuilder builder = UrlBuilder.of();
|
||||
final String buildUrl = builder.setHost("www.hutool.cn").build();
|
||||
Assert.assertEquals("http://www.hutool.cn/", buildUrl);
|
||||
Assert.assertEquals(buildUrl, 80, builder.getPortWithDefault());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -26,9 +28,11 @@ public class UrlBuilderTest {
|
||||
String buildUrl = UrlBuilder.of().setScheme("http").setHost("192.168.1.1").setPort(8080).setWithEndTag(false).build();
|
||||
Assert.assertEquals("http://192.168.1.1:8080", buildUrl);
|
||||
|
||||
buildUrl = UrlBuilder.of().setScheme("http").setHost("192.168.1.1").setPort(8080).addQuery("url", "http://192.168.1.1/test/1")
|
||||
UrlBuilder urlBuilder = UrlBuilder.of();
|
||||
buildUrl = urlBuilder.setScheme("http").setHost("192.168.1.1").setPort(8080).addQuery("url", "http://192.168.1.1/test/1")
|
||||
.setWithEndTag(false).build();
|
||||
Assert.assertEquals("http://192.168.1.1:8080?url=http://192.168.1.1/test/1", buildUrl);
|
||||
Assert.assertEquals(buildUrl, 8080, urlBuilder.getPortWithDefault());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user