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
c14f5fb6
Commit
c14f5fb6
authored
Nov 23, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Fix handling of spaces in container's document root"
Closes gh-10706
parent
8031a1bd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
15 deletions
+13
-15
AbstractEmbeddedServletContainerFactory.java
...ext/embedded/AbstractEmbeddedServletContainerFactory.java
+7
-11
AbstractEmbeddedServletContainerFactoryTests.java
...mbedded/AbstractEmbeddedServletContainerFactoryTests.java
+6
-4
No files found.
spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java
View file @
c14f5fb6
...
...
@@ -19,7 +19,6 @@ package org.springframework.boot.context.embedded;
import
java.io.File
;
import
java.io.IOException
;
import
java.net.JarURLConnection
;
import
java.net.URISyntaxException
;
import
java.net.URL
;
import
java.net.URLClassLoader
;
import
java.net.URLConnection
;
...
...
@@ -88,7 +87,7 @@ public abstract class AbstractEmbeddedServletContainerFactory
}
private
File
getExplodedWarFileDocumentRoot
()
{
return
getExplodedWarFileDocumentRoot
(
getCodeSourceArchive
(
getCodeSource
()
));
return
getExplodedWarFileDocumentRoot
(
getCodeSourceArchive
());
}
protected
List
<
URL
>
getUrlsOfJarsWithMetaInfResources
()
{
...
...
@@ -173,7 +172,7 @@ public abstract class AbstractEmbeddedServletContainerFactory
}
private
File
getArchiveFileDocumentRoot
(
String
extension
)
{
File
file
=
getCodeSourceArchive
(
getCodeSource
()
);
File
file
=
getCodeSourceArchive
();
if
(
this
.
logger
.
isDebugEnabled
())
{
this
.
logger
.
debug
(
"Code archive: "
+
file
);
}
...
...
@@ -194,6 +193,10 @@ public abstract class AbstractEmbeddedServletContainerFactory
return
null
;
}
private
File
getCodeSourceArchive
()
{
return
getCodeSourceArchive
(
getClass
().
getProtectionDomain
().
getCodeSource
());
}
File
getCodeSourceArchive
(
CodeSource
codeSource
)
{
try
{
URL
location
=
(
codeSource
==
null
?
null
:
codeSource
.
getLocation
());
...
...
@@ -213,16 +216,9 @@ public abstract class AbstractEmbeddedServletContainerFactory
}
return
new
File
(
path
);
}
catch
(
IO
Exception
ex
)
{
catch
(
Exception
ex
)
{
return
null
;
}
catch
(
URISyntaxException
e
)
{
return
null
;
}
}
private
CodeSource
getCodeSource
()
{
return
getClass
().
getProtectionDomain
().
getCodeSource
();
}
protected
final
File
getValidSessionStoreDir
()
{
...
...
spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java
View file @
c14f5fb6
...
...
@@ -678,16 +678,18 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
@Test
public
void
codeSourceArchivePath
()
throws
Exception
{
AbstractEmbeddedServletContainerFactory
factory
=
getFactory
();
final
CodeSource
codeSource
=
new
CodeSource
(
new
URL
(
"file"
,
""
,
"/some/test/path/"
),
(
Certificate
[])
null
);
final
File
codeSourceArchive
=
factory
.
getCodeSourceArchive
(
codeSource
);
CodeSource
codeSource
=
new
CodeSource
(
new
URL
(
"file"
,
""
,
"/some/test/path/"
),
(
Certificate
[])
null
);
File
codeSourceArchive
=
factory
.
getCodeSourceArchive
(
codeSource
);
assertThat
(
codeSourceArchive
).
isEqualTo
(
new
File
(
"/some/test/path/"
));
}
@Test
public
void
codeSourceArchivePathContainingSpaces
()
throws
Exception
{
AbstractEmbeddedServletContainerFactory
factory
=
getFactory
();
final
CodeSource
codeSource
=
new
CodeSource
(
new
URL
(
"file"
,
""
,
"/test/path/with%20space/"
),
(
Certificate
[])
null
);
final
File
codeSourceArchive
=
factory
.
getCodeSourceArchive
(
codeSource
);
CodeSource
codeSource
=
new
CodeSource
(
new
URL
(
"file"
,
""
,
"/test/path/with%20space/"
),
(
Certificate
[])
null
);
File
codeSourceArchive
=
factory
.
getCodeSourceArchive
(
codeSource
);
assertThat
(
codeSourceArchive
).
isEqualTo
(
new
File
(
"/test/path/with space/"
));
}
...
...
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