diff --git a/hutool-core/src/main/java/cn/hutool/core/codec/BCD.java b/hutool-core/src/main/java/cn/hutool/core/codec/BCD.java
index 6600133cc..b63b79f8c 100644
--- a/hutool-core/src/main/java/cn/hutool/core/codec/BCD.java
+++ b/hutool-core/src/main/java/cn/hutool/core/codec/BCD.java
@@ -17,6 +17,7 @@ public class BCD {
* @return BCD
*/
public static byte[] strToBcd(String asc) {
+ Assert.notNull(asc, "ASCII must not be null!");
int len = asc.length();
int mod = len % 2;
if (mod != 0) {
diff --git a/hutool-core/src/main/java/cn/hutool/core/codec/Caesar.java b/hutool-core/src/main/java/cn/hutool/core/codec/Caesar.java
index c7c94f40e..d1b5d36f9 100644
--- a/hutool-core/src/main/java/cn/hutool/core/codec/Caesar.java
+++ b/hutool-core/src/main/java/cn/hutool/core/codec/Caesar.java
@@ -1,5 +1,7 @@
package cn.hutool.core.codec;
+import cn.hutool.core.lang.Assert;
+
/**
* 凯撒密码实现
* 算法来自:https://github.com/zhaorenjie110/SymmetricEncryptionAndDecryption
@@ -19,6 +21,7 @@ public class Caesar {
* @return 加密后的内容
*/
public static String encode(String message, int offset) {
+ Assert.notNull(message, "message must be not null!");
final int len = message.length();
final char[] plain = message.toCharArray();
char c;
@@ -40,6 +43,7 @@ public class Caesar {
* @return 解密后的内容
*/
public static String decode(String cipherText, int offset) {
+ Assert.notNull(cipherText, "cipherText must be not null!");
final int len = cipherText.length();
final char[] plain = cipherText.toCharArray();
char c;
diff --git a/hutool-core/src/main/java/cn/hutool/core/codec/PercentCodec.java b/hutool-core/src/main/java/cn/hutool/core/codec/PercentCodec.java
index 88fd210a0..9d91cd17d 100755
--- a/hutool-core/src/main/java/cn/hutool/core/codec/PercentCodec.java
+++ b/hutool-core/src/main/java/cn/hutool/core/codec/PercentCodec.java
@@ -1,5 +1,6 @@
package cn.hutool.core.codec;
+import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.CharUtil;
import cn.hutool.core.util.HexUtil;
@@ -51,6 +52,7 @@ public class PercentCodec implements Serializable {
* @return PercentCodec
*/
public static PercentCodec of(CharSequence chars) {
+ Assert.notNull(chars, "chars must not be null");
final PercentCodec codec = new PercentCodec();
final int length = chars.length();
for (int i = 0; i < length; i++) {
diff --git a/hutool-core/src/main/java/cn/hutool/core/codec/PunyCode.java b/hutool-core/src/main/java/cn/hutool/core/codec/PunyCode.java
index fd3fc3864..c6474a4a0 100644
--- a/hutool-core/src/main/java/cn/hutool/core/codec/PunyCode.java
+++ b/hutool-core/src/main/java/cn/hutool/core/codec/PunyCode.java
@@ -44,6 +44,7 @@ public class PunyCode {
* @throws UtilException 计算异常
*/
public static String encode(CharSequence input, boolean withPrefix) throws UtilException {
+ Assert.notNull(input, "input must not be null!");
int n = INITIAL_N;
int delta = 0;
int bias = INITIAL_BIAS;
@@ -126,6 +127,7 @@ public class PunyCode {
* @throws UtilException 计算异常
*/
public static String decode(String input) throws UtilException {
+ Assert.notNull(input, "input must not be null!");
input = StrUtil.removePrefixIgnoreCase(input, PUNY_CODE_PREFIX);
int n = INITIAL_N;
diff --git a/hutool-core/src/main/java/cn/hutool/core/codec/Rot.java b/hutool-core/src/main/java/cn/hutool/core/codec/Rot.java
index ff0cdd135..d0826aee1 100644
--- a/hutool-core/src/main/java/cn/hutool/core/codec/Rot.java
+++ b/hutool-core/src/main/java/cn/hutool/core/codec/Rot.java
@@ -1,5 +1,7 @@
package cn.hutool.core.codec;
+import cn.hutool.core.lang.Assert;
+
/**
* RotN(rotate by N places),回转N位密码,是一种简易的替换式密码,也是过去在古罗马开发的凯撒加密的一种变体。
* 代码来自:https://github.com/orclight/jencrypt
@@ -30,11 +32,11 @@ public class Rot {
* Rot-13编码
*
* @param message 被编码的消息
- * @param isEnocdeNumber 是否编码数字
+ * @param isEncodeNumber 是否编码数字
* @return 编码后的字符串
*/
- public static String encode13(String message, boolean isEnocdeNumber) {
- return encode(message, 13, isEnocdeNumber);
+ public static String encode13(String message, boolean isEncodeNumber) {
+ return encode(message, 13, isEncodeNumber);
}
/**
@@ -42,15 +44,16 @@ public class Rot {
*
* @param message 被编码的消息
* @param offset 位移,常用位移13
- * @param isEnocdeNumber 是否编码数字
+ * @param isEncodeNumber 是否编码数字
* @return 编码后的字符串
*/
- public static String encode(String message, int offset, boolean isEnocdeNumber) {
+ public static String encode(String message, int offset, boolean isEncodeNumber) {
+ Assert.notNull(message, "message must not be null");
final int len = message.length();
final char[] chars = new char[len];
for (int i = 0; i < len; i++) {
- chars[i] = encodeChar(message.charAt(i), offset, isEnocdeNumber);
+ chars[i] = encodeChar(message.charAt(i), offset, isEncodeNumber);
}
return new String(chars);
}
@@ -85,6 +88,7 @@ public class Rot {
* @return 解码后的字符串
*/
public static String decode(String rot, int offset, boolean isDecodeNumber) {
+ Assert.notNull(rot, "rot must not be null");
final int len = rot.length();
final char[] chars = new char[len];