Skip to content

Commit 13283ec

Browse files
committed
Polishing
1 parent ca60d79 commit 13283ec

File tree

7 files changed

+45
-36
lines changed

7 files changed

+45
-36
lines changed

spring-core/src/main/java/org/springframework/util/StreamUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -129,7 +129,7 @@ public static int copy(InputStream in, OutputStream out) throws IOException {
129129
}
130130

131131
/**
132-
* Returns a variant of the given {@link InputStream} where calling
132+
* Return a variant of the given {@link InputStream} where calling
133133
* {@link InputStream#close() close()} has no effect.
134134
* @param in the InputStream to decorate
135135
* @return a version of the InputStream that ignores calls to close
@@ -140,7 +140,7 @@ public static InputStream nonClosing(InputStream in) {
140140
}
141141

142142
/**
143-
* Returns a variant of the given {@link OutputStream} where calling
143+
* Return a variant of the given {@link OutputStream} where calling
144144
* {@link OutputStream#close() close()} has no effect.
145145
* @param out the OutputStream to decorate
146146
* @return a version of the OutputStream that ignores calls to close

spring-web/src/main/java/org/springframework/http/client/BufferingClientHttpRequestFactory.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2011 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -22,22 +22,30 @@
2222
import org.springframework.http.HttpMethod;
2323

2424
/**
25-
* Wrapper for a {@link ClientHttpRequestFactory} that buffers all outgoing and incoming streams in memory.
25+
* Wrapper for a {@link ClientHttpRequestFactory} that buffers
26+
* all outgoing and incoming streams in memory.
2627
*
27-
* <p>Using this wrapper allows for multiple reads of the {@linkplain ClientHttpResponse#getBody() response body}.
28+
* <p>Using this wrapper allows for multiple reads of the
29+
* @linkplain ClientHttpResponse#getBody() response body}.
2830
*
2931
* @author Arjen Poutsma
3032
* @since 3.1
3133
*/
3234
public class BufferingClientHttpRequestFactory extends AbstractClientHttpRequestFactoryWrapper {
3335

36+
/**
37+
* Create a buffering wrapper for the given {@link ClientHttpRequestFactory}.
38+
* @param requestFactory the target request factory to wrap
39+
*/
3440
public BufferingClientHttpRequestFactory(ClientHttpRequestFactory requestFactory) {
3541
super(requestFactory);
3642
}
3743

44+
3845
@Override
3946
protected ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod, ClientHttpRequestFactory requestFactory)
4047
throws IOException {
48+
4149
ClientHttpRequest request = requestFactory.createRequest(uri, httpMethod);
4250
if (shouldBuffer(uri, httpMethod)) {
4351
return new BufferingClientHttpRequestWrapper(request);
@@ -48,16 +56,16 @@ protected ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod, Client
4856
}
4957

5058
/**
51-
* Indicates whether the request/response exchange for the given URI and method should be buffered in memory.
52-
*
53-
* <p>Default implementation returns {@code true} for all URIs and methods. Subclasses can override this method to
54-
* change this behavior.
55-
*
59+
* Indicates whether the request/response exchange for the given URI and method
60+
* should be buffered in memory.
61+
* <p>The default implementation returns {@code true} for all URIs and methods.
62+
* Subclasses can override this method to change this behavior.
5663
* @param uri the URI
5764
* @param httpMethod the method
5865
* @return {@code true} if the exchange should be buffered; {@code false} otherwise
5966
*/
6067
protected boolean shouldBuffer(URI uri, HttpMethod httpMethod) {
6168
return true;
6269
}
70+
6371
}

spring-web/src/main/java/org/springframework/http/client/BufferingClientHttpRequestWrapper.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -21,7 +21,6 @@
2121

2222
import org.springframework.http.HttpHeaders;
2323
import org.springframework.http.HttpMethod;
24-
import org.springframework.util.Assert;
2524
import org.springframework.util.StreamUtils;
2625

