From ec1aa5c6eac7f39afe5b78eb20ac27e0932c273f Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 17 Sep 2018 14:56:55 +0200 Subject: [PATCH] Polishing --- .../expression/spel/ast/StringLiteral.java | 4 +-- .../context/request/ServletWebRequest.java | 9 +++-- .../DefaultHandlerExceptionResolver.java | 7 ++-- .../web/servlet/tags/UrlTag.java | 34 ++++++++++--------- .../socket/sockjs/client/SockJsUrlInfo.java | 8 ++--- 5 files changed, 32 insertions(+), 30 deletions(-) diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/StringLiteral.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/StringLiteral.java index 930bc4738d..35d6cb568f 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/StringLiteral.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/StringLiteral.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 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. @@ -33,7 +33,7 @@ public class StringLiteral extends Literal { public StringLiteral(String payload, int pos, String value) { - super(payload,pos); + super(payload, pos); value = value.substring(1, value.length() - 1); this.value = new TypedValue(value.replaceAll("''", "'").replaceAll("\"\"", "\"")); this.exitTypeDescriptor = "Ljava/lang/String"; diff --git a/spring-web/src/main/java/org/springframework/web/context/request/ServletWebRequest.java b/spring-web/src/main/java/org/springframework/web/context/request/ServletWebRequest.java index 877f60941f..fc04869ca4 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/ServletWebRequest.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/ServletWebRequest.java @@ -1,11 +1,11 @@ /* - * 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -63,13 +63,13 @@ public class ServletWebRequest extends ServletRequestAttributes implements Nativ private static final List SAFE_METHODS = Arrays.asList("GET", "HEAD"); /** - * Pattern matching ETag multiple field values in headers such as "If-Match", "If-None-Match" + * Pattern matching ETag multiple field values in headers such as "If-Match", "If-None-Match". * @see Section 2.3 of RFC 7232 */ private static final Pattern ETAG_HEADER_VALUE_PATTERN = Pattern.compile("\\*|\\s*((W\\/)?(\"[^\"]*\"))\\s*,?"); /** - * Date formats as specified in the HTTP RFC + * Date formats as specified in the HTTP RFC. * @see Section 7.1.1.1 of RFC 7231 */ private static final String[] DATE_FORMATS = new String[] { @@ -233,7 +233,6 @@ public class ServletWebRequest extends ServletRequestAttributes implements Nativ } // Update response - boolean isHttpGetOrHead = SAFE_METHODS.contains(getRequest().getMethod()); if (this.notModified) { response.setStatus(isHttpGetOrHead ? diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolver.java index eae4a1b138..a92c33a6e2 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolver.java @@ -330,7 +330,8 @@ public class DefaultHandlerExceptionResolver extends AbstractHandlerExceptionRes /** * Handle the case when a {@link org.springframework.web.bind.WebDataBinder} conversion cannot occur. *

The default implementation sends an HTTP 500 error, and returns an empty {@code ModelAndView}. - * Alternatively, a fallback view could be chosen, or the TypeMismatchException could be rethrown as-is. + * Alternatively, a fallback view could be chosen, or the ConversionNotSupportedException could be + * rethrown as-is. * @param ex the ConversionNotSupportedException to be handled * @param request current HTTP request * @param response current HTTP response @@ -367,7 +368,7 @@ public class DefaultHandlerExceptionResolver extends AbstractHandlerExceptionRes * Handle the case where a {@linkplain org.springframework.http.converter.HttpMessageConverter message converter} * cannot read from a HTTP request. *

The default implementation sends an HTTP 400 error, and returns an empty {@code ModelAndView}. - * Alternatively, a fallback view could be chosen, or the HttpMediaTypeNotSupportedException could be + * Alternatively, a fallback view could be chosen, or the HttpMessageNotReadableException could be * rethrown as-is. * @param ex the HttpMessageNotReadableException to be handled * @param request current HTTP request @@ -388,7 +389,7 @@ public class DefaultHandlerExceptionResolver extends AbstractHandlerExceptionRes * {@linkplain org.springframework.http.converter.HttpMessageConverter message converter} * cannot write to a HTTP request. *

The default implementation sends an HTTP 500 error, and returns an empty {@code ModelAndView}. - * Alternatively, a fallback view could be chosen, or the HttpMediaTypeNotSupportedException could + * Alternatively, a fallback view could be chosen, or the HttpMessageNotWritableException could * be rethrown as-is. * @param ex the HttpMessageNotWritableException to be handled * @param request current HTTP request diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/UrlTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/UrlTag.java index 9672aed0d9..7bd7623e95 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/UrlTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/UrlTag.java @@ -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. @@ -35,8 +35,8 @@ import org.springframework.web.util.TagUtils; import org.springframework.web.util.UriUtils; /** - * JSP tag for creating URLs. Modeled after the JSTL c:url tag with backwards - * compatibility in mind. + * The {@code } tag creates URLs. Modeled after the JSTL {@code c:url} tag with + * backwards compatibility in mind. * *

Enhancements to the JSTL functionality include: *