mirror of
https://gitee.com/dromara/hutool.git
synced 2026-02-09 09:16:26 +08:00
fix issue IDFNH0,在方法一开始进行空判断。
This commit is contained in:
@@ -27,6 +27,9 @@ public class HexUtil {
|
||||
* @return 是否为16进制
|
||||
*/
|
||||
public static boolean isHexNumber(String value) {
|
||||
if (StrUtil.isEmpty(value)) {
|
||||
return false;
|
||||
}
|
||||
if (StrUtil.startWith(value, '-')) {
|
||||
// issue#2875
|
||||
return false;
|
||||
|
||||
@@ -59,6 +59,12 @@ public class HexUtilTest {
|
||||
assertFalse(HexUtil.isHexNumber(a));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isHexNumberTest2() {
|
||||
assertFalse(HexUtil.isHexNumber(""));
|
||||
assertFalse(HexUtil.isHexNumber(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void decodeTest(){
|
||||
final String str = "e8c670380cb220095268f40221fc748fa6ac39d6e930e63c30da68bad97f885d";
|
||||
|
||||
Reference in New Issue
Block a user