|
@@ -1,5 +1,6 @@
|
|
|
package com.fdkankan.modeling.constants;
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
@@ -37,6 +38,10 @@ public class SysConstants {
|
|
|
public void setHostName(String filePath){
|
|
|
try {
|
|
|
SysConstants.hostName = FileUtils.readFile(filePath);
|
|
|
+ //去除换行符
|
|
|
+ if(StrUtil.isNotEmpty(SysConstants.hostName)){
|
|
|
+ SysConstants.hostName = SysConstants.hostName.trim().replaceAll("\\s","");
|
|
|
+ }
|
|
|
log.error("从文件({})中获取服务器名称:{}", filePath,hostName);
|
|
|
} catch (Exception e) {
|
|
|
log.error("从文件中获取服务器名称失败,文件路径{}", filePath);
|