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
c22018aa
Commit
c22018aa
authored
Dec 14, 2014
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
f1c893e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
StartupInfoLogger.java
...main/java/org/springframework/boot/StartupInfoLogger.java
+14
-7
No files found.
spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java
View file @
c22018aa
...
...
@@ -17,11 +17,13 @@
package
org
.
springframework
.
boot
;
import
java.io.File
;
import
java.io.IOException
;
import
java.lang.management.ManagementFactory
;
import
java.net.InetAddress
;
import
java.net.JarURLConnection
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.security.CodeSource
;
import
java.security.ProtectionDomain
;
import
java.util.concurrent.Callable
;
...
...
@@ -162,15 +164,13 @@ class StartupInfoLogger {
try
{
ProtectionDomain
protectionDomain
=
(
this
.
sourceClass
==
null
?
getClass
()
:
this
.
sourceClass
).
getProtectionDomain
();
CodeSource
codeSource
=
protectionDomain
.
getCodeSource
();
if
(
codeSource
==
null
)
{
return
null
;
}
URL
location
=
protectionDomain
.
getCodeSource
().
getLocation
();
File
file
;
URLConnection
connection
=
location
.
openConnection
();
if
(
connection
instanceof
JarURLConnection
)
{
file
=
new
File
(((
JarURLConnection
)
connection
).
getJarFile
().
getName
());
}
else
{
file
=
new
File
(
location
.
getPath
());
}
File
file
=
getFile
(
location
,
connection
);
if
(
file
.
exists
())
{
return
file
;
}
...
...
@@ -180,6 +180,13 @@ class StartupInfoLogger {
return
null
;
}
private
File
getFile
(
URL
location
,
URLConnection
connection
)
throws
IOException
{
if
(
connection
instanceof
JarURLConnection
)
{
return
new
File
(((
JarURLConnection
)
connection
).
getJarFile
().
getName
());
}
return
new
File
(
location
.
getPath
());
}
private
String
getValue
(
String
prefix
,
Callable
<
Object
>
call
)
{
return
getValue
(
prefix
,
call
,
""
);
}
...
...
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