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
2a37b2e2
Commit
2a37b2e2
authored
Jun 11, 2020
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine PropertiesLauncher close logic
Further attempt to fix Windows file issues. See gh-21575
parent
1e7da4d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
9 deletions
+8
-9
PropertiesLauncher.java
...a/org/springframework/boot/loader/PropertiesLauncher.java
+4
-9
PropertiesLauncherTests.java
.../springframework/boot/loader/PropertiesLauncherTests.java
+4
-0
No files found.
spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java
View file @
2a37b2e2
...
@@ -29,11 +29,9 @@ import java.net.URLDecoder;
...
@@ -29,11 +29,9 @@ import java.net.URLDecoder;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashSet
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.Properties
;
import
java.util.Properties
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.jar.Manifest
;
import
java.util.jar.Manifest
;
...
@@ -531,7 +529,7 @@ public class PropertiesLauncher extends Launcher {
...
@@ -531,7 +529,7 @@ public class PropertiesLauncher extends Launcher {
private
final
List
<
Archive
>
classPathArchives
;
private
final
List
<
Archive
>
classPathArchives
;
private
final
Map
<
File
,
JarFileArchive
>
jarFileArchives
=
new
LinkedHashMap
<>();
private
final
List
<
JarFileArchive
>
jarFileArchives
=
new
ArrayList
<>();
ClassPathArchives
()
throws
Exception
{
ClassPathArchives
()
throws
Exception
{
this
.
classPathArchives
=
new
ArrayList
<>();
this
.
classPathArchives
=
new
ArrayList
<>();
...
@@ -666,11 +664,8 @@ public class PropertiesLauncher extends Launcher {
...
@@ -666,11 +664,8 @@ public class PropertiesLauncher extends Launcher {
}
}
private
JarFileArchive
getJarFileArchive
(
File
file
)
throws
IOException
{
private
JarFileArchive
getJarFileArchive
(
File
file
)
throws
IOException
{
JarFileArchive
archive
=
this
.
jarFileArchives
.
get
(
file
);
JarFileArchive
archive
=
new
JarFileArchive
(
file
);
if
(
archive
==
null
)
{
this
.
jarFileArchives
.
add
(
archive
);
archive
=
new
JarFileArchive
(
file
);
this
.
jarFileArchives
.
put
(
file
,
archive
);
}
return
archive
;
return
archive
;
}
}
...
@@ -680,7 +675,7 @@ public class PropertiesLauncher extends Launcher {
...
@@ -680,7 +675,7 @@ public class PropertiesLauncher extends Launcher {
}
}
void
close
()
throws
IOException
{
void
close
()
throws
IOException
{
for
(
JarFileArchive
archive
:
this
.
jarFileArchives
.
values
()
)
{
for
(
JarFileArchive
archive
:
this
.
jarFileArchives
)
{
archive
.
close
();
archive
.
close
();
}
}
}
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java
View file @
2a37b2e2
...
@@ -389,6 +389,10 @@ class PropertiesLauncherTests {
...
@@ -389,6 +389,10 @@ class PropertiesLauncherTests {
this
.
launcher
.
launch
(
new
String
[
0
]);
this
.
launcher
.
launch
(
new
String
[
0
]);
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
// Expected ClassNotFoundException
LaunchedURLClassLoader
classLoader
=
(
LaunchedURLClassLoader
)
Thread
.
currentThread
()
.
getContextClassLoader
();
classLoader
.
close
();
}
}
URL
resource
=
new
URL
(
"jar:"
+
jarFile
.
toURI
()
+
"!/nested.jar!/3.dat"
);
URL
resource
=
new
URL
(
"jar:"
+
jarFile
.
toURI
()
+
"!/nested.jar!/3.dat"
);
byte
[]
bytes
=
FileCopyUtils
.
copyToByteArray
(
resource
.
openStream
());
byte
[]
bytes
=
FileCopyUtils
.
copyToByteArray
(
resource
.
openStream
());
...
...
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