Polishing

This commit is contained in:
Juergen Hoeller
2018-07-20 17:04:17 +02:00
parent 65e423219e
commit 484addb4f8
15 changed files with 63 additions and 48 deletions

View File

@@ -496,7 +496,7 @@ public class CallMetaDataContext {
matchedParameters.put(parameterName,
SqlParameterSourceUtils.getTypedValue(parameterSource, sourceName));
}
else {
else if (logger.isWarnEnabled()) {
logger.warn("Unable to locate the corresponding parameter value for '" +
parameterName + "' within the parameter values provided: " +
caseInsensitiveParameterNames.values());
@@ -562,7 +562,7 @@ public class CallMetaDataContext {
for (String parameterName : callParameterNames.keySet()) {
String parameterNameToMatch = this.metaDataProvider.parameterNameToUse(parameterName);
String callParameterName = callParameterNames.get(parameterNameToMatch.toLowerCase());
if (!matchedParameters.containsKey(callParameterName)) {
if (!matchedParameters.containsKey(callParameterName) && logger.isWarnEnabled()) {
logger.warn("Unable to locate the corresponding parameter value for '" + parameterName +
"' within the parameter values provided: " + inParameters.keySet());
}

View File

@@ -182,7 +182,7 @@ public class TableMetaDataContext {
if (generatedKeyNames.length > 0) {
this.generatedKeyColumnsUsed = true;
}
if (declaredColumns.size() > 0) {
if (!declaredColumns.isEmpty()) {
return new ArrayList<String>(declaredColumns);
}
Set<String> keys = new LinkedHashSet<String>(generatedKeyNames.length);
@@ -255,7 +255,7 @@ public class TableMetaDataContext {
/**
* Build the insert string based on configuration and meta-data information
* Build the insert string based on configuration and meta-data information.
* @return the insert string to be used
*/
public String createInsertString(String... generatedKeyNames) {
@@ -284,8 +284,10 @@ public class TableMetaDataContext {
insertStatement.append(") VALUES(");
if (columnCount < 1) {
if (this.generatedKeyColumnsUsed) {
logger.info("Unable to locate non-key columns for table '" +
getTableName() + "' so an empty insert statement is generated");
if (logger.isInfoEnabled()) {
logger.info("Unable to locate non-key columns for table '" +
getTableName() + "' so an empty insert statement is generated");
}
}
else {
throw new InvalidDataAccessApiUsageException("Unable to locate columns for table '" +
@@ -352,6 +354,9 @@ public class TableMetaDataContext {
}
/**
* Does this database support a simple query to retrieve generated keys
* when the JDBC 3.0 feature is not supported:
* {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}?
* @deprecated as of 4.3.15, in favor of {@link #getSimpleQueryForGetGeneratedKey}
*/
@Deprecated

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2017 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.
@@ -87,8 +87,8 @@ public class EmbeddedDatabaseFactory {
* generation of a pseudo-random unique ID to be used as the database name.
* <p>Setting this flag to {@code true} overrides any explicit name set
* via {@link #setDatabaseName}.
* @see #setDatabaseName
* @since 4.2
* @see #setDatabaseName
*/
public void setGenerateUniqueDatabaseName(boolean generateUniqueDatabaseName) {
this.generateUniqueDatabaseName = generateUniqueDatabaseName;
@@ -183,7 +183,7 @@ public class EmbeddedDatabaseFactory {
if (this.dataSource instanceof SimpleDriverDataSource) {
SimpleDriverDataSource simpleDriverDataSource = (SimpleDriverDataSource) this.dataSource;
logger.info(String.format("Starting embedded database: url='%s', username='%s'",
simpleDriverDataSource.getUrl(), simpleDriverDataSource.getUsername()));
simpleDriverDataSource.getUrl(), simpleDriverDataSource.getUsername()));
}
else {
logger.info(String.format("Starting embedded database '%s'", this.databaseName));
@@ -211,7 +211,6 @@ public class EmbeddedDatabaseFactory {
*/
protected void shutdownDatabase() {
if (this.dataSource != null) {
if (logger.isInfoEnabled()) {
if (this.dataSource instanceof SimpleDriverDataSource) {
logger.info(String.format("Shutting down embedded database: url='%s'",
@@ -221,7 +220,6 @@ public class EmbeddedDatabaseFactory {
logger.info(String.format("Shutting down embedded database '%s'", this.databaseName));
}
}
this.databaseConfigurer.shutdown(this.dataSource, this.databaseName);
this.dataSource = null;
}

View File

@@ -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.
@@ -123,8 +123,8 @@ public class SQLErrorCodesFactory {
// Check all beans of type SQLErrorCodes.
errorCodes = lbf.getBeansOfType(SQLErrorCodes.class, true, false);
if (logger.isInfoEnabled()) {
logger.info("SQLErrorCodes loaded: " + errorCodes.keySet());
if (logger.isDebugEnabled()) {
logger.debug("SQLErrorCodes loaded: " + errorCodes.keySet());
}
}
catch (BeansException ex) {

View File

@@ -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.
@@ -187,7 +187,7 @@ public class TemporaryLobCreator implements LobCreator {
}
}
catch (SQLException ex) {
logger.error("Could not free LOB", ex);
logger.error("Could not free LOBs", ex);
}
}