Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -168,11 +168,11 @@ public abstract class ScriptUtils {
|
|||||||
String blockCommentStartDelimiter, String blockCommentEndDelimiter, List<String> statements)
|
String blockCommentStartDelimiter, String blockCommentEndDelimiter, List<String> statements)
|
||||||
throws ScriptException {
|
throws ScriptException {
|
||||||
|
|
||||||
Assert.hasText(script, "script must not be null or empty");
|
Assert.hasText(script, "'script' must not be null or empty");
|
||||||
Assert.notNull(separator, "separator must not be null");
|
Assert.notNull(separator, "'separator' must not be null");
|
||||||
Assert.hasText(commentPrefix, "commentPrefix must not be null or empty");
|
Assert.hasText(commentPrefix, "'commentPrefix' must not be null or empty");
|
||||||
Assert.hasText(blockCommentStartDelimiter, "blockCommentStartDelimiter must not be null or empty");
|
Assert.hasText(blockCommentStartDelimiter, "'blockCommentStartDelimiter' must not be null or empty");
|
||||||
Assert.hasText(blockCommentEndDelimiter, "blockCommentEndDelimiter must not be null or empty");
|
Assert.hasText(blockCommentEndDelimiter, "'blockCommentEndDelimiter' must not be null or empty");
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
boolean inSingleQuote = false;
|
boolean inSingleQuote = false;
|
||||||
|
|||||||
@@ -43,11 +43,8 @@ public class MediaTypeFactory {
|
|||||||
|
|
||||||
private static final String MIME_TYPES_FILE_NAME = "/org/springframework/http/mime.types";
|
private static final String MIME_TYPES_FILE_NAME = "/org/springframework/http/mime.types";
|
||||||
|
|
||||||
private static final MultiValueMap<String, MediaType> fileExtensionToMediaTypes;
|
private static final MultiValueMap<String, MediaType> fileExtensionToMediaTypes = parseMimeTypes();
|
||||||
|
|
||||||
static {
|
|
||||||
fileExtensionToMediaTypes = parseMimeTypes();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the {@code mime.types} file found in the resources. Format is:
|
* Parse the {@code mime.types} file found in the resources. Format is:
|
||||||
@@ -65,9 +62,7 @@ public class MediaTypeFactory {
|
|||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
try {
|
try {
|
||||||
is = MediaTypeFactory.class.getResourceAsStream(MIME_TYPES_FILE_NAME);
|
is = MediaTypeFactory.class.getResourceAsStream(MIME_TYPES_FILE_NAME);
|
||||||
BufferedReader reader =
|
BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.US_ASCII));
|
||||||
new BufferedReader(new InputStreamReader(is, StandardCharsets.US_ASCII));
|
|
||||||
|
|
||||||
MultiValueMap<String, MediaType> result = new LinkedMultiValueMap<>();
|
MultiValueMap<String, MediaType> result = new LinkedMultiValueMap<>();
|
||||||
String line;
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
@@ -76,7 +71,6 @@ public class MediaTypeFactory {
|
|||||||
}
|
}
|
||||||
String[] tokens = StringUtils.tokenizeToStringArray(line, " \t\n\r\f");
|
String[] tokens = StringUtils.tokenizeToStringArray(line, " \t\n\r\f");
|
||||||
MediaType mediaType = MediaType.parseMediaType(tokens[0]);
|
MediaType mediaType = MediaType.parseMediaType(tokens[0]);
|
||||||
|
|
||||||
for (int i = 1; i < tokens.length; i++) {
|
for (int i = 1; i < tokens.length; i++) {
|
||||||
String fileExtension = tokens[i].toLowerCase(Locale.ENGLISH);
|
String fileExtension = tokens[i].toLowerCase(Locale.ENGLISH);
|
||||||
result.add(fileExtension, mediaType);
|
result.add(fileExtension, mediaType);
|
||||||
|
|||||||
Reference in New Issue
Block a user