Skip to content

Commit 32fa533

Browse files
author
yhl
committed
fix warn log for value check
1 parent 6acc488 commit 32fa533

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

AnalysysJavasdk/src/main/java/cn/com/analysys/javasdk/ValidHandle.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ public static void checkParam(String eventName, Map<String, Object> properties)
4747
continue;
4848
}
4949
}
50-
if(property.getValue() == null)
50+
if(property.getValue() == null){
51+
System.out.println(String.format("Warn: The property %s value is null.", property.getKey()));
5152
continue;
53+
}
5254
try {
5355
if(property != null)
5456
checkParamImpl(eventName, property);
@@ -70,6 +72,7 @@ private static boolean checkParamImpl(String eventName, Map.Entry<String, Object
7072
int valueListLen = 100;
7173
String piEventName = "$profile_increment";
7274
String paEventName = "$profile_append";
75+
String puEventName = "$profile_unset";
7376
//key约束 符合java命名规则: 开头约束:字母或者$ 字符类型:大小写字母、数字、下划线和 $ 最大长度125字符
7477
if (property.getKey().length() > keyLength) {
7578
System.out.println(String.format("Warn: The property key %s is too long, max length is %s.", property.getKey(), keyLength));
@@ -85,8 +88,10 @@ private static boolean checkParamImpl(String eventName, Map.Entry<String, Object
8588
System.out.println(String.format("Warn: The property %s is not Number, String, Boolean, List<String>.", property.getKey()));
8689
}
8790
if (property.getValue() instanceof String && property.getValue().toString().length() == 0) {
91+
if (!puEventName.equals(eventName)) {
8892
System.out.println(String.format("Warn: The property %s String value is null or empty.", property.getKey()));
8993
}
94+
}
9095
if (property.getValue() instanceof String && property.getValue().toString().length() > valueWarnLength) {
9196
System.out.println(String.format("Warn: The property %s String value is too long, max length is %s.", property.getKey(), valueWarnLength));
9297
}

0 commit comments

Comments
 (0)