See gh-13148
This commit is contained in:
Johnny Lim
2018-05-12 01:00:40 +09:00
committed by Stephane Nicoll
parent d96724077c
commit 3dd2f5bb05
9 changed files with 33 additions and 35 deletions

View File

@@ -17,7 +17,9 @@
package org.springframework.boot.configurationmetadata;
import java.text.BreakIterator;
import java.util.Arrays;
import java.util.Locale;
import java.util.stream.Collectors;
/**
* Utility to extract the first sentence of a text.
@@ -45,11 +47,7 @@ class SentenceExtractor {
private String removeSpaceBetweenLine(String text) {
String[] lines = text.split(System.lineSeparator());
StringBuilder sb = new StringBuilder();
for (String line : lines) {
sb.append(line.trim()).append(" ");
}
return sb.toString().trim();
return Arrays.stream(lines).map(String::trim).collect(Collectors.joining(" "));
}
}

View File

@@ -42,7 +42,7 @@ public class ZipHeaderPeekInputStreamTests {
}
@Test
public void hasZipHeaderReturnsFalseWheStreamDoesNotStartWithZipHeader()
public void hasZipHeaderReturnsFalseWhenStreamDoesNotStartWithZipHeader()
throws IOException {
try (ZipHeaderPeekInputStream in = new ZipHeaderPeekInputStream(
new ByteArrayInputStream(new byte[] { 0, 1, 2, 3, 4, 5 }))) {

View File

@@ -496,7 +496,7 @@ public class JarFileTests {
.openConnection().getInputStream().close();
this.thrown.expect(FileNotFoundException.class);
new URL(context, "jar:" + this.rootJarFile.toURI() + "!/no.dat")
.openConnection().getInputStream().close();
.openConnection().getInputStream();
}
finally {
JarURLConnection.setUseFastExceptions(false);