Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
chnmuseum-party
Project
Project
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
liqin
chnmuseum-party
Commits
6ba5decd
Commit
6ba5decd
authored
Apr 12, 2021
by
liqin
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixed
parent
ab92ccf8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
GlobalExceptionAdvisor.java
...gy/chnmuseum/party/common/mvc/GlobalExceptionAdvisor.java
+7
-6
No files found.
src/main/java/cn/wisenergy/chnmuseum/party/common/mvc/GlobalExceptionAdvisor.java
View file @
6ba5decd
...
@@ -73,7 +73,7 @@ public class GlobalExceptionAdvisor {
...
@@ -73,7 +73,7 @@ public class GlobalExceptionAdvisor {
@ExceptionHandler
(
BindException
.
class
)
@ExceptionHandler
(
BindException
.
class
)
@ResponseBody
@ResponseBody
public
cn
.
wisenergy
.
chnmuseum
.
party
.
common
.
validator
.
HttpResult
handle
(
BindException
ex
)
{
public
cn
.
wisenergy
.
chnmuseum
.
party
.
common
.
validator
.
HttpResult
handle
(
BindException
ex
)
{
String
message
1
=
ex
.
getBindingResult
().
getAllErrors
().
stream
().
map
(
DefaultMessageSourceResolvable:
:
getDefaultMessage
).
collect
(
Collectors
.
joining
(
" \n "
));
String
message
=
ex
.
getBindingResult
().
getAllErrors
().
stream
().
map
(
DefaultMessageSourceResolvable:
:
getDefaultMessage
).
collect
(
Collectors
.
joining
(
" \n "
));
// BindingResult bindingResult = ex.getBindingResult();
// BindingResult bindingResult = ex.getBindingResult();
// StringBuilder errMsg = new StringBuilder(bindingResult.getFieldErrors().size() * 16);
// StringBuilder errMsg = new StringBuilder(bindingResult.getFieldErrors().size() * 16);
// errMsg.append("Invalid request:");
// errMsg.append("Invalid request:");
...
@@ -84,12 +84,13 @@ public class GlobalExceptionAdvisor {
...
@@ -84,12 +84,13 @@ public class GlobalExceptionAdvisor {
// FieldError error = bindingResult.getFieldErrors().get(i);
// FieldError error = bindingResult.getFieldErrors().get(i);
// errMsg.append(error.getField()).append(":").append(error.getDefaultMessage());
// errMsg.append(error.getField()).append(":").append(error.getDefaultMessage());
// }
// }
String
message1
=
Splitter
.
onPattern
(
"\r\n|\n|\r"
).
trimResults
().
splitToList
(
ex
.
getLocalizedMessage
()).
get
(
1
);
String
message
=
Splitter
.
onPattern
(
"\r\n|\n|\r"
).
trimResults
().
splitToList
(
ex
.
getLocalizedMessage
()).
get
(
1
);
if
(
message1
!=
null
)
{
String
substring
=
message
.
substring
(
message
.
indexOf
(
"on field"
),
message
.
indexOf
(
"rejected value"
));
String
substring
=
message1
.
substring
(
message1
.
indexOf
(
"on field"
),
message1
.
indexOf
(
"rejected value"
));
if
(
substring
.
toUpperCase
().
contains
(
"REMARKS"
))
{
if
(
substring
.
toUpperCase
().
contains
(
"REMARKS"
))
{
return
new
cn
.
wisenergy
.
chnmuseum
.
party
.
common
.
validator
.
HttpResult
(
"400"
,
"备注"
+
message1
,
""
);
return
new
cn
.
wisenergy
.
chnmuseum
.
party
.
common
.
validator
.
HttpResult
(
"400"
,
"备注"
+
message1
,
""
);
}
}
}
return
new
cn
.
wisenergy
.
chnmuseum
.
party
.
common
.
validator
.
HttpResult
(
"400"
,
message1
,
""
);
return
new
cn
.
wisenergy
.
chnmuseum
.
party
.
common
.
validator
.
HttpResult
(
"400"
,
message1
,
""
);
}
}
...
...
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