diff --git a/spring-core/src/main/java/org/springframework/core/ResolvableType.java b/spring-core/src/main/java/org/springframework/core/ResolvableType.java index 78c7e88f30..982546bb25 100644 --- a/spring-core/src/main/java/org/springframework/core/ResolvableType.java +++ b/spring-core/src/main/java/org/springframework/core/ResolvableType.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -1092,9 +1092,8 @@ public final class ResolvableType implements Serializable { public static ResolvableType forMethodParameter(MethodParameter methodParameter, Type targetType) { Assert.notNull(methodParameter, "MethodParameter must not be null"); ResolvableType owner = forType(methodParameter.getContainingClass()).as(methodParameter.getDeclaringClass()); - return forType(targetType, new MethodParameterTypeProvider(methodParameter), - owner.asVariableResolver()).getNested(methodParameter.getNestingLevel(), - methodParameter.typeIndexesPerLevel); + return forType(targetType, new MethodParameterTypeProvider(methodParameter), owner.asVariableResolver()). + getNested(methodParameter.getNestingLevel(), methodParameter.typeIndexesPerLevel); } /** diff --git a/spring-web/src/main/java/org/springframework/http/converter/GenericHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/GenericHttpMessageConverter.java index 842b717679..27600b7130 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/GenericHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/GenericHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 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. @@ -29,7 +29,6 @@ import org.springframework.http.MediaType; * @author Arjen Poutsma * @author Rossen Stoyanchev * @since 3.2 - * * @see org.springframework.core.ParameterizedTypeReference */ public interface GenericHttpMessageConverter extends HttpMessageConverter { @@ -38,7 +37,7 @@ public interface GenericHttpMessageConverter extends HttpMessageConverter * Indicates whether the given type can be read by this converter. * @param type the type to test for readability * @param contextClass a context class for the target type, for example a class - * in which the target type appears in a method signature, can be {@code null} + * in which the target type appears in a method signature (can be {@code null}) * @param mediaType the media type to read, can be {@code null} if not specified. * Typically the value of a {@code Content-Type} header. * @return {@code true} if readable; {@code false} otherwise @@ -51,7 +50,7 @@ public interface GenericHttpMessageConverter extends HttpMessageConverter * been passed to the {@link #canRead canRead} method of this interface, * which must have returned {@code true}. * @param contextClass a context class for the target type, for example a class - * in which the target type appears in a method signature, can be {@code null} + * in which the target type appears in a method signature (can be {@code null}) * @param inputMessage the HTTP input message to read from * @return the converted object * @throws IOException in case of I/O errors diff --git a/spring-web/src/main/java/org/springframework/web/client/RestTemplate.java b/spring-web/src/main/java/org/springframework/web/client/RestTemplate.java index 69170ede8f..bd7908b847 100644 --- a/spring-web/src/main/java/org/springframework/web/client/RestTemplate.java +++ b/spring-web/src/main/java/org/springframework/web/client/RestTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -596,7 +596,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat logger.debug(method.name() + " request for \"" + url + "\" resulted in " + response.getRawStatusCode() + " (" + response.getStatusText() + ")"); } - catch (IOException e) { + catch (IOException ex) { // ignore } } @@ -608,7 +608,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat logger.warn(method.name() + " request for \"" + url + "\" resulted in " + response.getRawStatusCode() + " (" + response.getStatusText() + "); invoking error handler"); } - catch (IOException e) { + catch (IOException ex) { // ignore } } @@ -668,12 +668,11 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat @Override public void doWithRequest(ClientHttpRequest request) throws IOException { - if (responseType != null) { + if (this.responseType != null) { Class responseClass = null; - if (responseType instanceof Class) { - responseClass = (Class) responseType; + if (this.responseType instanceof Class) { + responseClass = (Class) this.responseType; } - List allSupportedMediaTypes = new ArrayList(); for (HttpMessageConverter converter : getMessageConverters()) { if (responseClass != null) { @@ -682,13 +681,11 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat } } else if (converter instanceof GenericHttpMessageConverter) { - GenericHttpMessageConverter genericConverter = (GenericHttpMessageConverter) converter; - if (genericConverter.canRead(responseType, null, null)) { + if (genericConverter.canRead(this.responseType, null, null)) { allSupportedMediaTypes.addAll(getSupportedMediaTypes(converter)); } } - } if (!allSupportedMediaTypes.isEmpty()) { MediaType.sortBySpecificity(allSupportedMediaTypes); @@ -744,9 +741,9 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat @SuppressWarnings("unchecked") public void doWithRequest(ClientHttpRequest httpRequest) throws IOException { super.doWithRequest(httpRequest); - if (!requestEntity.hasBody()) { + if (!this.requestEntity.hasBody()) { HttpHeaders httpHeaders = httpRequest.getHeaders(); - HttpHeaders requestHeaders = requestEntity.getHeaders(); + HttpHeaders requestHeaders = this.requestEntity.getHeaders(); if (!requestHeaders.isEmpty()) { httpHeaders.putAll(requestHeaders); } @@ -755,9 +752,9 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat } } else { - Object requestBody = requestEntity.getBody(); + Object requestBody = this.requestEntity.getBody(); Class requestType = requestBody.getClass(); - HttpHeaders requestHeaders = requestEntity.getHeaders(); + HttpHeaders requestHeaders = this.requestEntity.getHeaders(); MediaType requestContentType = requestHeaders.getContentType(); for (HttpMessageConverter messageConverter : getMessageConverters()) { if (messageConverter.canWrite(requestType, requestContentType)) { diff --git a/spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java b/spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java index 60eb76c3a3..2364523468 100644 --- a/spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java +++ b/spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java @@ -268,9 +268,9 @@ public class UriComponentsBuilder implements Cloneable { * Create a new {@code UriComponents} object from the URI associated with * the given HttpRequest while also overlaying with values from the headers * "X-Forwarded-Host", "X-Forwarded-Port", and "X-Forwarded-Proto" if present. - * * @param request the source request - * @return the URI components of the UR + * @return the URI components of the URI + * @since 4.1.5 */ public static UriComponentsBuilder fromHttpRequest(HttpRequest request) { URI uri = request.getURI(); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessor.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessor.java index 3f578a6af2..dd26ddc343 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessor.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -93,7 +93,7 @@ public class RequestResponseBodyMethodProcessor extends AbstractMessageConverter } /** - * @throws MethodArgumentNotValidException if validation fails + * Throws MethodArgumentNotValidException if validation fails. * @throws HttpMessageNotReadableException if {@link RequestBody#required()} * is {@code true} and there is no body content or if there is no suitable * converter to read the content with. @@ -143,8 +143,8 @@ public class RequestResponseBodyMethodProcessor extends AbstractMessageConverter } @Override - protected Object readWithMessageConverters(NativeWebRequest webRequest, - MethodParameter methodParam, Type paramType) throws IOException, HttpMediaTypeNotSupportedException { + protected Object readWithMessageConverters(NativeWebRequest webRequest, MethodParameter methodParam, + Type paramType) throws IOException, HttpMediaTypeNotSupportedException { final HttpServletRequest servletRequest = webRequest.getNativeRequest(HttpServletRequest.class); HttpInputMessage inputMessage = new ServletServerHttpRequest(servletRequest);