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
667ccdae
Commit
667ccdae
authored
Oct 13, 2020
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify temp directory creation and improve diagnostics
Closes gh-23622
parent
ce70e7d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
8 deletions
+6
-8
SpringBootMockServletContext.java
...work/boot/test/mock/web/SpringBootMockServletContext.java
+3
-4
AbstractConfigurableWebServerFactory.java
...boot/web/server/AbstractConfigurableWebServerFactory.java
+3
-4
No files found.
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/web/SpringBootMockServletContext.java
View file @
667ccdae
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -20,6 +20,7 @@ import java.io.File;
import
java.io.IOException
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.nio.file.Files
;
import
org.springframework.core.io.FileSystemResourceLoader
;
import
org.springframework.core.io.Resource
;
...
...
@@ -93,9 +94,7 @@ public class SpringBootMockServletContext extends MockServletContext {
try
{
if
(
this
.
emptyRootFolder
==
null
)
{
synchronized
(
this
)
{
File
tempFolder
=
File
.
createTempFile
(
"spr"
,
"servlet"
);
tempFolder
.
delete
();
tempFolder
.
mkdirs
();
File
tempFolder
=
Files
.
createTempDirectory
(
"spr-servlet"
).
toFile
();
tempFolder
.
deleteOnExit
();
this
.
emptyRootFolder
=
tempFolder
;
}
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/AbstractConfigurableWebServerFactory.java
View file @
667ccdae
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -19,6 +19,7 @@ package org.springframework.boot.web.server;
import
java.io.File
;
import
java.io.IOException
;
import
java.net.InetAddress
;
import
java.nio.file.Files
;
import
java.util.Arrays
;
import
java.util.LinkedHashSet
;
import
java.util.Set
;
...
...
@@ -169,9 +170,7 @@ public abstract class AbstractConfigurableWebServerFactory implements Configurab
*/
protected
final
File
createTempDir
(
String
prefix
)
{
try
{
File
tempDir
=
File
.
createTempFile
(
prefix
+
"."
,
"."
+
getPort
());
tempDir
.
delete
();
tempDir
.
mkdir
();
File
tempDir
=
Files
.
createTempDirectory
(
prefix
+
"."
+
getPort
()
+
"."
).
toFile
();
tempDir
.
deleteOnExit
();
return
tempDir
;
}
...
...
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