提交 89438fb3 authored 作者: yangqi's avatar yangqi

1

上级 8c952484
...@@ -4,9 +4,16 @@ package cn.lefull.common.utils; ...@@ -4,9 +4,16 @@ package cn.lefull.common.utils;
* @author 杨奇 * @author 杨奇
*/ */
public class Utils { public class Utils {
public static void checkStringNotEmpty(String str, String name) throws Exception {
public static void checkParamsNotEmpty(String str, String name) throws Exception {
if(str == null || str.isEmpty()){ if(str == null || str.isEmpty()){
throw new Exception(name + "为空"); throw new Exception(name + "未设置");
}
}
public static void checkParamsNotEmpty(int i, String name) throws Exception {
if(i == 0){
throw new Exception(name + "未设置");
} }
} }
} }
...@@ -24,9 +24,9 @@ public class FaceService { ...@@ -24,9 +24,9 @@ public class FaceService {
} }
public void addFace(String dbName, String entityId, String labels) throws Exception { public void addFace(String dbName, String entityId, String labels) throws Exception {
Utils.checkStringNotEmpty(dbName, "dbName"); Utils.checkParamsNotEmpty(dbName, "dbName");
Utils.checkStringNotEmpty(entityId, "entityId"); Utils.checkParamsNotEmpty(entityId, "entityId");
Utils.checkStringNotEmpty(labels, "labels"); Utils.checkParamsNotEmpty(labels, "labels");
face.addFace(dbName, entityId, labels); face.addFace(dbName, entityId, labels);
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论