Browse Source

Merge pull request #17825 from dreis2211

* pr/17825:
  Polish some Collections API calls

Closes gh-17825
pull/17834/head
Stephane Nicoll 7 years ago
parent
commit
01491befc3
  1. 2
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jndi/JndiPropertiesHidingClassLoader.java
  2. 2
      spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java
  3. 2
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializerTests.java

2
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jndi/JndiPropertiesHidingClassLoader.java

@ -36,7 +36,7 @@ public class JndiPropertiesHidingClassLoader extends ClassLoader { @@ -36,7 +36,7 @@ public class JndiPropertiesHidingClassLoader extends ClassLoader {
@Override
public Enumeration<URL> getResources(String name) throws IOException {
if ("jndi.properties".equals(name)) {
return Collections.enumeration(Collections.emptyList());
return Collections.emptyEnumeration();
}
return super.getResources(name);
}

2
spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java

@ -173,7 +173,7 @@ public class ExplodedArchive implements Archive { @@ -173,7 +173,7 @@ public class ExplodedArchive implements Archive {
private Iterator<File> listFiles(File file) {
File[] files = file.listFiles();
if (files == null) {
return Collections.<File>emptyList().iterator();
return Collections.emptyIterator();
}
Arrays.sort(files, this.entryComparator);
return Arrays.asList(files).iterator();

2
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializerTests.java

@ -129,7 +129,7 @@ class SpringBootServletInitializerTests { @@ -129,7 +129,7 @@ class SpringBootServletInitializerTests {
given(servletContext.getInitParameterNames())
.willReturn(Collections.enumeration(Collections.singletonList("spring.profiles.active")));
given(servletContext.getInitParameter("spring.profiles.active")).willReturn("from-servlet-context");
given(servletContext.getAttributeNames()).willReturn(Collections.enumeration(Collections.emptyList()));
given(servletContext.getAttributeNames()).willReturn(Collections.emptyEnumeration());
try (ConfigurableApplicationContext context = (ConfigurableApplicationContext) new PropertySourceVerifyingSpringBootServletInitializer()
.createRootApplicationContext(servletContext)) {
assertThat(context.getEnvironment().getActiveProfiles()).containsExactly("from-servlet-context");

Loading…
Cancel
Save