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
34fee1ad
Commit
34fee1ad
authored
Apr 03, 2019
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
8ad9bfe2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
75 additions
and
28 deletions
+75
-28
AppOpticsMetricsExportAutoConfigurationTests.java
...poptics/AppOpticsMetricsExportAutoConfigurationTests.java
+1
-6
FlywayAutoConfiguration.java
...rk/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
+0
-1
ValidatorAdapter.java
...ework/boot/autoconfigure/validation/ValidatorAdapter.java
+2
-2
AbstractErrorWebExceptionHandler.java
.../web/reactive/error/AbstractErrorWebExceptionHandler.java
+18
-13
DefaultErrorWebExceptionHandlerTests.java
.../reactive/error/DefaultErrorWebExceptionHandlerTests.java
+42
-0
LoggingApplicationListener.java
...work/boot/context/logging/LoggingApplicationListener.java
+11
-5
LoggingApplicationListenerTests.java
...boot/context/logging/LoggingApplicationListenerTests.java
+1
-1
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/appoptics/AppOpticsMetricsExportAutoConfigurationTests.java
View file @
34fee1ad
...
@@ -112,12 +112,7 @@ public class AppOpticsMetricsExportAutoConfigurationTests {
...
@@ -112,12 +112,7 @@ public class AppOpticsMetricsExportAutoConfigurationTests {
@Bean
@Bean
public
AppOpticsConfig
customConfig
()
{
public
AppOpticsConfig
customConfig
()
{
return
(
key
)
->
{
return
(
key
)
->
"appoptics.apiToken"
.
equals
(
key
)
?
"abcde"
:
null
;
if
(
"appoptics.apiToken"
.
equals
(
key
))
{
return
"abcde"
;
}
return
null
;
};
}
}
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
View file @
34fee1ad
...
@@ -324,7 +324,6 @@ public class FlywayAutoConfiguration {
...
@@ -324,7 +324,6 @@ public class FlywayAutoConfiguration {
public
FlywayInitializerJdbcOperationsDependencyConfiguration
()
{
public
FlywayInitializerJdbcOperationsDependencyConfiguration
()
{
super
(
"flywayInitializer"
);
super
(
"flywayInitializer"
);
}
}
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/validation/ValidatorAdapter.java
View file @
34fee1ad
...
@@ -138,8 +138,8 @@ public class ValidatorAdapter implements SmartValidator, ApplicationContextAware
...
@@ -138,8 +138,8 @@ public class ValidatorAdapter implements SmartValidator, ApplicationContextAware
private
static
Validator
create
()
{
private
static
Validator
create
()
{
OptionalValidatorFactoryBean
validator
=
new
OptionalValidatorFactoryBean
();
OptionalValidatorFactoryBean
validator
=
new
OptionalValidatorFactoryBean
();
try
{
try
{
validator
MessageInterpolatorFactory
factory
=
new
MessageInterpolatorFactory
();
.
setMessageInterpolator
(
new
MessageInterpolatorFactory
()
.
getObject
());
validator
.
setMessageInterpolator
(
factory
.
getObject
());
}
}
catch
(
ValidationException
ex
)
{
catch
(
ValidationException
ex
)
{
// Ignore
// Ignore
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java
View file @
34fee1ad
...
@@ -16,7 +16,6 @@
...
@@ -16,7 +16,6 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
web
.
reactive
.
error
;
package
org
.
springframework
.
boot
.
autoconfigure
.
web
.
reactive
.
error
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.HashSet
;
...
@@ -63,9 +62,15 @@ public abstract class AbstractErrorWebExceptionHandler
...
@@ -63,9 +62,15 @@ public abstract class AbstractErrorWebExceptionHandler
/**
/**
* Currently duplicated from Spring WebFlux HttpWebHandlerAdapter.
* Currently duplicated from Spring WebFlux HttpWebHandlerAdapter.
*/
*/
private
static
final
Set
<
String
>
DISCONNECTED_CLIENT_EXCEPTIONS
=
new
HashSet
<>(
private
static
final
Set
<
String
>
DISCONNECTED_CLIENT_EXCEPTIONS
;
Arrays
.
asList
(
"AbortedException"
,
"ClientAbortException"
,
"EOFException"
,
static
{
"EofException"
));
Set
<
String
>
exceptions
=
new
HashSet
<>();
exceptions
.
add
(
"AbortedException"
);
exceptions
.
add
(
"ClientAbortException"
);
exceptions
.
add
(
"EOFException"
);
exceptions
.
add
(
"EofException"
);
DISCONNECTED_CLIENT_EXCEPTIONS
=
Collections
.
unmodifiableSet
(
exceptions
);
}
private
static
final
Log
logger
=
HttpLogging
private
static
final
Log
logger
=
HttpLogging
.
forLogName
(
AbstractErrorWebExceptionHandler
.
class
);
.
forLogName
(
AbstractErrorWebExceptionHandler
.
class
);
...
@@ -268,15 +273,15 @@ public abstract class AbstractErrorWebExceptionHandler
...
@@ -268,15 +273,15 @@ public abstract class AbstractErrorWebExceptionHandler
}
}
private
boolean
isDisconnectedClientError
(
Throwable
ex
)
{
private
boolean
isDisconnectedClientError
(
Throwable
ex
)
{
String
message
=
NestedExceptionUtils
.
getMostSpecificCause
(
ex
).
getMessage
();
return
DISCONNECTED_CLIENT_EXCEPTIONS
.
contains
(
ex
.
getClass
().
getSimpleName
())
if
(
message
!=
null
)
{
||
isDisconnectedClientErrorMessage
(
String
text
=
message
.
toLowerCase
(
);
NestedExceptionUtils
.
getMostSpecificCause
(
ex
).
getMessage
()
);
if
(
text
.
contains
(
"broken pipe"
)
}
||
text
.
contains
(
"connection reset by peer"
))
{
return
true
;
private
boolean
isDisconnectedClientErrorMessage
(
String
message
)
{
}
message
=
message
!=
null
?
message
.
toLowerCase
()
:
""
;
}
return
(
message
.
contains
(
"broken pipe"
)
return
DISCONNECTED_CLIENT_EXCEPTIONS
.
contains
(
ex
.
getClass
().
getSimpleName
(
));
||
message
.
contains
(
"connection reset by peer"
));
}
}
private
void
logError
(
ServerRequest
request
,
ServerResponse
response
,
private
void
logError
(
ServerRequest
request
,
ServerResponse
response
,
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerTests.java
0 → 100644
View file @
34fee1ad
/*
* Copyright 2012-2018 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
web
.
reactive
.
error
;
import
org.junit.Test
;
import
org.springframework.test.util.ReflectionTestUtils
;
import
org.springframework.web.server.adapter.HttpWebHandlerAdapter
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
/**
* Tests for {@link AbstractErrorWebExceptionHandler}.
*
* @author Phillip Webb
*/
public
class
DefaultErrorWebExceptionHandlerTests
{
@Test
public
void
disconnectedClientExceptionsMatchesFramework
()
{
Object
errorHandlers
=
ReflectionTestUtils
.
getField
(
AbstractErrorWebExceptionHandler
.
class
,
"DISCONNECTED_CLIENT_EXCEPTIONS"
);
Object
webHandlers
=
ReflectionTestUtils
.
getField
(
HttpWebHandlerAdapter
.
class
,
"DISCONNECTED_CLIENT_EXCEPTIONS"
);
assertThat
(
errorHandlers
).
isNotNull
().
isEqualTo
(
webHandlers
);
}
}
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java
View file @
34fee1ad
...
@@ -139,7 +139,6 @@ public class LoggingApplicationListener implements GenericApplicationListener {
...
@@ -139,7 +139,6 @@ public class LoggingApplicationListener implements GenericApplicationListener {
}
}
private
static
final
Map
<
LogLevel
,
List
<
String
>>
LOG_LEVEL_LOGGERS
;
private
static
final
Map
<
LogLevel
,
List
<
String
>>
LOG_LEVEL_LOGGERS
;
static
{
static
{
MultiValueMap
<
LogLevel
,
String
>
loggers
=
new
LinkedMultiValueMap
<>();
MultiValueMap
<
LogLevel
,
String
>
loggers
=
new
LinkedMultiValueMap
<>();
loggers
.
add
(
LogLevel
.
DEBUG
,
"sql"
);
loggers
.
add
(
LogLevel
.
DEBUG
,
"sql"
);
...
@@ -320,10 +319,17 @@ public class LoggingApplicationListener implements GenericApplicationListener {
...
@@ -320,10 +319,17 @@ public class LoggingApplicationListener implements GenericApplicationListener {
}
}
protected
void
initializeLogLevel
(
LoggingSystem
system
,
LogLevel
level
)
{
protected
void
initializeLogLevel
(
LoggingSystem
system
,
LogLevel
level
)
{
LOG_LEVEL_LOGGERS
.
getOrDefault
(
level
,
Collections
.
emptyList
()).
stream
()
LOG_LEVEL_LOGGERS
.
getOrDefault
(
level
,
Collections
.
emptyList
())
.
flatMap
((
logger
)
->
DEFAULT_GROUP_LOGGERS
.
forEach
((
logger
)
->
initializeLogLevel
(
system
,
level
,
logger
));
.
getOrDefault
(
logger
,
Collections
.
singletonList
(
logger
)).
stream
())
}
.
forEach
((
logger
)
->
system
.
setLogLevel
(
logger
,
level
));
private
void
initializeLogLevel
(
LoggingSystem
system
,
LogLevel
level
,
String
logger
)
{
List
<
String
>
groupLoggers
=
DEFAULT_GROUP_LOGGERS
.
get
(
logger
);
if
(
groupLoggers
==
null
)
{
system
.
setLogLevel
(
logger
,
level
);
return
;
}
groupLoggers
.
forEach
((
groupLogger
)
->
system
.
setLogLevel
(
groupLogger
,
level
));
}
}
protected
void
setLogLevels
(
LoggingSystem
system
,
Environment
environment
)
{
protected
void
setLogLevels
(
LoggingSystem
system
,
Environment
environment
)
{
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java
View file @
34fee1ad
...
@@ -263,7 +263,7 @@ public class LoggingApplicationListenerTests {
...
@@ -263,7 +263,7 @@ public class LoggingApplicationListenerTests {
}
}
@Test
@Test
public
void
parseDebugArgExpandGroups
()
{
public
void
parseDebugArgExpand
s
Groups
()
{
TestPropertySourceUtils
.
addInlinedPropertiesToEnvironment
(
this
.
context
,
"debug"
);
TestPropertySourceUtils
.
addInlinedPropertiesToEnvironment
(
this
.
context
,
"debug"
);
this
.
initializer
.
initialize
(
this
.
context
.
getEnvironment
(),
this
.
initializer
.
initialize
(
this
.
context
.
getEnvironment
(),
this
.
context
.
getClassLoader
());
this
.
context
.
getClassLoader
());
...
...
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