Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
swiftMtMx
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
isc-v3.1-tmp
swiftMtMx
Commits
846d4656
Commit
846d4656
authored
Aug 17, 2022
by
chengzhuoshen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
如果出现异常,将静态配置文件对象置为空,以便下次解析配置文件,
parent
bde01f91
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
22 deletions
+26
-22
MessageUtil.java
.../src/main/java/com/brilliance/swift/util/MessageUtil.java
+3
-2
SwiftTransferUtil.java
...ain/java/com/brilliance/swift/util/SwiftTransferUtil.java
+23
-20
No files found.
swiftCore/src/main/java/com/brilliance/swift/util/MessageUtil.java
View file @
846d4656
...
...
@@ -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
());
}
}
}
swiftCore/src/main/java/com/brilliance/swift/util/SwiftTransferUtil.java
View file @
846d4656
...
...
@@ -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,27 +767,32 @@ public class SwiftTransferUtil {
*/
public
static
SwiftTranslationErrorInfo
getSwiftTranslationErrorInfoByErrorCode
(
String
key
)
{
if
(
stErrorInfos
==
null
)
{
stErrorInfos
=
new
ArrayList
<>();
InputStream
resourceAsStream
=
SwiftTransferUtil
.
class
.
getResourceAsStream
(
"/ErrorCodeList.xlsx"
);
ExcelReader
reader
=
ExcelUtil
.
getReader
(
resourceAsStream
,
"CBPR+"
);
List
<
Map
<
String
,
Object
>>
content
=
reader
.
readAll
();
if
(
content
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
content
.
size
();
i
++)
{
Map
<
String
,
Object
>
contentMaps
=
content
.
get
(
i
);
String
errorCode
=
(
String
)
contentMaps
.
get
(
"ErrorCode"
);
String
description
=
(
String
)
contentMaps
.
get
(
"Description"
);
String
errorType
=
(
String
)
contentMaps
.
get
(
"ErrorType"
);
if
(
StringUtil
.
isNotEmpty
(
errorCode
)
&&
StringUtil
.
isNotEmpty
(
description
))
{
SwiftTranslationErrorInfo
stErrorInfo
=
new
SwiftTranslationErrorInfo
();
if
(
errorCode
.
indexOf
(
"("
)
>
-
1
)
{
errorCode
=
errorCode
.
substring
(
0
,
errorCode
.
indexOf
(
"("
));
try
{
stErrorInfos
=
new
ArrayList
<>();
InputStream
resourceAsStream
=
SwiftTransferUtil
.
class
.
getResourceAsStream
(
"/ErrorCodeList.xlsx"
);
ExcelReader
reader
=
ExcelUtil
.
getReader
(
resourceAsStream
,
"CBPR+"
);
List
<
Map
<
String
,
Object
>>
content
=
reader
.
readAll
();
if
(
content
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
content
.
size
();
i
++)
{
Map
<
String
,
Object
>
contentMaps
=
content
.
get
(
i
);
String
errorCode
=
(
String
)
contentMaps
.
get
(
"ErrorCode"
);
String
description
=
(
String
)
contentMaps
.
get
(
"Description"
);
String
errorType
=
(
String
)
contentMaps
.
get
(
"ErrorType"
);
if
(
StringUtil
.
isNotEmpty
(
errorCode
)
&&
StringUtil
.
isNotEmpty
(
description
))
{
SwiftTranslationErrorInfo
stErrorInfo
=
new
SwiftTranslationErrorInfo
();
if
(
errorCode
.
indexOf
(
"("
)
>
-
1
)
{
errorCode
=
errorCode
.
substring
(
0
,
errorCode
.
indexOf
(
"("
));
}
stErrorInfo
.
setErrorCode
(
errorCode
.
trim
());
stErrorInfo
.
setDescription
(
description
.
trim
());
stErrorInfo
.
setErrorType
(
errorType
.
trim
());
stErrorInfos
.
add
(
stErrorInfo
);
}
stErrorInfo
.
setErrorCode
(
errorCode
.
trim
());
stErrorInfo
.
setDescription
(
description
.
trim
());
stErrorInfo
.
setErrorType
(
errorType
.
trim
());
stErrorInfos
.
add
(
stErrorInfo
);
}
}
}
catch
(
Exception
e
)
{
stErrorInfos
=
null
;
//如果出现异常,stErrorInfos=null,下次仍需初始化
throw
e
;
}
}
SwiftTranslationErrorInfo
tmpErrorInfo
=
null
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment