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
98d27db7
Commit
98d27db7
authored
May 05, 2020
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.1.x' into 2.2.x
Closes gh-21320
parents
487329fa
df70c42f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
StaticResourceJars.java
...framework/boot/web/servlet/server/StaticResourceJars.java
+2
-1
StaticResourceJarsTests.java
...work/boot/web/servlet/server/StaticResourceJarsTests.java
+9
-0
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/StaticResourceJars.java
View file @
98d27db7
...
@@ -25,6 +25,7 @@ import java.net.URISyntaxException;
...
@@ -25,6 +25,7 @@ import java.net.URISyntaxException;
import
java.net.URL
;
import
java.net.URL
;
import
java.net.URLClassLoader
;
import
java.net.URLClassLoader
;
import
java.net.URLConnection
;
import
java.net.URLConnection
;
import
java.nio.file.InvalidPathException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.jar.JarFile
;
import
java.util.jar.JarFile
;
...
@@ -124,7 +125,7 @@ class StaticResourceJars {
...
@@ -124,7 +125,7 @@ class StaticResourceJars {
try
{
try
{
return
isResourcesJar
(
new
JarFile
(
file
));
return
isResourcesJar
(
new
JarFile
(
file
));
}
}
catch
(
IOException
ex
)
{
catch
(
IOException
|
InvalidPathException
ex
)
{
return
false
;
return
false
;
}
}
}
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/StaticResourceJarsTests.java
View file @
98d27db7
...
@@ -77,6 +77,15 @@ class StaticResourceJarsTests {
...
@@ -77,6 +77,15 @@ class StaticResourceJarsTests {
assertThat
(
staticResourceJarUrls
).
hasSize
(
1
);
assertThat
(
staticResourceJarUrls
).
hasSize
(
1
);
}
}
@Test
void
ignoreWildcardUrls
()
throws
Exception
{
File
jarFile
=
createResourcesJar
(
"test-resources.jar"
);
URL
folderUrl
=
jarFile
.
getParentFile
().
toURI
().
toURL
();
URL
wildcardUrl
=
new
URL
(
folderUrl
.
toString
()
+
"*.jar"
);
List
<
URL
>
staticResourceJarUrls
=
new
StaticResourceJars
().
getUrlsFrom
(
wildcardUrl
);
assertThat
(
staticResourceJarUrls
).
isEmpty
();
}
private
File
createResourcesJar
(
String
name
)
throws
IOException
{
private
File
createResourcesJar
(
String
name
)
throws
IOException
{
return
createJar
(
name
,
(
output
)
->
{
return
createJar
(
name
,
(
output
)
->
{
JarEntry
jarEntry
=
new
JarEntry
(
"META-INF/resources"
);
JarEntry
jarEntry
=
new
JarEntry
(
"META-INF/resources"
);
...
...
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