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
fd125b4a
Commit
fd125b4a
authored
Jun 21, 2018
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove assumption that a file URI can be turned into a File
Closes gh-13493
parent
f2cc6e2e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
StaticResourceJars.java
...framework/boot/web/servlet/server/StaticResourceJars.java
+12
-3
StaticResourceJarsTests.java
...work/boot/web/servlet/server/StaticResourceJarsTests.java
+8
-0
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/StaticResourceJars.java
View file @
fd125b4a
...
...
@@ -78,15 +78,24 @@ class StaticResourceJars {
throw
new
IllegalStateException
(
"Failed to create File from URL '"
+
url
+
"'"
);
}
catch
(
IllegalArgumentException
ex
)
{
return
null
;
}
}
private
void
addUrl
(
List
<
URL
>
urls
,
URL
url
)
{
try
{
if
(
"file"
.
equals
(
url
.
getProtocol
()))
{
addUrl
File
(
urls
,
url
,
toFile
(
url
));
if
(
!
"file"
.
equals
(
url
.
getProtocol
()))
{
addUrl
Connection
(
urls
,
url
,
url
.
openConnection
(
));
}
else
{
addUrlConnection
(
urls
,
url
,
url
.
openConnection
());
File
file
=
toFile
(
url
);
if
(
file
!=
null
)
{
addUrlFile
(
urls
,
url
,
file
);
}
else
{
addUrlConnection
(
urls
,
url
,
url
.
openConnection
());
}
}
}
catch
(
IOException
ex
)
{
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/StaticResourceJarsTests.java
View file @
fd125b4a
...
...
@@ -74,6 +74,14 @@ public class StaticResourceJarsTests {
assertThat
(
staticResourceJarUrls
).
hasSize
(
0
);
}
@Test
public
void
uncPathsAreTolerated
()
throws
Exception
{
File
jarFile
=
createResourcesJar
(
"test-resources.jar"
);
List
<
URL
>
staticResourceJarUrls
=
new
StaticResourceJars
().
getUrlsFrom
(
jarFile
.
toURI
().
toURL
(),
new
URL
(
"file://unc.example.com/test.jar"
));
assertThat
(
staticResourceJarUrls
).
hasSize
(
1
);
}
private
File
createResourcesJar
(
String
name
)
throws
IOException
{
return
createJar
(
name
,
(
output
)
->
{
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