Polishing

This commit is contained in:
Juergen Hoeller
2018-03-28 02:03:31 +02:00
parent 59189e5957
commit 9cc03fa8b0
52 changed files with 511 additions and 560 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import javax.servlet.ServletContext;
@@ -139,7 +138,7 @@ public class ContentNegotiationManagerFactoryBean
*/
public void setMediaTypes(Properties mediaTypes) {
if (!CollectionUtils.isEmpty(mediaTypes)) {
for (Entry<Object, Object> entry : mediaTypes.entrySet()) {
for (Map.Entry<Object, Object> entry : mediaTypes.entrySet()) {
String extension = ((String)entry.getKey()).toLowerCase(Locale.ENGLISH);
MediaType mediaType = MediaType.valueOf((String) entry.getValue());
this.mediaTypes.put(extension, mediaType);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -56,7 +55,7 @@ public class MappingMediaTypeFileExtensionResolver implements MediaTypeFileExten
*/
public MappingMediaTypeFileExtensionResolver(Map<String, MediaType> mediaTypes) {
if (mediaTypes != null) {
for (Entry<String, MediaType> entries : mediaTypes.entrySet()) {
for (Map.Entry<String, MediaType> entries : mediaTypes.entrySet()) {
String extension = entries.getKey().toLowerCase(Locale.ENGLISH);
MediaType mediaType = entries.getValue();
this.mediaTypes.put(extension, mediaType);

View File

@@ -155,10 +155,8 @@ final class HierarchicalUriComponents extends UriComponents {
queryBuilder.append('&');
}
queryBuilder.append(name);
if (value != null) {
queryBuilder.append('=');
queryBuilder.append(value.toString());
queryBuilder.append('=').append(value.toString());
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@ import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
@@ -535,7 +534,7 @@ public class UrlPathHelper {
}
else {
Map<String, String> decodedVars = new LinkedHashMap<String, String>(vars.size());
for (Entry<String, String> entry : vars.entrySet()) {
for (Map.Entry<String, String> entry : vars.entrySet()) {
decodedVars.put(entry.getKey(), decodeInternal(request, entry.getValue()));
}
return decodedVars;