mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
!1007 修复:IdcardUtil.getGenderByIdCard存在潜在的异常:IndexOutOfBoundsException
Merge pull request !1007 from dazer007/v5-dev-getGenderByIdCard-bug-fix
This commit is contained in:
@@ -552,7 +552,7 @@ public class IdcardUtil {
|
||||
public static int getGenderByIdCard(String idcard) {
|
||||
Assert.notBlank(idcard);
|
||||
final int len = idcard.length();
|
||||
if (len < CHINA_ID_MIN_LENGTH) {
|
||||
if (!(len == CHINA_ID_MIN_LENGTH || len == CHINA_ID_MAX_LENGTH)) {
|
||||
throw new IllegalArgumentException("ID Card length must be 15 or 18");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user