fix(系统设置): 修复error.log报错空指针的缺陷

【github#9574,查看metersphere日志文件error.log有报错】https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001009845
This commit is contained in:
wxg0103 2022-05-31 15:53:44 +08:00 committed by f2c-ci-robot[bot]
parent d2b34a071d
commit 9eb8cc3106
1 changed files with 7 additions and 7 deletions

View File

@ -178,25 +178,25 @@ public class ReflexObjectUtil {
// 深度对比
else if (StringUtils.equals(module, "API_DEFINITION")) {
if (originalColumns.get(i).getColumnName().equals("request")) {
String newValue = newColumns.get(i).getOriginalValue().toString();
String oldValue = column.getOriginalValue().toString();
String newValue = Objects.toString(column.getNewValue().toString(), "");
String oldValue = Objects.toString(column.getOriginalValue(), "");
column.setDiffValue(ApiDefinitionDiffUtil.diff(newValue, oldValue));
} else if (originalColumns.get(i).getColumnName().equals("response")) {
String newValue = newColumns.get(i).getOriginalValue().toString();
String oldValue = column.getOriginalValue().toString();
String newValue = Objects.toString(column.getNewValue().toString(), "");
String oldValue = Objects.toString(column.getOriginalValue(), "");
column.setDiffValue(ApiDefinitionDiffUtil.diffResponse(newValue, oldValue));
}
}
// 环境全局前后置脚本深度对比
else if(StringUtils.equals(module, "PROJECT_ENVIRONMENT_SETTING")){
if (originalColumns.get(i).getColumnName().equals("config")) {
String newValue = newColumns.get(i).getOriginalValue().toString();
String oldValue = column.getOriginalValue().toString();
String newValue = Objects.toString(column.getNewValue().toString(), "");
String oldValue = Objects.toString(column.getOriginalValue(), "");
column.setDiffValue(ApiTestEnvironmentDiffUtil.diff(newValue, oldValue));
}
}
else {
String newValue = column.getNewValue().toString();
String newValue = Objects.toString(column.getNewValue().toString(), "");
if (StringUtils.isNotEmpty(newValue)) {
column.setNewValue(newValue.replaceAll("\\n", " "));
}