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
b6a0d673
Commit
b6a0d673
authored
Sep 29, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
75dbe5c2
c27d678b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
14 deletions
+11
-14
ChangeableUrls.java
...springframework/boot/devtools/restart/ChangeableUrls.java
+7
-11
ChangeableUrlsTests.java
...gframework/boot/devtools/restart/ChangeableUrlsTests.java
+4
-3
No files found.
spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ChangeableUrls.java
View file @
b6a0d673
...
@@ -104,7 +104,7 @@ final class ChangeableUrls implements Iterable<URL> {
...
@@ -104,7 +104,7 @@ final class ChangeableUrls implements Iterable<URL> {
return
Collections
.<
URL
>
emptyList
();
return
Collections
.<
URL
>
emptyList
();
}
}
try
{
try
{
return
getUrlsFromManifestClassPathAttribute
(
jarFile
);
return
getUrlsFromManifestClassPathAttribute
(
url
,
jarFile
);
}
}
catch
(
IOException
ex
)
{
catch
(
IOException
ex
)
{
throw
new
IllegalStateException
(
throw
new
IllegalStateException
(
...
@@ -126,8 +126,8 @@ final class ChangeableUrls implements Iterable<URL> {
...
@@ -126,8 +126,8 @@ final class ChangeableUrls implements Iterable<URL> {
return
null
;
return
null
;
}
}
private
static
List
<
URL
>
getUrlsFromManifestClassPathAttribute
(
JarFile
jarFile
)
private
static
List
<
URL
>
getUrlsFromManifestClassPathAttribute
(
URL
jarUrl
,
throws
IOException
{
JarFile
jarFile
)
throws
IOException
{
Manifest
manifest
=
jarFile
.
getManifest
();
Manifest
manifest
=
jarFile
.
getManifest
();
if
(
manifest
==
null
)
{
if
(
manifest
==
null
)
{
return
Collections
.<
URL
>
emptyList
();
return
Collections
.<
URL
>
emptyList
();
...
@@ -139,16 +139,12 @@ final class ChangeableUrls implements Iterable<URL> {
...
@@ -139,16 +139,12 @@ final class ChangeableUrls implements Iterable<URL> {
}
}
String
[]
entries
=
StringUtils
.
delimitedListToStringArray
(
classPath
,
" "
);
String
[]
entries
=
StringUtils
.
delimitedListToStringArray
(
classPath
,
" "
);
List
<
URL
>
urls
=
new
ArrayList
<>(
entries
.
length
);
List
<
URL
>
urls
=
new
ArrayList
<>(
entries
.
length
);
File
parent
=
new
File
(
jarFile
.
getName
()).
getParentFile
();
List
<
URL
>
nonExistentEntries
=
new
ArrayList
<>();
List
<
File
>
nonExistentEntries
=
new
ArrayList
<>();
for
(
String
entry
:
entries
)
{
for
(
String
entry
:
entries
)
{
try
{
try
{
File
referenced
=
new
File
(
entry
);
URL
referenced
=
new
URL
(
jarUrl
,
entry
);
if
(!
referenced
.
isAbsolute
())
{
if
(
new
File
(
referenced
.
getFile
()).
exists
())
{
referenced
=
new
File
(
parent
,
entry
);
urls
.
add
(
referenced
);
}
if
(
referenced
.
exists
())
{
urls
.
add
(
referenced
.
toURI
().
toURL
());
}
}
else
{
else
{
nonExistentEntries
.
add
(
referenced
);
nonExistentEntries
.
add
(
referenced
);
...
...
spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/ChangeableUrlsTests.java
View file @
b6a0d673
...
@@ -75,11 +75,12 @@ public class ChangeableUrlsTests {
...
@@ -75,11 +75,12 @@ public class ChangeableUrlsTests {
@Test
@Test
public
void
urlsFromJarClassPathAreConsidered
()
throws
Exception
{
public
void
urlsFromJarClassPathAreConsidered
()
throws
Exception
{
File
relative
=
this
.
temporaryFolder
.
newFolder
();
File
relative
=
this
.
temporaryFolder
.
newFolder
();
File
absolute
=
this
.
temporaryFolder
.
newFolder
();
File
absoluteFile
=
this
.
temporaryFolder
.
newFolder
();
URL
absoluteUrl
=
this
.
temporaryFolder
.
newFolder
().
toURI
().
toURL
();
File
jarWithClassPath
=
makeJarFileWithUrlsInManifestClassPath
(
File
jarWithClassPath
=
makeJarFileWithUrlsInManifestClassPath
(
"project-core/target/classes/"
,
"project-web/target/classes/"
,
"project-core/target/classes/"
,
"project-web/target/classes/"
,
"does-not-exist/target/classes"
,
relative
.
getName
()
+
"/"
,
"does-not-exist/target/classes"
,
relative
.
getName
()
+
"/"
,
absolute
.
getAbsolutePath
()
+
"/"
);
absolute
File
.
getAbsolutePath
()
+
"/"
,
absoluteUrl
);
new
File
(
jarWithClassPath
.
getParentFile
(),
"project-core/target/classes"
)
new
File
(
jarWithClassPath
.
getParentFile
(),
"project-core/target/classes"
)
.
mkdirs
();
.
mkdirs
();
new
File
(
jarWithClassPath
.
getParentFile
(),
"project-web/target/classes"
).
mkdirs
();
new
File
(
jarWithClassPath
.
getParentFile
(),
"project-web/target/classes"
).
mkdirs
();
...
@@ -89,7 +90,7 @@ public class ChangeableUrlsTests {
...
@@ -89,7 +90,7 @@ public class ChangeableUrlsTests {
assertThat
(
urls
.
toList
()).
containsExactly
(
assertThat
(
urls
.
toList
()).
containsExactly
(
new
URL
(
jarWithClassPath
.
toURI
().
toURL
(),
"project-core/target/classes/"
),
new
URL
(
jarWithClassPath
.
toURI
().
toURL
(),
"project-core/target/classes/"
),
new
URL
(
jarWithClassPath
.
toURI
().
toURL
(),
"project-web/target/classes/"
),
new
URL
(
jarWithClassPath
.
toURI
().
toURL
(),
"project-web/target/classes/"
),
relative
.
toURI
().
toURL
(),
absolute
.
toURI
().
toURL
()
);
relative
.
toURI
().
toURL
(),
absolute
File
.
toURI
().
toURL
(),
absoluteUrl
);
}
}
private
URL
makeUrl
(
String
name
)
throws
IOException
{
private
URL
makeUrl
(
String
name
)
throws
IOException
{
...
...
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