2726
/**
@@ -36,7 +35,6 @@ final class BufferingClientHttpRequestWrapper extends AbstractBufferingClientHtt
3635

3736

3837
BufferingClientHttpRequestWrapper(ClientHttpRequest request) {
39-
Assert.notNull(request, "'request' must not be null");
4038
this.request = request;
4139
}
4240

spring-web/src/main/java/org/springframework/http/client/BufferingClientHttpResponseWrapper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -25,8 +25,8 @@
2525
import org.springframework.util.StreamUtils;
2626

2727
/**
28-
* Simple implementation of {@link ClientHttpResponse} that reads the response's body into memory,
29-
* thus allowing for multiple invocations of {@link #getBody()}.
28+
* Simple implementation of {@link ClientHttpResponse} that reads the response's body
29+
* into memory, thus allowing for multiple invocations of {@link #getBody()}.
3030
*
3131
* @author Arjen Poutsma
3232
* @since 3.1

spring-web/src/main/java/org/springframework/web/bind/annotation/ExceptionHandler.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -27,8 +27,8 @@
2727
* handler methods. Provides consistent style between Servlet and Portlet
2828
* environments, with the semantics adapting to the concrete environment.
2929
*
30-
* <p>Handler methods which are annotated with this annotation are allowed
31-
* to have very flexible signatures. They may have arguments of the following
30+
* <p>Handler methods which are annotated with this annotation are allowed to
31+
* have very flexible signatures. They may have parameters of the following
3232
* types, in arbitrary order:
3333
* <ul>
3434
* <li>An exception argument: declared as a general Exception or as a more
@@ -48,8 +48,9 @@
4848
* As a consequence, such an argument will never be {@code null}.
4949
* <i>Note that session access may not be thread-safe, in particular in a
5050
* Servlet environment: Consider switching the
51-
* {@link org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#setSynchronizeOnSession "synchronizeOnSession"}
52-
* flag to "true" if multiple requests are allowed to access a session concurrently.</i>
51+
* {@link org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#setSynchronizeOnSession
52+
* "synchronizeOnSession"} flag to "true" if multiple requests are allowed to
53+
* access a session concurrently.</i>
5354
* <li>{@link org.springframework.web.context.request.WebRequest} or
5455
* {@link org.springframework.web.context.request.NativeWebRequest}.
5556
* Allows for generic request parameter access as well as request/session
@@ -69,8 +70,8 @@
6970
* <p>The following return types are supported for handler methods:
7071
* <ul>
7172
* <li>A {@code ModelAndView} object (Servlet MVC or Portlet MVC).
72-
* <li>A {@link org.springframework.ui.Model Model} object, with the view name
73-
* implicitly determined through a {@link org.springframework.web.servlet.RequestToViewNameTranslator}.
73+
* <li>A {@link org.springframework.ui.Model} object, with the view name implicitly
74+
* determined through a {@link org.springframework.web.servlet.RequestToViewNameTranslator}.
7475
* <li>A {@link java.util.Map} object for exposing a model,
7576
* with the view name implicitly determined through a
7677
* {@link org.springframework.web.servlet.RequestToViewNameTranslator}.

spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -38,8 +38,8 @@
3838
* details see the note on the new support classes added in Spring MVC 3.1
3939
* further below.
4040
*
41-
* <p>Handler methods which are annotated with this annotation are allowed
42-
* to have very flexible signatures. They may have arguments of the following
41+
* <p>Handler methods which are annotated with this annotation are allowed to
42+
* have very flexible signatures. They may have parameters of the following
4343
* types, in arbitrary order (except for validation results, which need to
4444
* follow right after the corresponding command object, if desired):
4545
* <ul>
@@ -57,8 +57,9 @@
5757
* As a consequence, such an argument will never be {@code null}.
5858
* <i>Note that session access may not be thread-safe, in particular in a
5959
* Servlet environment: Consider switching the
60-
* {@link org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#setSynchronizeOnSession "synchronizeOnSession"}
61-
* flag to "true" if multiple requests are allowed to access a session concurrently.</i>
60+
* {@link org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#setSynchronizeOnSession
61+
* "synchronizeOnSession"} flag to "true" if multiple requests are allowed to
62+
* access a session concurrently.</i>
6263
* <li>{@link org.springframework.web.context.request.WebRequest} or
6364
* {@link org.springframework.web.context.request.NativeWebRequest}.
6465
* Allows for generic request parameter access as well as request/session
@@ -160,7 +161,7 @@
160161
* context path, and the literal part of the servlet mapping.
161162
* </ul>
162163
*
163-
* <p><strong>Note:</strong> JDK 1.8's {@code java.util.Optional} is supported
164+
* <p><strong>Note:</strong> Java 8's {@code java.util.Optional} is supported
164165
* as a method parameter type with annotations that provide a {@code required}
165166
* attribute (e.g. {@code @RequestParam}, {@code @RequestHeader}, etc.). The use
166167
* of {@code java.util.Optional} in those cases is equivalent to having
@@ -171,8 +172,8 @@
171172
* <li>A {@code ModelAndView} object (Servlet MVC or Portlet MVC),
172173
* with the model implicitly enriched with command objects and the results
173174
* of {@link ModelAttribute @ModelAttribute} annotated reference data accessor methods.
174-
* <li>A {@link org.springframework.ui.Model Model} object, with the view name
175-
* implicitly determined through a {@link org.springframework.web.servlet.RequestToViewNameTranslator}
175+
* <li>A {@link org.springframework.ui.Model Model} object, with the view name implicitly
176+
* determined through a {@link org.springframework.web.servlet.RequestToViewNameTranslator}
176177
* and the model implicitly enriched with command objects and the results
177178
* of {@link ModelAttribute @ModelAttribute} annotated reference data accessor methods.
178179
* <li>A {@link java.util.Map} object for exposing a model,

spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/MappingJackson2JsonView.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -191,7 +191,7 @@ private String getJsonpParameterValue(HttpServletRequest request) {
191191
* Filter out undesired attributes from the given model.
192192
* The return value can be either another {@link Map} or a single value object.
193193
* <p>The default implementation removes {@link BindingResult} instances and entries
194-
* not included in the {@link #setRenderedAttributes renderedAttributes} property.
194+
* not included in the {@link #setModelKeys renderedAttributes} property.
195195
* @param model the model, as passed on to {@link #renderMergedOutputModel}
196196
* @return the value to be rendered
197197
*/
@@ -230,9 +230,10 @@ protected void writePrefix(JsonGenerator generator, Object object) throws IOExce
230230
if (this.jsonPrefix != null) {
231231
generator.writeRaw(this.jsonPrefix);
232232
}
233+
233234
String jsonpFunction = null;
234235
if (object instanceof MappingJacksonValue) {
235-
jsonpFunction = ((MappingJacksonValue)object).getJsonpFunction();
236+
jsonpFunction = ((MappingJacksonValue) object).getJsonpFunction();
236237
}
237238
if (jsonpFunction != null) {
238239
generator.writeRaw(jsonpFunction + "(" );
@@ -243,7 +244,7 @@ protected void writePrefix(JsonGenerator generator, Object object) throws IOExce
243244
protected void writeSuffix(JsonGenerator generator, Object object) throws IOException {
244245
String jsonpFunction = null;
245246
if (object instanceof MappingJacksonValue) {
246-
jsonpFunction = ((MappingJacksonValue)object).getJsonpFunction();
247+
jsonpFunction = ((MappingJacksonValue) object).getJsonpFunction();
247248
}
248249
if (jsonpFunction != null) {
249250
generator.writeRaw(");");

0 commit comments

Comments
 (0)