Skip to content

Commit 9e55e8f

Browse files
committed
Polishing
1 parent a55a0f2 commit 9e55e8f

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/ScriptUtils.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 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.
@@ -168,11 +168,11 @@ public static void splitSqlScript(EncodedResource resource, String script, Strin
168168
String blockCommentStartDelimiter, String blockCommentEndDelimiter, List<String> statements)
169169
throws ScriptException {
170170

171-
Assert.hasText(script, "script must not be null or empty");
172-
Assert.notNull(separator, "separator must not be null");
173-
Assert.hasText(commentPrefix, "commentPrefix must not be null or empty");
174-
Assert.hasText(blockCommentStartDelimiter, "blockCommentStartDelimiter must not be null or empty");
175-
Assert.hasText(blockCommentEndDelimiter, "blockCommentEndDelimiter must not be null or empty");
171+
Assert.hasText(script, "'script' must not be null or empty");
172+
Assert.notNull(separator, "'separator' must not be null");
173+
Assert.hasText(commentPrefix, "'commentPrefix' must not be null or empty");
174+
Assert.hasText(blockCommentStartDelimiter, "'blockCommentStartDelimiter' must not be null or empty");
175+
Assert.hasText(blockCommentEndDelimiter, "'blockCommentEndDelimiter' must not be null or empty");
176176

177177
StringBuilder sb = new StringBuilder();
178178
boolean inSingleQuote = false;

spring-web/src/main/java/org/springframework/http/MediaTypeFactory.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,8 @@ public class MediaTypeFactory {
4343

4444
private static final String MIME_TYPES_FILE_NAME = "/org/springframework/http/mime.types";
4545

46-
private static final MultiValueMap<String, MediaType> fileExtensionToMediaTypes;
46+
private static final MultiValueMap<String, MediaType> fileExtensionToMediaTypes = parseMimeTypes();
4747

48-
static {
49-
fileExtensionToMediaTypes = parseMimeTypes();
50-
}
5148

5249
/**
5350
* Parse the {@code mime.types} file found in the resources. Format is:
@@ -65,9 +62,7 @@ private static MultiValueMap<String, MediaType> parseMimeTypes() {
6562
InputStream is = null;
6663
try {
6764
is = MediaTypeFactory.class.getResourceAsStream(MIME_TYPES_FILE_NAME);
68-
BufferedReader reader =
69-
new BufferedReader(new InputStreamReader(is, StandardCharsets.US_ASCII));
70-
65+
BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.US_ASCII));
7166
MultiValueMap<String, MediaType> result = new LinkedMultiValueMap<>();
7267
String line;
7368
while ((line = reader.readLine()) != null) {
@@ -76,7 +71,6 @@ private static MultiValueMap<String, MediaType> parseMimeTypes() {
7671
}
7772
String[] tokens = StringUtils.tokenizeToStringArray(line, " \t\n\r\f");
7873
MediaType mediaType = MediaType.parseMediaType(tokens[0]);
79-
8074
for (int i = 1; i < tokens.length; i++) {
8175
String fileExtension = tokens[i].toLowerCase(Locale.ENGLISH);
8276
result.add(fileExtension, mediaType);

0 commit comments

Comments
 (0)