Skip to content

Commit 21ac764

Browse files
committed
Polishing
1 parent c4fda0e commit 21ac764

File tree

12 files changed

+130
-105
lines changed

12 files changed

+130
-105
lines changed

spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2017 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.
@@ -186,7 +186,7 @@ private void loadBeanDefinitionsForBeanMethod(BeanMethod beanMethod) {
186186
// Consider name and any aliases
187187
AnnotationAttributes bean = AnnotationConfigUtils.attributesFor(metadata, Bean.class);
188188
List<String> names = new ArrayList<String>(Arrays.asList(bean.getStringArray("name")));
189-
String beanName = (names.size() > 0 ? names.remove(0) : methodName);
189+
String beanName = (!names.isEmpty() ? names.remove(0) : methodName);
190190

191191
// Register aliases even when overridden
192192
for (String alias : names) {
@@ -336,7 +336,7 @@ private void loadBeanDefinitionsFromImportedResources(
336336
}
337337
readerInstanceCache.put(readerClass, reader);
338338
}
339-
catch (Exception ex) {
339+
catch (Throwable ex) {
340340
throw new IllegalStateException(
341341
"Could not instantiate BeanDefinitionReader class [" + readerClass.getName() + "]");
342342
}

spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallParameterMetaData.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2007 the original author or authors.
2+
* Copyright 2002-2017 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,16 +21,23 @@
2121
*
2222
* @author Thomas Risberg
2323
* @since 2.5
24+
* @see GenericCallMetaDataProvider
2425
*/
2526
public class CallParameterMetaData {
27+
2628
private String parameterName;
29+
2730
private int parameterType;
31+
2832
private int sqlType;
33+
2934
private String typeName;
35+
3036
private boolean nullable;
3137

38+
3239
/**
33-
* Constructor taking all the properties
40+
* Constructor taking all the properties.
3441
*/
3542
public CallParameterMetaData(String columnName, int columnType, int sqlType, String typeName, boolean nullable) {
3643
this.parameterName = columnName;
@@ -45,34 +52,35 @@ public CallParameterMetaData(String columnName, int columnType, int sqlType, Str
4552
* Get the parameter name.
4653
*/
4754
public String getParameterName() {
48-
return parameterName;
55+
return this.parameterName;
4956
}
5057

5158
/**
5259
* Get the parameter type.
5360
*/
5461
public int getParameterType() {
55-
return parameterType;
62+
return this.parameterType;
5663
}
5764

5865
/**
5966
* Get the parameter SQL type.
6067
*/
6168
public int getSqlType() {
62-
return sqlType;
69+
return this.sqlType;
6370
}
6471

6572
/**
6673
* Get the parameter type name.
6774
*/
6875
public String getTypeName() {
69-
return typeName;
76+
return this.typeName;
7077
}
7178

7279
/**
7380
* Get whether the parameter is nullable.
7481
*/
7582
public boolean isNullable() {
76-
return nullable;
83+
return this.nullable;
7784
}
85+
7886
}

spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableParameterMetaData.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2007 the original author or authors.
2+
* Copyright 2002-2017 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,6 +21,7 @@
2121
*
2222
* @author Thomas Risberg
2323
* @since 2.5
24+
* @see GenericTableMetaDataProvider
2425
*/
2526
public class TableParameterMetaData {
2627

spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerFactoryUtils.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,8 @@ public static void closeEntityManager(EntityManager em) {
450450

451451
/**
452452
* Callback for resource cleanup at the end of a non-JPA transaction
453-
* (e.g. when participating in a JtaTransactionManager transaction).
453+
* (e.g. when participating in a JtaTransactionManager transaction),
454+
* fully synchronized with the ongoing transaction.
454455
* @see org.springframework.transaction.jta.JtaTransactionManager
455456
*/
456457
private static class TransactionalEntityManagerSynchronization
@@ -465,6 +466,7 @@ private static class TransactionalEntityManagerSynchronization
465466

466467
public TransactionalEntityManagerSynchronization(
467468
EntityManagerHolder emHolder, EntityManagerFactory emf, Object txData, boolean newEm) {
469+
468470
super(emHolder, emf);
469471
this.transactionData = txData;
470472
this.jpaDialect = (emf instanceof EntityManagerFactoryInfo ?
@@ -512,7 +514,9 @@ protected void releaseResource(EntityManagerHolder resourceHolder, EntityManager
512514
}
513515

514516
@Override
515-
protected void cleanupResource(EntityManagerHolder resourceHolder, EntityManagerFactory resourceKey, boolean committed) {
517+
protected void cleanupResource(
518+
EntityManagerHolder resourceHolder, EntityManagerFactory resourceKey, boolean committed) {
519+
516520
if (!committed) {
517521
// Clear all pending inserts/updates/deletes in the EntityManager.
518522
// Necessary for pre-bound EntityManagers, to avoid inconsistent state.

spring-test/src/test/java/org/springframework/test/context/testng/TrackingTestNGTestListener.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2017 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.
@@ -30,8 +30,11 @@
3030
public class TrackingTestNGTestListener implements ITestListener {
3131

3232
public int testStartCount = 0;
33+
3334
public int testSuccessCount = 0;
35+
3436
public int testFailureCount = 0;
37+
3538
public int failedConfigurationsCount = 0;
3639

3740

@@ -66,4 +69,5 @@ public void onTestStart(ITestResult testResult) {
6669
public void onTestSuccess(ITestResult testResult) {
6770
this.testSuccessCount++;
6871
}
69-
}
72+
73+
}

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

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,15 @@ public void setProxy(Proxy proxy) {
6464
}
6565

6666
/**
67-
* Indicates whether this request factory should buffer the {@linkplain ClientHttpRequest#getBody() request body}
68-
* internally.
69-
* <p>Default is {@code true}. When sending large amounts of data via POST or PUT, it is recommended
70-
* to change this property to {@code false}, so as not to run out of memory. This will result in a
71-
* {@link ClientHttpRequest} that either streams directly to the underlying {@link HttpURLConnection}
72-
* (if the {@link org.springframework.http.HttpHeaders#getContentLength() Content-Length} is known in advance),
73-
* or that will use "Chunked transfer encoding" (if the {@code Content-Length} is not known in advance).
67+
* Indicate whether this request factory should buffer the
68+
* {@linkplain ClientHttpRequest#getBody() request body} internally.
69+
* <p>Default is {@code true}. When sending large amounts of data via POST or PUT,
70+
* it is recommended to change this property to {@code false}, so as not to run
71+
* out of memory. This will result in a {@link ClientHttpRequest} that either
72+
* streams directly to the underlying {@link HttpURLConnection} (if the
73+
* {@link org.springframework.http.HttpHeaders#getContentLength() Content-Length}
74+
* is known in advance), or that will use "Chunked transfer encoding"
75+
* (if the {@code Content-Length} is not known in advance).
7476
* @see #setChunkSize(int)
7577
* @see HttpURLConnection#setFixedLengthStreamingMode(int)
7678
*/
@@ -79,9 +81,11 @@ public void setBufferRequestBody(boolean bufferRequestBody) {
7981
}
8082

8183
/**
82-
* Sets the number of bytes to write in each chunk when not buffering request bodies locally.
83-
* <p>Note that this parameter is only used when {@link #setBufferRequestBody(boolean) bufferRequestBody} is set
84-
* to {@code false}, and the {@link org.springframework.http.HttpHeaders#getContentLength() Content-Length}
84+
* Set the number of bytes to write in each chunk when not buffering request
85+
* bodies locally.
86+
* <p>Note that this parameter is only used when
87+
* {@link #setBufferRequestBody(boolean) bufferRequestBody} is set to {@code false},
88+
* and the {@link org.springframework.http.HttpHeaders#getContentLength() Content-Length}
8589
* is not known in advance.
8690
* @see #setBufferRequestBody(boolean)
8791
*/

spring-web/src/main/java/org/springframework/web/bind/WebDataBinder.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 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.
@@ -248,11 +248,11 @@ protected void checkFieldMarkers(MutablePropertyValues mpvs) {
248248
* Determine an empty value for the specified field.
249249
* <p>Default implementation returns:
250250
* <ul>
251-
* <li>{@code Boolean.FALSE} for boolean fields
252-
* <li>an empty array for array types
253-
* <li>Collection implementations for Collection types
254-
* <li>Map implementations for Map types
255-
* <li>else, {@code null} is used as default
251+
* <li>{@code Boolean.FALSE} for boolean fields
252+
* <li>an empty array for array types
253+
* <li>Collection implementations for Collection types
254+
* <li>Map implementations for Map types
255+
* <li>else, {@code null} is used as default
256256
* </ul>
257257
* @param field the name of the field
258258
* @param fieldType the type of the field

spring-web/src/main/java/org/springframework/web/client/ResponseErrorHandler.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2017 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,28 +21,31 @@
2121
import org.springframework.http.client.ClientHttpResponse;
2222

2323
/**
24-
* Strategy interface used by the {@link RestTemplate} to determine whether a particular response has an error or not.
24+
* Strategy interface used by the {@link RestTemplate} to determine
25+
* whether a particular response has an error or not.
2526
*
2627
* @author Arjen Poutsma
2728
* @since 3.0
2829
*/
2930
public interface ResponseErrorHandler {
3031

3132
/**
32-
* Indicates whether the given response has any errors.
33-
* Implementations will typically inspect the {@link ClientHttpResponse#getStatusCode() HttpStatus}
34-
* of the response.
33+
* Indicate whether the given response has any errors.
34+
* <p>Implementations will typically inspect the
35+
* {@link ClientHttpResponse#getStatusCode() HttpStatus} of the response.
3536
* @param response the response to inspect
3637
* @return {@code true} if the response has an error; {@code false} otherwise
3738
* @throws IOException in case of I/O errors
3839
*/
3940
boolean hasError(ClientHttpResponse response) throws IOException;
4041

4142
/**
42-
* Handles the error in the given response.
43-
* This method is only called when {@link #hasError(ClientHttpResponse)} has returned {@code true}.
43+
* Handle the error in the given response.
44+
* <p>This method is only called when {@link #hasError(ClientHttpResponse)}
45+
* has returned {@code true}.
4446
* @param response the response with the error
4547
* @throws IOException in case of I/O errors
4648
*/
4749
void handleError(ClientHttpResponse response) throws IOException;
50+
4851
}

0 commit comments

Comments
 (0)