Upgraded dependency versions and minor polish

This commit is contained in:
Michael Minella
2016-08-09 13:19:14 -05:00
parent f731ae3603
commit f4c0530730
21 changed files with 126 additions and 102 deletions

View File

@@ -146,7 +146,7 @@ public class ExtendedConnectionDataSourceProxy implements SmartDataSource, Initi
if (connection == null) {
return false;
}
return connection.equals(closeSuppressedConnection) ? true : false;
return connection.equals(closeSuppressedConnection);
}
/**
@@ -210,8 +210,8 @@ public class ExtendedConnectionDataSourceProxy implements SmartDataSource, Initi
else {
target = dataSource.getConnection();
}
Connection connection = getCloseSuppressingConnectionProxy(target);
return connection;
return getCloseSuppressingConnectionProxy(target);
}
@Override

View File

@@ -72,6 +72,7 @@ public class HibernateItemWriter<T> implements ItemWriter<T>, InitializingBean {
* the hibernateTemplate to set
* @deprecated As of 2.2 in favor of using Hibernate's session management APIs directly
*/
@Deprecated
public void setHibernateTemplate(HibernateOperations hibernateTemplate) {
this.hibernateTemplate = hibernateTemplate;
}
@@ -159,6 +160,7 @@ public class HibernateItemWriter<T> implements ItemWriter<T>, InitializingBean {
* the list of items to use for the write
* @deprecated As of 2.2 in favor of using Hibernate's session management APIs directly
*/
@Deprecated
protected void doWrite(HibernateOperations hibernateTemplate,
List<? extends T> items) {

View File

@@ -15,8 +15,16 @@
*/
package org.springframework.batch.item.database;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.item.ItemWriter;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.dao.DataAccessException;
@@ -28,13 +36,6 @@ import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.util.Assert;
import javax.sql.DataSource;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* <p>{@link ItemWriter} that uses the batching features from
* {@link NamedParameterJdbcTemplate} to execute a batch of statements for all items
@@ -167,11 +168,11 @@ public class JdbcBatchItemWriter<T> implements ItemWriter<T>, InitializingBean {
logger.debug("Executing batch with " + items.size() + " items.");
}
int[] updateCounts = null;
int[] updateCounts;
if (usingNamedParameters) {
if(items.get(0) instanceof Map) {
updateCounts = namedParameterJdbcTemplate.batchUpdate(sql, items.toArray(new Map[0]));
updateCounts = namedParameterJdbcTemplate.batchUpdate(sql, items.toArray(new Map[items.size()]));
} else {
SqlParameterSource[] batchArgs = new SqlParameterSource[items.size()];
int i = 0;

View File

@@ -16,9 +16,6 @@
package org.springframework.batch.item.file.transform;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.DecimalFormat;
@@ -31,6 +28,9 @@ import java.util.List;
import java.util.Locale;
import java.util.Properties;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
/**
* Default implementation of {@link FieldSet} using Java using Java primitive
* and standard types and utilities. Strings are trimmed before parsing by
@@ -90,7 +90,7 @@ public class DefaultFieldSet implements FieldSet {
* @see FieldSet#readString(int)
*/
public DefaultFieldSet(String[] tokens) {
this.tokens = tokens == null ? null : (String[]) tokens.clone();
this.tokens = tokens == null ? null : tokens.clone();
setNumberFormat(NumberFormat.getInstance(Locale.US));
}
@@ -228,7 +228,7 @@ public class DefaultFieldSet implements FieldSet {
String value = readAndTrim(index);
return trueValue.equals(value) ? true : false;
return trueValue.equals(value);
}
/*
@@ -718,8 +718,8 @@ public class DefaultFieldSet implements FieldSet {
int result = 1;
for (int i = 0; i < tokens.length; i++) {
result = 31 * result + (tokens[i] == null ? 0 : tokens[i].hashCode());
for (String token : tokens) {
result = 31 * result + (token == null ? 0 : token.hashCode());
}
return result;

View File

@@ -97,6 +97,7 @@ public final class FileUtils {
/**
* @deprecated use the version with explicit append parameter instead. Here append=false is assumed.
*/
@Deprecated
public static void setUpOutputFile(File file, boolean restarted, boolean overwriteOutputFile) {
setUpOutputFile(file, restarted, false, overwriteOutputFile);
}