调用摘要获取工具获取摘要信息时,如果返回的信息为空,可能是工具安装不正确,给界面抛出异常信息;如果有返回信息但是不包含摘要部分,返回结果中digest属性的值为""。

This commit is contained in:
zhangdongxu
2018-08-30 16:19:39 +08:00
parent db526cc949
commit 03d961e73f
2 changed files with 7 additions and 4 deletions

View File

@@ -360,7 +360,7 @@ public class ConfigSourcesController extends BaseRestController {
logger.info("摘要获取开始:---------------");
String digestStr = configSourcesService.getDigestGen(request.getRealPath(File.separator), tempFilePath);
logger.info("摘要获取结束:---------------:"+digestStr);
resultObject.put("digest", digestStr);
resultObject.put("digest", null==digestStr?"":digestStr);
resultObject.put("rawLen", file.getSize());
FileUtils.deleteFile(tempFilePath);
} catch (Exception e) {
@@ -368,7 +368,7 @@ public class ConfigSourcesController extends BaseRestController {
e.printStackTrace();
logger.error(RestBusinessCode.GetFileDigestFailure.getValue()+":"+e.getMessage()+",请检查摘要获取工具是否安装成功");
thread.setExceptionInfo("摘要获取过程中出现异常:"+e.getMessage()+",请检查摘要获取工具是否安装成功");
throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, RestBusinessCode.GetFileDigestFailure.getValue()+":"+e.getMessage()+",请检查摘要获取工具是否安装成功",
throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, RestBusinessCode.GetFileDigestFailure.getErrorReason()+":"+e.getMessage()+",请检查摘要获取工具是否安装成功",
RestBusinessCode.GetFileDigestFailure.getValue());
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "摘要获取成功", resultObject);