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
4bb84234
Commit
4bb84234
authored
Aug 14, 2019
by
jason
Committed by
Stephane Nicoll
Aug 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify some code
See gh-17860
parent
e8effad0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
11 additions
and
18 deletions
+11
-18
RequestPredicateFactory.java
...uate/endpoint/web/annotation/RequestPredicateFactory.java
+1
-3
Health.java
.../java/org/springframework/boot/actuate/health/Health.java
+1
-1
HealthWebEndpointResponseMapper.java
.../boot/actuate/health/HealthWebEndpointResponseMapper.java
+2
-5
Status.java
.../java/org/springframework/boot/actuate/health/Status.java
+1
-1
Info.java
...main/java/org/springframework/boot/actuate/info/Info.java
+1
-1
PlainTextThreadDumpFormatter.java
...boot/actuate/management/PlainTextThreadDumpFormatter.java
+1
-3
AuditEventTests.java
...g/springframework/boot/actuate/audit/AuditEventTests.java
+4
-4
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/RequestPredicateFactory.java
View file @
4bb84234
...
@@ -123,9 +123,7 @@ class RequestPredicateFactory {
...
@@ -123,9 +123,7 @@ class RequestPredicateFactory {
}
}
if
(
WebEndpointResponse
.
class
.
isAssignableFrom
(
method
.
getReturnType
()))
{
if
(
WebEndpointResponse
.
class
.
isAssignableFrom
(
method
.
getReturnType
()))
{
ResolvableType
returnType
=
ResolvableType
.
forMethodReturnType
(
method
);
ResolvableType
returnType
=
ResolvableType
.
forMethodReturnType
(
method
);
if
(
ResolvableType
.
forClass
(
Resource
.
class
).
isAssignableFrom
(
returnType
.
getGeneric
(
0
)))
{
return
ResolvableType
.
forClass
(
Resource
.
class
).
isAssignableFrom
(
returnType
.
getGeneric
(
0
));
return
true
;
}
}
}
return
false
;
return
false
;
}
}
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Health.java
View file @
4bb84234
...
@@ -89,7 +89,7 @@ public final class Health {
...
@@ -89,7 +89,7 @@ public final class Health {
if
(
obj
==
this
)
{
if
(
obj
==
this
)
{
return
true
;
return
true
;
}
}
if
(
obj
!=
null
&&
obj
instanceof
Health
)
{
if
(
obj
instanceof
Health
)
{
Health
other
=
(
Health
)
obj
;
Health
other
=
(
Health
)
obj
;
return
this
.
status
.
equals
(
other
.
status
)
&&
this
.
details
.
equals
(
other
.
details
);
return
this
.
status
.
equals
(
other
.
status
)
&&
this
.
details
.
equals
(
other
.
details
);
}
}
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapper.java
View file @
4bb84234
...
@@ -97,11 +97,8 @@ public class HealthWebEndpointResponseMapper {
...
@@ -97,11 +97,8 @@ public class HealthWebEndpointResponseMapper {
}
}
private
boolean
canSeeDetails
(
SecurityContext
securityContext
,
ShowDetails
showDetails
)
{
private
boolean
canSeeDetails
(
SecurityContext
securityContext
,
ShowDetails
showDetails
)
{
if
(
showDetails
==
ShowDetails
.
NEVER
||
(
showDetails
==
ShowDetails
.
WHEN_AUTHORIZED
return
showDetails
!=
ShowDetails
.
NEVER
&&
(
showDetails
!=
ShowDetails
.
WHEN_AUTHORIZED
&&
(
securityContext
.
getPrincipal
()
==
null
||
!
isUserInRole
(
securityContext
))))
{
||
(
securityContext
.
getPrincipal
()
!=
null
&&
isUserInRole
(
securityContext
)));
return
false
;
}
return
true
;
}
}
private
boolean
isUserInRole
(
SecurityContext
securityContext
)
{
private
boolean
isUserInRole
(
SecurityContext
securityContext
)
{
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Status.java
View file @
4bb84234
...
@@ -107,7 +107,7 @@ public final class Status {
...
@@ -107,7 +107,7 @@ public final class Status {
if
(
obj
==
this
)
{
if
(
obj
==
this
)
{
return
true
;
return
true
;
}
}
if
(
obj
!=
null
&&
obj
instanceof
Status
)
{
if
(
obj
instanceof
Status
)
{
return
ObjectUtils
.
nullSafeEquals
(
this
.
code
,
((
Status
)
obj
).
code
);
return
ObjectUtils
.
nullSafeEquals
(
this
.
code
,
((
Status
)
obj
).
code
);
}
}
return
false
;
return
false
;
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/Info.java
View file @
4bb84234
...
@@ -71,7 +71,7 @@ public final class Info {
...
@@ -71,7 +71,7 @@ public final class Info {
if
(
obj
==
this
)
{
if
(
obj
==
this
)
{
return
true
;
return
true
;
}
}
if
(
obj
!=
null
&&
obj
instanceof
Info
)
{
if
(
obj
instanceof
Info
)
{
Info
other
=
(
Info
)
obj
;
Info
other
=
(
Info
)
obj
;
return
this
.
details
.
equals
(
other
.
details
);
return
this
.
details
.
equals
(
other
.
details
);
}
}
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/PlainTextThreadDumpFormatter.java
View file @
4bb84234
...
@@ -83,9 +83,7 @@ class PlainTextThreadDumpFormatter {
...
@@ -83,9 +83,7 @@ class PlainTextThreadDumpFormatter {
LockInfo
lockInfo
=
info
.
getLockInfo
();
LockInfo
lockInfo
=
info
.
getLockInfo
();
if
(
firstElement
&&
lockInfo
!=
null
)
{
if
(
firstElement
&&
lockInfo
!=
null
)
{
if
(
element
.
getClassName
().
equals
(
Object
.
class
.
getName
())
&&
element
.
getMethodName
().
equals
(
"wait"
))
{
if
(
element
.
getClassName
().
equals
(
Object
.
class
.
getName
())
&&
element
.
getMethodName
().
equals
(
"wait"
))
{
if
(
lockInfo
!=
null
)
{
writer
.
printf
(
"\t- waiting on %s%n"
,
format
(
lockInfo
));
writer
.
printf
(
"\t- waiting on %s%n"
,
format
(
lockInfo
));
}
}
}
else
{
else
{
String
lockOwner
=
info
.
getLockOwnerName
();
String
lockOwner
=
info
.
getLockOwnerName
();
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventTests.java
View file @
4bb84234
...
@@ -36,7 +36,7 @@ class AuditEventTests {
...
@@ -36,7 +36,7 @@ class AuditEventTests {
@Test
@Test
void
nowEvent
()
{
void
nowEvent
()
{
AuditEvent
event
=
new
AuditEvent
(
"phil"
,
"UNKNOWN"
,
Collections
.
singletonMap
(
"a"
,
(
Object
)
"b"
));
AuditEvent
event
=
new
AuditEvent
(
"phil"
,
"UNKNOWN"
,
Collections
.
singletonMap
(
"a"
,
"b"
));
assertThat
(
event
.
getData
().
get
(
"a"
)).
isEqualTo
(
"b"
);
assertThat
(
event
.
getData
().
get
(
"a"
)).
isEqualTo
(
"b"
);
assertThat
(
event
.
getType
()).
isEqualTo
(
"UNKNOWN"
);
assertThat
(
event
.
getType
()).
isEqualTo
(
"UNKNOWN"
);
assertThat
(
event
.
getPrincipal
()).
isEqualTo
(
"phil"
);
assertThat
(
event
.
getPrincipal
()).
isEqualTo
(
"phil"
);
...
@@ -52,21 +52,21 @@ class AuditEventTests {
...
@@ -52,21 +52,21 @@ class AuditEventTests {
@Test
@Test
void
nullPrincipalIsMappedToEmptyString
()
{
void
nullPrincipalIsMappedToEmptyString
()
{
AuditEvent
auditEvent
=
new
AuditEvent
(
null
,
"UNKNOWN"
,
Collections
.
singletonMap
(
"a"
,
(
Object
)
"b"
));
AuditEvent
auditEvent
=
new
AuditEvent
(
null
,
"UNKNOWN"
,
Collections
.
singletonMap
(
"a"
,
"b"
));
assertThat
(
auditEvent
.
getPrincipal
()).
isEmpty
();
assertThat
(
auditEvent
.
getPrincipal
()).
isEmpty
();
}
}
@Test
@Test
void
nullTimestamp
()
{
void
nullTimestamp
()
{
assertThatIllegalArgumentException
()
assertThatIllegalArgumentException
()
.
isThrownBy
(()
->
new
AuditEvent
(
null
,
"phil"
,
"UNKNOWN"
,
Collections
.
singletonMap
(
"a"
,
(
Object
)
"b"
)))
.
isThrownBy
(()
->
new
AuditEvent
(
null
,
"phil"
,
"UNKNOWN"
,
Collections
.
singletonMap
(
"a"
,
"b"
)))
.
withMessageContaining
(
"Timestamp must not be null"
);
.
withMessageContaining
(
"Timestamp must not be null"
);
}
}
@Test
@Test
void
nullType
()
{
void
nullType
()
{
assertThatIllegalArgumentException
()
assertThatIllegalArgumentException
()
.
isThrownBy
(()
->
new
AuditEvent
(
"phil"
,
null
,
Collections
.
singletonMap
(
"a"
,
(
Object
)
"b"
)))
.
isThrownBy
(()
->
new
AuditEvent
(
"phil"
,
null
,
Collections
.
singletonMap
(
"a"
,
"b"
)))
.
withMessageContaining
(
"Type must not be null"
);
.
withMessageContaining
(
"Type must not be 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