Commit 846d4656 by chengzhuoshen

如果出现异常,将静态配置文件对象置为空,以便下次解析配置文件,

parent bde01f91
......@@ -25,8 +25,9 @@ public class MessageUtil {
return properties.getProperty(key, key);
}
return key;
} catch (IOException e) {
throw new SwiftException("ERROR", e.getMessage());
} catch (Exception e) {
properties = null;
throw new SwiftException(e.getMessage());
}
}
}
......@@ -28,8 +28,6 @@ import java.util.*;
public class SwiftTransferUtil {
public static Properties properties = null;
public static List<SwiftTranslationErrorInfo> stErrorInfos = null;
public static XMLGregorianCalendar getXMLGregorianCalendarNow() {
......@@ -769,6 +767,7 @@ public class SwiftTransferUtil {
*/
public static SwiftTranslationErrorInfo getSwiftTranslationErrorInfoByErrorCode(String key) {
if (stErrorInfos == null) {
try {
stErrorInfos = new ArrayList<>();
InputStream resourceAsStream = SwiftTransferUtil.class.getResourceAsStream("/ErrorCodeList.xlsx");
ExcelReader reader = ExcelUtil.getReader(resourceAsStream, "CBPR+");
......@@ -791,6 +790,10 @@ public class SwiftTransferUtil {
}
}
}
} catch (Exception e) {
stErrorInfos = null;//如果出现异常,stErrorInfos=null,下次仍需初始化
throw e;
}
}
SwiftTranslationErrorInfo tmpErrorInfo = null;
if (stErrorInfos != null && stErrorInfos.size() > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment