Showing
1 changed file
with
2 additions
and
2 deletions
@@ -278,8 +278,8 @@ public class ByteUtils { | @@ -278,8 +278,8 @@ public class ByteUtils { | ||
278 | return result; | 278 | return result; |
279 | } | 279 | } |
280 | 280 | ||
281 | - public static byte[] strToBytes(String str) { | ||
282 | - if (Pattern.compile(messageRegular).matcher(str).matches()) { | 281 | + public static byte[] strToBytes(String str){ |
282 | + if(Pattern.compile("^[A-Fa-f0-9]+$").matcher(str).matches()){ | ||
283 | return hexStr2Bytes(str); | 283 | return hexStr2Bytes(str); |
284 | } | 284 | } |
285 | return getBytes(str, ByteUtils.UTF_8); | 285 | return getBytes(str, ByteUtils.UTF_8); |