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
bcfb1d17
Commit
bcfb1d17
authored
Oct 11, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
325b2b09
c44b912f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
16 deletions
+51
-16
UndertowServletWebServer.java
.../boot/web/embedded/undertow/UndertowServletWebServer.java
+24
-8
UndertowWebServer.java
...amework/boot/web/embedded/undertow/UndertowWebServer.java
+24
-8
UndertowServletWebServerFactoryTests.java
...bedded/undertow/UndertowServletWebServerFactoryTests.java
+3
-0
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java
View file @
bcfb1d17
...
@@ -159,20 +159,36 @@ public class UndertowServletWebServer implements WebServer {
...
@@ -159,20 +159,36 @@ public class UndertowServletWebServer implements WebServer {
.
info
(
"Undertow started on port(s) "
+
getPortsDescription
());
.
info
(
"Undertow started on port(s) "
+
getPortsDescription
());
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
if
(
findBindException
(
ex
)
!=
null
)
{
try
{
List
<
Port
>
failedPorts
=
getConfiguredPorts
();
if
(
findBindException
(
ex
)
!=
null
)
{
List
<
Port
>
actualPorts
=
getActualPorts
();
List
<
Port
>
failedPorts
=
getConfiguredPorts
();
failedPorts
.
removeAll
(
actualPorts
);
List
<
Port
>
actualPorts
=
getActualPorts
();
if
(
failedPorts
.
size
()
==
1
)
{
failedPorts
.
removeAll
(
actualPorts
);
throw
new
PortInUseException
(
if
(
failedPorts
.
size
()
==
1
)
{
failedPorts
.
iterator
().
next
().
getNumber
());
throw
new
PortInUseException
(
failedPorts
.
iterator
().
next
().
getNumber
());
}
}
}
throw
new
WebServerException
(
"Unable to start embedded Undertow"
,
ex
);
}
finally
{
stopSilently
();
}
}
throw
new
WebServerException
(
"Unable to start embedded Undertow"
,
ex
);
}
}
}
}
}
}
private
void
stopSilently
()
{
try
{
if
(
this
.
undertow
!=
null
)
{
this
.
undertow
.
stop
();
}
}
catch
(
Exception
ex
)
{
// Ignore
}
}
private
BindException
findBindException
(
Exception
ex
)
{
private
BindException
findBindException
(
Exception
ex
)
{
Throwable
candidate
=
ex
;
Throwable
candidate
=
ex
;
while
(
candidate
!=
null
)
{
while
(
candidate
!=
null
)
{
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java
View file @
bcfb1d17
...
@@ -88,20 +88,36 @@ public class UndertowWebServer implements WebServer {
...
@@ -88,20 +88,36 @@ public class UndertowWebServer implements WebServer {
.
info
(
"Undertow started on port(s) "
+
getPortsDescription
());
.
info
(
"Undertow started on port(s) "
+
getPortsDescription
());
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
if
(
findBindException
(
ex
)
!=
null
)
{
try
{
List
<
UndertowWebServer
.
Port
>
failedPorts
=
getConfiguredPorts
();
if
(
findBindException
(
ex
)
!=
null
)
{
List
<
UndertowWebServer
.
Port
>
actualPorts
=
getActualPorts
();
List
<
UndertowWebServer
.
Port
>
failedPorts
=
getConfiguredPorts
();
failedPorts
.
removeAll
(
actualPorts
);
List
<
UndertowWebServer
.
Port
>
actualPorts
=
getActualPorts
();
if
(
failedPorts
.
size
()
==
1
)
{
failedPorts
.
removeAll
(
actualPorts
);
throw
new
PortInUseException
(
if
(
failedPorts
.
size
()
==
1
)
{
failedPorts
.
iterator
().
next
().
getNumber
());
throw
new
PortInUseException
(
failedPorts
.
iterator
().
next
().
getNumber
());
}
}
}
throw
new
WebServerException
(
"Unable to start embedded Undertow"
,
ex
);
}
finally
{
stopSilently
();
}
}
throw
new
WebServerException
(
"Unable to start embedded Undertow"
,
ex
);
}
}
}
}
}
}
private
void
stopSilently
()
{
try
{
if
(
this
.
undertow
!=
null
)
{
this
.
undertow
.
stop
();
}
}
catch
(
Exception
ex
)
{
// Ignore
}
}
private
BindException
findBindException
(
Exception
ex
)
{
private
BindException
findBindException
(
Exception
ex
)
{
Throwable
candidate
=
ex
;
Throwable
candidate
=
ex
;
while
(
candidate
!=
null
)
{
while
(
candidate
!=
null
)
{
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java
View file @
bcfb1d17
...
@@ -303,6 +303,9 @@ public class UndertowServletWebServerFactoryTests
...
@@ -303,6 +303,9 @@ public class UndertowServletWebServerFactoryTests
int
blockedPort
)
{
int
blockedPort
)
{
assertThat
(
ex
).
isInstanceOf
(
PortInUseException
.
class
);
assertThat
(
ex
).
isInstanceOf
(
PortInUseException
.
class
);
assertThat
(((
PortInUseException
)
ex
).
getPort
()).
isEqualTo
(
blockedPort
);
assertThat
(((
PortInUseException
)
ex
).
getPort
()).
isEqualTo
(
blockedPort
);
Object
undertow
=
ReflectionTestUtils
.
getField
(
this
.
webServer
,
"undertow"
);
Object
worker
=
ReflectionTestUtils
.
getField
(
undertow
,
"worker"
);
assertThat
(
worker
).
isNull
();
}
}
}
}
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