diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/AbstractFallbackSQLExceptionTranslator.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/AbstractFallbackSQLExceptionTranslator.java
index 2e46da56d3b..dee2182b29c 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/AbstractFallbackSQLExceptionTranslator.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/AbstractFallbackSQLExceptionTranslator.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.
@@ -96,7 +96,7 @@ public abstract class AbstractFallbackSQLExceptionTranslator implements SQLExcep
* is allowed to return {@code null} to indicate that no exception match has
* been found and that fallback translation should kick in.
* @param task readable text describing the task being attempted
- * @param sql SQL query or update that caused the problem (if known)
+ * @param sql the SQL query or update that caused the problem (if known)
* @param ex the offending {@code SQLException}
* @return the DataAccessException, wrapping the {@code SQLException};
* or {@code null} if no exception match found
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/GeneratedKeyHolder.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/GeneratedKeyHolder.java
index abdab1e872f..a897355de8b 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/GeneratedKeyHolder.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/GeneratedKeyHolder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 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.
@@ -25,12 +25,12 @@ import org.springframework.dao.DataRetrievalFailureException;
import org.springframework.dao.InvalidDataAccessApiUsageException;
/**
- * Default implementation of the {@link KeyHolder} interface, to be used for
+ * The standard implementation of the {@link KeyHolder} interface, to be used for
* holding auto-generated keys (as potentially returned by JDBC insert statements).
*
- *
Create an instance of this class for each insert operation, and pass
- * it to the corresponding {@link org.springframework.jdbc.core.JdbcTemplate}
- * or {org.springframework.jdbc.object.SqlUpdate} methods.
+ *
Create an instance of this class for each insert operation, and pass it
+ * to the corresponding {@link org.springframework.jdbc.core.JdbcTemplate} or
+ * {@link org.springframework.jdbc.object.SqlUpdate} methods.
*
* @author Thomas Risberg
* @author Juergen Hoeller
@@ -59,7 +59,7 @@ public class GeneratedKeyHolder implements KeyHolder {
@Override
public Number getKey() throws InvalidDataAccessApiUsageException, DataRetrievalFailureException {
- if (this.keyList.size() == 0) {
+ if (this.keyList.isEmpty()) {
return null;
}
if (this.keyList.size() > 1 || this.keyList.get(0).size() > 1) {
@@ -86,13 +86,14 @@ public class GeneratedKeyHolder implements KeyHolder {
@Override
public Map getKeys() throws InvalidDataAccessApiUsageException {
- if (this.keyList.size() == 0) {
+ if (this.keyList.isEmpty()) {
return null;
}
- if (this.keyList.size() > 1)
+ if (this.keyList.size() > 1) {
throw new InvalidDataAccessApiUsageException(
"The getKeys method should only be used when keys for a single row are returned. " +
"The current key list contains keys for multiple rows: " + this.keyList);
+ }
return this.keyList.get(0);
}
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/KeyHolder.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/KeyHolder.java
index b917ecb95d3..6b4cfaf4d0f 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/KeyHolder.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/KeyHolder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 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.
@@ -51,26 +51,26 @@ public interface KeyHolder {
* multiple entries as well. If this method encounters multiple entries in
* either the map or the list meaning that multiple keys were returned,
* then an InvalidDataAccessApiUsageException is thrown.
- * @return the generated key
- * @throws InvalidDataAccessApiUsageException if multiple keys are encountered.
+ * @return the generated key as a number
+ * @throws InvalidDataAccessApiUsageException if multiple keys are encountered
*/
Number getKey() throws InvalidDataAccessApiUsageException;
/**
- * Retrieve the first map of keys. If there are multiple entries in the list
- * (meaning that multiple rows had keys returned), then an
- * InvalidDataAccessApiUsageException is thrown.
- * @return the Map of generated keys
+ * Retrieve the first map of keys.
+ * If there are multiple entries in the list (meaning that multiple rows
+ * had keys returned), then an InvalidDataAccessApiUsageException is thrown.
+ * @return the Map of generated keys for a single row
* @throws InvalidDataAccessApiUsageException if keys for multiple rows are encountered
*/
Map getKeys() throws InvalidDataAccessApiUsageException;
/**
* Return a reference to the List that contains the keys.
- * Can be used for extracting keys for multiple rows (an unusual case),
+ * Can be used for extracting keys for multiple rows (an unusual case),
* and also for adding new maps of keys.
- * @return the List for the generated keys, with each entry being a Map
- * of column names and key values
+ * @return the List for the generated keys, with each entry representing
+ * an individual row through a Map of column names and key values
*/
List