Skip to content

Commit ad1248e

Browse files
committed
Replace "folder" with "directory"
Consistently use the term "directory" instead of "folder" Closes gh-21218
1 parent ec871d6 commit ad1248e

File tree

98 files changed

+851
-833
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+851
-833
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void checkTemplateLocationExists() {
9696
* MarkupTemplateEngine could be loaded from groovy-templates or groovy-all.
9797
* Unfortunately it's quite common for people to use groovy-all and not actually
9898
* need templating support. This method attempts to check the source jar so that
99-
* we can skip the {@code /template} folder check for such cases.
99+
* we can skip the {@code /template} directory check for such cases.
100100
* @return true if the groovy-all jar is used
101101
*/
102102
private boolean isUsingGroovyAllJar() {

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisAutoConfigurationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,13 @@ void embeddedServiceWithCustomArtemisConfiguration() {
245245

246246
@Test
247247
void embeddedWithPersistentMode(@TempDir Path temp) throws IOException {
248-
File dataFolder = Files.createTempDirectory(temp, null).toFile();
248+
File dataDirectory = Files.createTempDirectory(temp, null).toFile();
249249
final String messageId = UUID.randomUUID().toString();
250250
// Start the server and post a message to some queue
251251
this.contextRunner.withUserConfiguration(EmptyConfiguration.class)
252252
.withPropertyValues("spring.artemis.embedded.queues=TestQueue",
253253
"spring.artemis.embedded.persistent:true",
254-
"spring.artemis.embedded.dataDirectory:" + dataFolder.getAbsolutePath())
254+
"spring.artemis.embedded.dataDirectory:" + dataDirectory.getAbsolutePath())
255255
.run((context) -> context.getBean(JmsTemplate.class).send("TestQueue",
256256
(session) -> session.createTextMessage(messageId)))
257257
.run((context) -> {

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryCustomizerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ void testCustomizeTomcatMinSpareThreads() {
147147
@Test
148148
void sessionStoreDir() {
149149
Map<String, String> map = new HashMap<>();
150-
map.put("server.servlet.session.store-dir", "myfolder");
150+
map.put("server.servlet.session.store-dir", "mydirectory");
151151
bindProperties(map);
152152
ConfigurableServletWebServerFactory factory = mock(ConfigurableServletWebServerFactory.class);
153153
this.customizer.customize(factory);
154154
ArgumentCaptor<Session> sessionCaptor = ArgumentCaptor.forClass(Session.class);
155155
verify(factory).setSession(sessionCaptor.capture());
156-
assertThat(sessionCaptor.getValue().getStoreDir()).isEqualTo(new File("myfolder"));
156+
assertThat(sessionCaptor.getValue().getStoreDir()).isEqualTo(new File("mydirectory"));
157157
}
158158

159159
@Test

spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ResourceMatcher.java

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -66,23 +66,23 @@ List<MatchedResource> find(List<File> roots) throws IOException {
6666
matchedResources.add(new MatchedResource(root));
6767
}
6868
else {
69-
matchedResources.addAll(findInFolder(root));
69+
matchedResources.addAll(findInDirectory(root));
7070
}
7171
}
7272
return matchedResources;
7373
}
7474

75-
private List<MatchedResource> findInFolder(File folder) throws IOException {
75+
private List<MatchedResource> findInDirectory(File directory) throws IOException {
7676
List<MatchedResource> matchedResources = new ArrayList<>();
7777

7878
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(
79-
new FolderResourceLoader(folder));
79+
new DirectoryResourceLoader(directory));
8080

8181
for (String include : this.includes) {
8282
for (Resource candidate : resolver.getResources(include)) {
8383
File file = candidate.getFile();
8484
if (file.isFile()) {
85-
MatchedResource matchedResource = new MatchedResource(folder, file);
85+
MatchedResource matchedResource = new MatchedResource(directory, file);
8686
if (!isExcluded(matchedResource)) {
8787
matchedResources.add(matchedResource);
8888
}
@@ -130,31 +130,31 @@ else if (!value.trim().isEmpty()) {
130130
}
131131

132132
/**
133-
* {@link ResourceLoader} to get load resource from a folder.
133+
* {@link ResourceLoader} to get load resource from a directory.
134134
*/
135-
private static class FolderResourceLoader extends DefaultResourceLoader {
135+
private static class DirectoryResourceLoader extends DefaultResourceLoader {
136136

137-
private final File rootFolder;
137+
private final File rootDirectory;
138138

139-
FolderResourceLoader(File root) throws MalformedURLException {
140-
super(new FolderClassLoader(root));
141-
this.rootFolder = root;
139+
DirectoryResourceLoader(File root) throws MalformedURLException {
140+
super(new DirectoryClassLoader(root));
141+
this.rootDirectory = root;
142142
}
143143

144144
@Override
145145
protected Resource getResourceByPath(String path) {
146-
return new FileSystemResource(new File(this.rootFolder, path));
146+
return new FileSystemResource(new File(this.rootDirectory, path));
147147
}
148148

149149
}
150150

151151
/**
152-
* {@link ClassLoader} backed by a folder.
152+
* {@link ClassLoader} backed by a directory.
153153
*/
154-
private static class FolderClassLoader extends URLClassLoader {
154+
private static class DirectoryClassLoader extends URLClassLoader {
155155

156-
FolderClassLoader(File rootFolder) throws MalformedURLException {
157-
super(new URL[] { rootFolder.toURI().toURL() });
156+
DirectoryClassLoader(File rootDirectory) throws MalformedURLException {
157+
super(new URL[] { rootDirectory.toURI().toURL() });
158158
}
159159

160160
@Override
@@ -186,9 +186,10 @@ private MatchedResource(File file) {
186186
this.root = this.name.endsWith(".jar");
187187
}
188188

189-
private MatchedResource(File rootFolder, File file) {
190-
this.name = StringUtils
191-
.cleanPath(file.getAbsolutePath().substring(rootFolder.getAbsolutePath().length() + 1));
189+
private MatchedResource(File rootDirectory, File file) {
190+
String filePath = file.getAbsolutePath();
191+
String rootDirectoryPath = rootDirectory.getAbsolutePath();
192+
this.name = StringUtils.cleanPath(filePath.substring(rootDirectoryPath.length() + 1));
192193
this.file = file;
193194
this.root = false;
194195
}

spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,24 @@ private boolean isZipArchive(ProjectGenerationResponse entity) {
9090
}
9191

9292
private void extractProject(ProjectGenerationResponse entity, String output, boolean overwrite) throws IOException {
93-
File outputFolder = (output != null) ? new File(output) : new File(System.getProperty("user.dir"));
94-
if (!outputFolder.exists()) {
95-
outputFolder.mkdirs();
93+
File outputDirectory = (output != null) ? new File(output) : new File(System.getProperty("user.dir"));
94+
if (!outputDirectory.exists()) {
95+
outputDirectory.mkdirs();
9696
}
9797
try (ZipInputStream zipStream = new ZipInputStream(new ByteArrayInputStream(entity.getContent()))) {
98-
extractFromStream(zipStream, overwrite, outputFolder);
99-
fixExecutableFlag(outputFolder, "mvnw");
100-
fixExecutableFlag(outputFolder, "gradlew");
101-
Log.info("Project extracted to '" + outputFolder.getAbsolutePath() + "'");
98+
extractFromStream(zipStream, overwrite, outputDirectory);
99+
fixExecutableFlag(outputDirectory, "mvnw");
100+
fixExecutableFlag(outputDirectory, "gradlew");
101+
Log.info("Project extracted to '" + outputDirectory.getAbsolutePath() + "'");
102102
}
103103
}
104104

105-
private void extractFromStream(ZipInputStream zipStream, boolean overwrite, File outputFolder) throws IOException {
105+
private void extractFromStream(ZipInputStream zipStream, boolean overwrite, File outputDirectory)
106+
throws IOException {
106107
ZipEntry entry = zipStream.getNextEntry();
107-
String canonicalOutputPath = outputFolder.getCanonicalPath() + File.separator;
108+
String canonicalOutputPath = outputDirectory.getCanonicalPath() + File.separator;
108109
while (entry != null) {
109-
File file = new File(outputFolder, entry.getName());
110+
File file = new File(outputDirectory, entry.getName());
110111
String canonicalEntryPath = file.getCanonicalPath();
111112
if (!canonicalEntryPath.startsWith(canonicalOutputPath)) {
112113
throw new ReportableException("Entry '" + entry.getName() + "' would be written to '"

spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/FileWatchingFailureHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@
1919
import java.util.Set;
2020
import java.util.concurrent.CountDownLatch;
2121

22-
import org.springframework.boot.devtools.classpath.ClassPathFolders;
22+
import org.springframework.boot.devtools.classpath.ClassPathDirectories;
2323
import org.springframework.boot.devtools.filewatch.ChangedFiles;
2424
import org.springframework.boot.devtools.filewatch.FileChangeListener;
2525
import org.springframework.boot.devtools.filewatch.FileSystemWatcher;
@@ -44,7 +44,7 @@ class FileWatchingFailureHandler implements FailureHandler {
4444
public Outcome handle(Throwable failure) {
4545
CountDownLatch latch = new CountDownLatch(1);
4646
FileSystemWatcher watcher = this.fileSystemWatcherFactory.getFileSystemWatcher();
47-
watcher.addSourceFolders(new ClassPathFolders(Restarter.getInstance().getInitialUrls()));
47+
watcher.addSourceDirectories(new ClassPathDirectories(Restarter.getInstance().getInitialUrls()));
4848
watcher.addListener(new Listener(latch));
4949
watcher.start();
5050
try {

spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -148,7 +148,7 @@ private FileSystemWatcher newFileSystemWatcher() {
148148
}
149149
List<File> additionalPaths = restartProperties.getAdditionalPaths();
150150
for (File path : additionalPaths) {
151-
watcher.addSourceFolder(path.getAbsoluteFile());
151+
watcher.addSourceDirectory(path.getAbsoluteFile());
152152
}
153153
return watcher;
154154
}

spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfiguration.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -40,10 +40,10 @@
4040
import org.springframework.boot.devtools.remote.server.HttpHeaderAccessManager;
4141
import org.springframework.boot.devtools.remote.server.HttpStatusHandler;
4242
import org.springframework.boot.devtools.remote.server.UrlHandlerMapper;
43-
import org.springframework.boot.devtools.restart.server.DefaultSourceFolderUrlFilter;
43+
import org.springframework.boot.devtools.restart.server.DefaultSourceDirectoryUrlFilter;
4444
import org.springframework.boot.devtools.restart.server.HttpRestartServer;
4545
import org.springframework.boot.devtools.restart.server.HttpRestartServerHandler;
46-
import org.springframework.boot.devtools.restart.server.SourceFolderUrlFilter;
46+
import org.springframework.boot.devtools.restart.server.SourceDirectoryUrlFilter;
4747
import org.springframework.context.annotation.Bean;
4848
import org.springframework.context.annotation.Conditional;
4949
import org.springframework.context.annotation.Configuration;
@@ -109,14 +109,14 @@ static class RemoteRestartConfiguration {
109109

110110
@Bean
111111
@ConditionalOnMissingBean
112-
SourceFolderUrlFilter remoteRestartSourceFolderUrlFilter() {
113-
return new DefaultSourceFolderUrlFilter();
112+
SourceDirectoryUrlFilter remoteRestartSourceDirectoryUrlFilter() {
113+
return new DefaultSourceDirectoryUrlFilter();
114114
}
115115

116116
@Bean
117117
@ConditionalOnMissingBean
118-
HttpRestartServer remoteRestartHttpRestartServer(SourceFolderUrlFilter sourceFolderUrlFilter) {
119-
return new HttpRestartServer(sourceFolderUrlFilter);
118+
HttpRestartServer remoteRestartHttpRestartServer(SourceDirectoryUrlFilter sourceDirectoryUrlFilter) {
119+
return new HttpRestartServer(sourceDirectoryUrlFilter);
120120
}
121121

122122
@Bean
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,18 +30,18 @@
3030
import org.springframework.util.ResourceUtils;
3131

3232
/**
33-
* Provides access to entries on the classpath that refer to folders.
33+
* Provides access to entries on the classpath that refer to directories.
3434
*
3535
* @author Phillip Webb
36-
* @since 1.3.0
36+
* @since 2.3.0
3737
*/
38-
public class ClassPathFolders implements Iterable<File> {
38+
public class ClassPathDirectories implements Iterable<File> {
3939

40-
private static final Log logger = LogFactory.getLog(ClassPathFolders.class);
40+
private static final Log logger = LogFactory.getLog(ClassPathDirectories.class);
4141

42-
private final List<File> folders = new ArrayList<>();
42+
private final List<File> directories = new ArrayList<>();
4343

44-
public ClassPathFolders(URL[] urls) {
44+
public ClassPathDirectories(URL[] urls) {
4545
if (urls != null) {
4646
addUrls(urls);
4747
}
@@ -56,7 +56,7 @@ private void addUrls(URL[] urls) {
5656
private void addUrl(URL url) {
5757
if (url.getProtocol().equals("file") && url.getPath().endsWith("/")) {
5858
try {
59-
this.folders.add(ResourceUtils.getFile(url));
59+
this.directories.add(ResourceUtils.getFile(url));
6060
}
6161
catch (Exception ex) {
6262
logger.warn(LogMessage.format("Unable to get classpath URL %s", url));
@@ -67,7 +67,7 @@ private void addUrl(URL url) {
6767

6868
@Override
6969
public Iterator<File> iterator() {
70-
return Collections.unmodifiableList(this.folders).iterator();
70+
return Collections.unmodifiableList(this.directories).iterator();
7171
}
7272

7373
}

spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcher.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@
2828
import org.springframework.util.Assert;
2929

3030
/**
31-
* Encapsulates a {@link FileSystemWatcher} to watch the local classpath folders for
31+
* Encapsulates a {@link FileSystemWatcher} to watch the local classpath directories for
3232
* changes.
3333
*
3434
* @author Phillip Webb
@@ -58,7 +58,7 @@ public ClassPathFileSystemWatcher(FileSystemWatcherFactory fileSystemWatcherFact
5858
Assert.notNull(urls, "Urls must not be null");
5959
this.fileSystemWatcher = fileSystemWatcherFactory.getFileSystemWatcher();
6060
this.restartStrategy = restartStrategy;
61-
this.fileSystemWatcher.addSourceFolders(new ClassPathFolders(urls));
61+
this.fileSystemWatcher.addSourceDirectories(new ClassPathDirectories(urls));
6262
}
6363

6464
/**

spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsHomePropertiesPostProcessor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -40,7 +40,7 @@
4040

4141
/**
4242
* {@link EnvironmentPostProcessor} to add devtools properties from the user's home
43-
* folder.
43+
* directory.
4444
*
4545
* @author Phillip Webb
4646
* @author Andy Wilkinson
@@ -93,7 +93,7 @@ private String getPropertySourceName(File file) {
9393

9494
private void addPropertySource(List<PropertySource<?>> propertySources, String fileName,
9595
Function<File, String> propertySourceNamer) {
96-
File home = getHomeFolder();
96+
File home = getHomeDirectory();
9797
File file = (home != null) ? new File(home, fileName) : null;
9898
FileSystemResource resource = (file != null) ? new FileSystemResource(file) : null;
9999
if (resource != null && resource.exists() && resource.isFile()) {
@@ -121,7 +121,7 @@ private boolean canLoadFileExtension(PropertySourceLoader loader, String name) {
121121
.anyMatch((fileExtension) -> StringUtils.endsWithIgnoreCase(name, fileExtension));
122122
}
123123

124-
protected File getHomeFolder() {
124+
protected File getHomeDirectory() {
125125
String home = System.getProperty("user.home");
126126
if (StringUtils.hasLength(home)) {
127127
return new File(home);

0 commit comments

Comments
 (0)