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
d8b96856
Commit
d8b96856
authored
Oct 15, 2018
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support '.' in endpoint names
Update the `EndpointId` constraints to allow '.' in names. Closes gh-14773
parent
99a45bde
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
EndpointId.java
...org/springframework/boot/actuate/endpoint/EndpointId.java
+6
-6
EndpointIdTests.java
...pringframework/boot/actuate/endpoint/EndpointIdTests.java
+8
-0
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/EndpointId.java
View file @
d8b96856
...
@@ -22,16 +22,16 @@ import java.util.regex.Pattern;
...
@@ -22,16 +22,16 @@ import java.util.regex.Pattern;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
/**
/**
* An identifier for an actuator endpoint. Endpoint IDs may contain only letters
and
* An identifier for an actuator endpoint. Endpoint IDs may contain only letters
, numbers
*
numbers and must begin with a lower-case letter. Case is ignored when comparing
*
and {@code '.'}. They must begin with a lower-case letter. Case is ignored when
* endpoint IDs.
*
comparing
endpoint IDs.
*
*
* @author Phillip Webb
* @author Phillip Webb
* @since 2.0.6
* @since 2.0.6
*/
*/
public
final
class
EndpointId
{
public
final
class
EndpointId
{
private
static
final
Pattern
ALPHA_NUMERIC
=
Pattern
.
compile
(
"[a-zA-Z0-9
]+"
);
private
static
final
Pattern
VALID_CHARS
=
Pattern
.
compile
(
"[a-zA-Z0-9\\.
]+"
);
private
final
String
value
;
private
final
String
value
;
...
@@ -39,8 +39,8 @@ public final class EndpointId {
...
@@ -39,8 +39,8 @@ public final class EndpointId {
private
EndpointId
(
String
value
)
{
private
EndpointId
(
String
value
)
{
Assert
.
hasText
(
value
,
"Value must not be empty"
);
Assert
.
hasText
(
value
,
"Value must not be empty"
);
Assert
.
isTrue
(
ALPHA_NUMERIC
.
matcher
(
value
).
matches
(),
Assert
.
isTrue
(
VALID_CHARS
.
matcher
(
value
).
matches
(),
"Value must be alpha-numeric"
);
"Value must be alpha-numeric
or '.'
"
);
Assert
.
isTrue
(!
Character
.
isDigit
(
value
.
charAt
(
0
)),
Assert
.
isTrue
(!
Character
.
isDigit
(
value
.
charAt
(
0
)),
"Value must not start with a number"
);
"Value must not start with a number"
);
Assert
.
isTrue
(!
Character
.
isUpperCase
(
value
.
charAt
(
0
)),
Assert
.
isTrue
(!
Character
.
isUpperCase
(
value
.
charAt
(
0
)),
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EndpointIdTests.java
View file @
d8b96856
...
@@ -74,6 +74,14 @@ public class EndpointIdTests {
...
@@ -74,6 +74,14 @@ public class EndpointIdTests {
EndpointId
.
of
(
"Foo"
);
EndpointId
.
of
(
"Foo"
);
}
}
@Test
public
void
ofWhenContainsDotIsValid
()
{
// Ideally we wouldn't support this but there are existing endpoints using the
// pattern. See gh-14773
EndpointId
endpointId
=
EndpointId
.
of
(
"foo.bar"
);
assertThat
(
endpointId
.
toString
()).
isEqualTo
(
"foo.bar"
);
}
@Test
@Test
public
void
equalsAndHashCode
()
{
public
void
equalsAndHashCode
()
{
EndpointId
one
=
EndpointId
.
of
(
"foobar"
);
EndpointId
one
=
EndpointId
.
of
(
"foobar"
);
...
...
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