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
5817a016
Commit
5817a016
authored
Jan 28, 2014
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #285 from bstick12/master
* pull285: Fix TomcatContextCustomizers Assert.notNull checks
parents
be1dc647
0fdd7e18
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
8 deletions
+40
-8
TomcatEmbeddedServletContainerFactory.java
...mbedded/tomcat/TomcatEmbeddedServletContainerFactory.java
+7
-7
TomcatEmbeddedServletContainerFactoryTests.java
...ed/tomcat/TomcatEmbeddedServletContainerFactoryTests.java
+33
-1
No files found.
spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java
View file @
5817a016
...
...
@@ -371,7 +371,7 @@ public class TomcatEmbeddedServletContainerFactory extends
*/
public
void
setTomcatContextCustomizers
(
Collection
<?
extends
TomcatContextCustomizer
>
tomcatContextCustomizers
)
{
Assert
.
notNull
(
t
his
.
contextLifecycleListen
ers
,
Assert
.
notNull
(
t
omcatContextCustomiz
ers
,
"TomcatContextCustomizers must not be null"
);
this
.
tomcatContextCustomizers
=
new
ArrayList
<
TomcatContextCustomizer
>(
tomcatContextCustomizers
);
...
...
@@ -392,8 +392,8 @@ public class TomcatEmbeddedServletContainerFactory extends
* @param tomcatContextCustomizers the customizers to add
*/
public
void
addContextCustomizers
(
TomcatContextCustomizer
...
tomcatContextCustomizers
)
{
Assert
.
notNull
(
t
his
.
t
omcatContextCustomizers
,
"TomcatContextCustomizer must not be null"
);
Assert
.
notNull
(
tomcatContextCustomizers
,
"TomcatContextCustomizer
s
must not be null"
);
this
.
tomcatContextCustomizers
.
addAll
(
Arrays
.
asList
(
tomcatContextCustomizers
));
}
...
...
@@ -404,8 +404,8 @@ public class TomcatEmbeddedServletContainerFactory extends
*/
public
void
setTomcatConnectorCustomizers
(
Collection
<?
extends
TomcatConnectorCustomizer
>
tomcatConnectorCustomizers
)
{
Assert
.
notNull
(
t
his
.
contextLifecycleListen
ers
,
"TomcatConnectorCustomizer must not be null"
);
Assert
.
notNull
(
t
omcatConnectorCustomiz
ers
,
"TomcatConnectorCustomizer
s
must not be null"
);
this
.
tomcatConnectorCustomizers
=
new
ArrayList
<
TomcatConnectorCustomizer
>(
tomcatConnectorCustomizers
);
}
...
...
@@ -417,8 +417,8 @@ public class TomcatEmbeddedServletContainerFactory extends
*/
public
void
addConnectorCustomizers
(
TomcatConnectorCustomizer
...
tomcatConnectorCustomizers
)
{
Assert
.
notNull
(
t
his
.
tomcatContext
Customizers
,
"TomcatConnectorCustomizer must not be null"
);
Assert
.
notNull
(
t
omcatConnector
Customizers
,
"TomcatConnectorCustomizer
s
must not be null"
);
this
.
tomcatConnectorCustomizers
.
addAll
(
Arrays
.
asList
(
tomcatConnectorCustomizers
));
}
...
...
spring-boot/src/test/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactoryTests.java
View file @
5817a016
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
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.
...
...
@@ -138,6 +138,38 @@ public class TomcatEmbeddedServletContainerFactoryTests extends
verify
(
valve
).
setNext
(
any
(
Valve
.
class
));
}
@Test
public
void
setNullTomcatContextCustomizersThrows
()
{
TomcatEmbeddedServletContainerFactory
factory
=
getFactory
();
this
.
thrown
.
expect
(
IllegalArgumentException
.
class
);
this
.
thrown
.
expectMessage
(
"TomcatContextCustomizers must not be null"
);
factory
.
setTomcatContextCustomizers
(
null
);
}
@Test
public
void
addNullContextCustomizersThrows
()
{
TomcatEmbeddedServletContainerFactory
factory
=
getFactory
();
this
.
thrown
.
expect
(
IllegalArgumentException
.
class
);
this
.
thrown
.
expectMessage
(
"TomcatContextCustomizers must not be null"
);
factory
.
addContextCustomizers
((
TomcatContextCustomizer
[])
null
);
}
@Test
public
void
setNullTomcatConnectorCustomizersThrows
()
{
TomcatEmbeddedServletContainerFactory
factory
=
getFactory
();
this
.
thrown
.
expect
(
IllegalArgumentException
.
class
);
this
.
thrown
.
expectMessage
(
"TomcatConnectorCustomizers must not be null"
);
factory
.
setTomcatConnectorCustomizers
(
null
);
}
@Test
public
void
addNullConnectorCustomizersThrows
()
{
TomcatEmbeddedServletContainerFactory
factory
=
getFactory
();
this
.
thrown
.
expect
(
IllegalArgumentException
.
class
);
this
.
thrown
.
expectMessage
(
"TomcatConnectorCustomizers must not be null"
);
factory
.
addConnectorCustomizers
((
TomcatConnectorCustomizer
[])
null
);
}
private
void
assertTimeout
(
TomcatEmbeddedServletContainerFactory
factory
,
int
expected
)
{
this
.
container
=
factory
.
getEmbeddedServletContainer
();
Tomcat
tomcat
=
((
TomcatEmbeddedServletContainer
)
this
.
container
).
getTomcat
();
...
...
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