调用摘要获取工具获取摘要信息时,如果返回的信息为空,可能是工具安装不正确,给界面抛出异常信息;如果有返回信息但是不包含摘要部分,返回结果中digest属性的值为""。
This commit is contained in:
@@ -759,7 +759,7 @@ public class ConfigSourcesService extends BaseService {
|
||||
// System.out.println("----------------chmodCommod:"+chmodCommond);
|
||||
String commondStr = realPath + digestGenToolPath + " -f " + filePath; // 执行
|
||||
// 执行摘要获取命令 digest -f /home/aa.txt
|
||||
// System.out.println("------------commondStr:"+commondStr);
|
||||
logger.info("------------commondStr:"+commondStr);
|
||||
Runtime.getRuntime().exec(chmodCommond);
|
||||
Process p = Runtime.getRuntime().exec(commondStr);
|
||||
byte[] b = new byte[1024];
|
||||
@@ -771,7 +771,10 @@ public class ConfigSourcesService extends BaseService {
|
||||
if (!StringUtil.isBlank(content)) {
|
||||
content = StringUtil.stripAll(content);
|
||||
}
|
||||
// System.out.println("-------------------->>"+content);
|
||||
logger.info("摘要工具获取到的内容-------------------->>"+content);
|
||||
if (StringUtil.isEmpty(content)) {
|
||||
throw new Exception("调用摘要工具获取到的内容为空");
|
||||
}
|
||||
String[] digestGenReslt = content.split(" ");
|
||||
if (digestGenReslt.length >= 4 && !StringUtil.isEmpty(digestGenReslt[3])) {
|
||||
return digestGenReslt[3];
|
||||
|
||||
Reference in New Issue
Block a user