Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
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
DEMO
spring-boot
Commits
bbc34a67
Commit
bbc34a67
authored
Jul 21, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Handle possible regexes defensively in NamePatternFilter"
Closes gh-9730
parent
c29d1c75
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
NamePatternFilter.java
...ramework/boot/actuate/endpoint/mvc/NamePatternFilter.java
+5
-5
NamePatternFilterTests.java
...ork/boot/actuate/endpoint/mvc/NamePatternFilterTests.java
+1
-1
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/NamePatternFilter.java
View file @
bbc34a67
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -46,8 +46,8 @@ abstract class NamePatternFilter<T> {
}
public
Map
<
String
,
Object
>
getResults
(
String
name
)
{
Pattern
pattern
=
getRegexPattern
(
name
);
if
(
pattern
==
null
)
{
// this is not a regex
Pattern
pattern
=
compilePatternIfNecessary
(
name
);
if
(
pattern
==
null
)
{
Object
value
=
getValue
(
this
.
source
,
name
);
Map
<
String
,
Object
>
result
=
new
HashMap
<
String
,
Object
>();
result
.
put
(
name
,
value
);
...
...
@@ -60,13 +60,13 @@ abstract class NamePatternFilter<T> {
}
private
Pattern
getRegexPattern
(
String
name
)
{
private
Pattern
compilePatternIfNecessary
(
String
name
)
{
for
(
String
part
:
REGEX_PARTS
)
{
if
(
name
.
contains
(
part
))
{
try
{
return
Pattern
.
compile
(
name
);
}
catch
(
PatternSyntaxException
e
)
{
catch
(
PatternSyntaxException
e
x
)
{
return
null
;
}
}
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/NamePatternFilterTests.java
View file @
bbc34a67
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
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