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
ef2eb2f6
Commit
ef2eb2f6
authored
Dec 14, 2019
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove accidental usage of Plexus's CollectionUtils
See gh-16655 and
8f5777cf
parent
1b1c61a2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
14 deletions
+24
-14
JarLauncherTests.java
...ava/org/springframework/boot/loader/JarLauncherTests.java
+5
-3
PropertiesLauncherTests.java
.../springframework/boot/loader/PropertiesLauncherTests.java
+14
-8
WarLauncherTests.java
...ava/org/springframework/boot/loader/WarLauncherTests.java
+5
-3
No files found.
spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/JarLauncherTests.java
View file @
ef2eb2f6
...
...
@@ -18,9 +18,9 @@ package org.springframework.boot.loader;
import
java.io.File
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.codehaus.plexus.util.CollectionUtils
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.loader.archive.Archive
;
...
...
@@ -40,7 +40,8 @@ class JarLauncherTests extends AbstractExecutableArchiveLauncherTests {
void
explodedJarHasOnlyBootInfClassesAndContentsOfBootInfLibOnClasspath
()
throws
Exception
{
File
explodedRoot
=
explode
(
createJarArchive
(
"archive.jar"
,
"BOOT-INF"
));
JarLauncher
launcher
=
new
JarLauncher
(
new
ExplodedArchive
(
explodedRoot
,
true
));
List
<
Archive
>
archives
=
CollectionUtils
.
iteratorToList
(
launcher
.
getClassPathArchivesIterator
());
List
<
Archive
>
archives
=
new
ArrayList
<>();
launcher
.
getClassPathArchivesIterator
().
forEachRemaining
(
archives:
:
add
);
assertThat
(
archives
).
hasSize
(
2
);
assertThat
(
getUrls
(
archives
)).
containsOnly
(
new
File
(
explodedRoot
,
"BOOT-INF/classes"
).
toURI
().
toURL
(),
new
File
(
explodedRoot
,
"BOOT-INF/lib/foo.jar"
).
toURI
().
toURL
());
...
...
@@ -54,7 +55,8 @@ class JarLauncherTests extends AbstractExecutableArchiveLauncherTests {
File
jarRoot
=
createJarArchive
(
"archive.jar"
,
"BOOT-INF"
);
try
(
JarFileArchive
archive
=
new
JarFileArchive
(
jarRoot
))
{
JarLauncher
launcher
=
new
JarLauncher
(
archive
);
List
<
Archive
>
classPathArchives
=
CollectionUtils
.
iteratorToList
(
launcher
.
getClassPathArchivesIterator
());
List
<
Archive
>
classPathArchives
=
new
ArrayList
<>();
launcher
.
getClassPathArchivesIterator
().
forEachRemaining
(
classPathArchives:
:
add
);
assertThat
(
classPathArchives
).
hasSize
(
2
);
assertThat
(
getUrls
(
classPathArchives
)).
containsOnly
(
new
URL
(
"jar:"
+
jarRoot
.
toURI
().
toURL
()
+
"!/BOOT-INF/classes!/"
),
...
...
spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java
View file @
ef2eb2f6
...
...
@@ -30,7 +30,6 @@ import java.util.jar.Manifest;
import
org.assertj.core.api.Condition
;
import
org.awaitility.Awaitility
;
import
org.codehaus.plexus.util.CollectionUtils
;
import
org.junit.jupiter.api.AfterEach
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
...
...
@@ -140,7 +139,8 @@ class PropertiesLauncherTests {
System
.
setProperty
(
"loader.path"
,
"jars/"
);
PropertiesLauncher
launcher
=
new
PropertiesLauncher
();
assertThat
(
ReflectionTestUtils
.
getField
(
launcher
,
"paths"
).
toString
()).
isEqualTo
(
"[jars/]"
);
List
<
Archive
>
archives
=
CollectionUtils
.
iteratorToList
(
launcher
.
getClassPathArchivesIterator
());
List
<
Archive
>
archives
=
new
ArrayList
<>();
launcher
.
getClassPathArchivesIterator
().
forEachRemaining
(
archives:
:
add
);
assertThat
(
archives
).
areExactly
(
1
,
endingWith
(
"app.jar"
));
}
...
...
@@ -170,7 +170,8 @@ class PropertiesLauncherTests {
PropertiesLauncher
launcher
=
new
PropertiesLauncher
();
assertThat
(
ReflectionTestUtils
.
getField
(
launcher
,
"paths"
).
toString
())
.
isEqualTo
(
"[jar:file:./src/test/resources/nested-jars/app.jar!/]"
);
List
<
Archive
>
archives
=
CollectionUtils
.
iteratorToList
(
launcher
.
getClassPathArchivesIterator
());
List
<
Archive
>
archives
=
new
ArrayList
<>();
launcher
.
getClassPathArchivesIterator
().
forEachRemaining
(
archives:
:
add
);
assertThat
(
archives
).
areExactly
(
1
,
endingWith
(
"foo.jar!/"
));
assertThat
(
archives
).
areExactly
(
1
,
endingWith
(
"app.jar"
));
}
...
...
@@ -179,7 +180,8 @@ class PropertiesLauncherTests {
void
testUserSpecifiedRootOfJarPathWithDot
()
throws
Exception
{
System
.
setProperty
(
"loader.path"
,
"nested-jars/app.jar!/./"
);
PropertiesLauncher
launcher
=
new
PropertiesLauncher
();
List
<
Archive
>
archives
=
CollectionUtils
.
iteratorToList
(
launcher
.
getClassPathArchivesIterator
());
List
<
Archive
>
archives
=
new
ArrayList
<>();
launcher
.
getClassPathArchivesIterator
().
forEachRemaining
(
archives:
:
add
);
assertThat
(
archives
).
areExactly
(
1
,
endingWith
(
"foo.jar!/"
));
assertThat
(
archives
).
areExactly
(
1
,
endingWith
(
"app.jar"
));
}
...
...
@@ -188,7 +190,8 @@ class PropertiesLauncherTests {
void
testUserSpecifiedRootOfJarPathWithDotAndJarPrefix
()
throws
Exception
{
System
.
setProperty
(
"loader.path"
,
"jar:file:./src/test/resources/nested-jars/app.jar!/./"
);
PropertiesLauncher
launcher
=
new
PropertiesLauncher
();
List
<
Archive
>
archives
=
CollectionUtils
.
iteratorToList
(
launcher
.
getClassPathArchivesIterator
());
List
<
Archive
>
archives
=
new
ArrayList
<>();
launcher
.
getClassPathArchivesIterator
().
forEachRemaining
(
archives:
:
add
);
assertThat
(
archives
).
areExactly
(
1
,
endingWith
(
"foo.jar!/"
));
}
...
...
@@ -197,7 +200,8 @@ class PropertiesLauncherTests {
System
.
setProperty
(
"loader.path"
,
"nested-jars/app.jar"
);
System
.
setProperty
(
"loader.main"
,
"demo.Application"
);
PropertiesLauncher
launcher
=
new
PropertiesLauncher
();
List
<
Archive
>
archives
=
CollectionUtils
.
iteratorToList
(
launcher
.
getClassPathArchivesIterator
());
List
<
Archive
>
archives
=
new
ArrayList
<>();
launcher
.
getClassPathArchivesIterator
().
forEachRemaining
(
archives:
:
add
);
assertThat
(
archives
).
areExactly
(
1
,
endingWith
(
"foo.jar!/"
));
assertThat
(
archives
).
areExactly
(
1
,
endingWith
(
"app.jar"
));
}
...
...
@@ -207,7 +211,8 @@ class PropertiesLauncherTests {
System
.
setProperty
(
"loader.path"
,
"nested-jars/app.jar!/foo.jar"
);
System
.
setProperty
(
"loader.main"
,
"demo.Application"
);
PropertiesLauncher
launcher
=
new
PropertiesLauncher
();
List
<
Archive
>
archives
=
CollectionUtils
.
iteratorToList
(
launcher
.
getClassPathArchivesIterator
());
List
<
Archive
>
archives
=
new
ArrayList
<>();
launcher
.
getClassPathArchivesIterator
().
forEachRemaining
(
archives:
:
add
);
assertThat
(
archives
).
hasSize
(
1
).
areExactly
(
1
,
endingWith
(
"foo.jar!/"
));
}
...
...
@@ -336,7 +341,8 @@ class PropertiesLauncherTests {
loaderPath
.
mkdir
();
System
.
setProperty
(
"loader.path"
,
loaderPath
.
toURI
().
toURL
().
toString
());
PropertiesLauncher
launcher
=
new
PropertiesLauncher
();
List
<
Archive
>
archives
=
CollectionUtils
.
iteratorToList
(
launcher
.
getClassPathArchivesIterator
());
List
<
Archive
>
archives
=
new
ArrayList
<>();
launcher
.
getClassPathArchivesIterator
().
forEachRemaining
(
archives:
:
add
);
assertThat
(
archives
.
size
()).
isEqualTo
(
1
);
File
archiveRoot
=
(
File
)
ReflectionTestUtils
.
getField
(
archives
.
get
(
0
),
"root"
);
assertThat
(
archiveRoot
).
isEqualTo
(
loaderPath
);
...
...
spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/WarLauncherTests.java
View file @
ef2eb2f6
...
...
@@ -18,9 +18,9 @@ package org.springframework.boot.loader;
import
java.io.File
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.codehaus.plexus.util.CollectionUtils
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.loader.archive.Archive
;
...
...
@@ -40,7 +40,8 @@ class WarLauncherTests extends AbstractExecutableArchiveLauncherTests {
void
explodedWarHasOnlyWebInfClassesAndContentsOfWebInfLibOnClasspath
()
throws
Exception
{
File
explodedRoot
=
explode
(
createJarArchive
(
"archive.war"
,
"WEB-INF"
));
WarLauncher
launcher
=
new
WarLauncher
(
new
ExplodedArchive
(
explodedRoot
,
true
));
List
<
Archive
>
archives
=
CollectionUtils
.
iteratorToList
(
launcher
.
getClassPathArchivesIterator
());
List
<
Archive
>
archives
=
new
ArrayList
<>();
launcher
.
getClassPathArchivesIterator
().
forEachRemaining
(
archives:
:
add
);
assertThat
(
archives
).
hasSize
(
2
);
assertThat
(
getUrls
(
archives
)).
containsOnly
(
new
File
(
explodedRoot
,
"WEB-INF/classes"
).
toURI
().
toURL
(),
new
File
(
explodedRoot
,
"WEB-INF/lib/foo.jar"
).
toURI
().
toURL
());
...
...
@@ -54,7 +55,8 @@ class WarLauncherTests extends AbstractExecutableArchiveLauncherTests {
File
jarRoot
=
createJarArchive
(
"archive.war"
,
"WEB-INF"
);
try
(
JarFileArchive
archive
=
new
JarFileArchive
(
jarRoot
))
{
WarLauncher
launcher
=
new
WarLauncher
(
archive
);
List
<
Archive
>
classPathArchives
=
CollectionUtils
.
iteratorToList
(
launcher
.
getClassPathArchivesIterator
());
List
<
Archive
>
classPathArchives
=
new
ArrayList
<>();
launcher
.
getClassPathArchivesIterator
().
forEachRemaining
(
classPathArchives:
:
add
);
assertThat
(
classPathArchives
).
hasSize
(
2
);
assertThat
(
getUrls
(
classPathArchives
)).
containsOnly
(
new
URL
(
"jar:"
+
jarRoot
.
toURI
().
toURL
()
+
"!/WEB-INF/classes!/"
),
...
...
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