This commit is contained in:
jpraet
2014-03-30 13:25:34 +02:00
committed by Chris Schaefer
parent 24852e3cf8
commit b26d272d43
760 changed files with 8606 additions and 2349 deletions

View File

@@ -163,7 +163,7 @@ public class ExecutionContext implements Serializable {
*
* @param key The key to get a value for
* @param defaultString Default to return if key is not represented
* @return The <code>String</code> value if key is repreesnted, specified
* @return The <code>String</code> value if key is represented, specified
* default otherwise
*/
public String getString(String key, String defaultString) {

View File

@@ -23,7 +23,7 @@ package org.springframework.batch.item;
* for each batch, with each call to {@link #read()} returning a different value
* and finally returning <code>null</code> when all input data is exhausted.<br/>
*
* Implementations need *not* be thread safe and clients of a {@link ItemReader}
* Implementations need <b>not</b> be thread-safe and clients of a {@link ItemReader}
* need to be aware that this is the case.<br/>
*
* A richer interface (e.g. with a look ahead or peek) is not feasible because

View File

@@ -21,6 +21,7 @@ package org.springframework.batch.item;
*
* @author Ben Hale
*/
@SuppressWarnings("serial")
public abstract class ItemReaderException extends RuntimeException {
/**

View File

@@ -21,6 +21,7 @@ package org.springframework.batch.item;
* @author Dave Syer
* @author Lucas Ward
*/
@SuppressWarnings("serial")
public class ItemStreamException extends RuntimeException {
/**

View File

@@ -21,6 +21,7 @@ package org.springframework.batch.item;
*
* @author Ben Hale
*/
@SuppressWarnings("serial")
public abstract class ItemWriterException extends RuntimeException {
/**

View File

@@ -21,6 +21,7 @@ package org.springframework.batch.item;
*
* @author Dave Syer
*/
@SuppressWarnings("serial")
public class NonTransientResourceException extends ItemReaderException {
/**

View File

@@ -16,11 +16,12 @@
package org.springframework.batch.item;
/**
* Exception indicating that an error has been encountered parsing io, typically from a file.
* Exception indicating that an error has been encountered parsing IO, typically from a file.
*
* @author Lucas Ward
* @author Ben Hale
*/
@SuppressWarnings("serial")
public class ParseException extends ItemReaderException {
/**

View File

@@ -20,6 +20,7 @@ package org.springframework.batch.item;
*
* @author Ben Hale
*/
@SuppressWarnings("serial")
public class ReaderNotOpenException extends ItemReaderException {
/**

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2012 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.item;
import org.springframework.core.io.Resource;

View File

@@ -23,6 +23,7 @@ package org.springframework.batch.item;
* @author Dave Syer
* @author Ben Hale
*/
@SuppressWarnings("serial")
public class UnexpectedInputException extends ItemReaderException {
/**

View File

@@ -22,6 +22,7 @@ package org.springframework.batch.item;
* @author Lucas Ward
* @author Ben Hale
*/
@SuppressWarnings("serial")
public class WriteFailedException extends ItemWriterException {
/**

View File

@@ -17,10 +17,11 @@ package org.springframework.batch.item;
/**
* Exception indicating that an {@link ItemWriter} needed to be opened before being
* written to..
* written to.
*
* @author Lucas Ward
*/
@SuppressWarnings("serial")
public class WriterNotOpenException extends ItemWriterException {
/**

View File

@@ -218,6 +218,7 @@ public abstract class AbstractMethodInvokingDelegator<T> implements Initializing
*
* @author Robert Kasanicky
*/
@SuppressWarnings("serial")
public static class InvocationTargetThrowableWrapper extends RuntimeException {
public InvocationTargetThrowableWrapper(Throwable cause) {

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2013 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.item.data;
import java.util.Iterator;

View File

@@ -60,7 +60,7 @@ import com.mongodb.util.JSON;
* <p>
* The implementation is thread-safe between calls to
* {@link #open(ExecutionContext)}, but remember to use <code>saveState=false</code>
* if used in a multi-threaded client (no restart available.
* if used in a multi-threaded client (no restart available).
* </p>
*
*
@@ -127,7 +127,7 @@ public class MongoItemReader<T> extends AbstractPaginatedDataItemReader<T> imple
* JSON defining the fields to be returned from the matching documents
* by MongoDB.
*
* @param fields JSON string that identifies the fields to sorty by.
* @param fields JSON string that identifies the fields to sort by.
*/
public void setFields(String fields) {
this.fields = fields;
@@ -183,6 +183,7 @@ public class MongoItemReader<T> extends AbstractPaginatedDataItemReader<T> imple
*
* @see InitializingBean#afterPropertiesSet()
*/
@Override
public void afterPropertiesSet() throws Exception {
Assert.state(template != null, "An implementation of MongoOperations is required.");
Assert.state(type != null, "A type to convert the input into is required.");

View File

@@ -37,7 +37,7 @@ import org.springframework.util.StringUtils;
* </p>
*
* <p>
* This writer is thread safe once all properties are set (normal singleton behavior) so it can be used in multiple
* This writer is thread-safe once all properties are set (normal singleton behavior) so it can be used in multiple
* concurrent transactions.
* </p>
*
@@ -91,13 +91,14 @@ public class MongoItemWriter<T> implements ItemWriter<T>, InitializingBean {
*
* @see org.springframework.batch.item.ItemWriter#write(List)
*/
@Override
public void write(List<? extends T> items) throws Exception {
if(!transactionActive()) {
doWrite(items);
return;
}
List bufferedItems = getCurrentBuffer();
List<T> bufferedItems = getCurrentBuffer();
bufferedItems.addAll(items);
}
@@ -140,14 +141,15 @@ public class MongoItemWriter<T> implements ItemWriter<T>, InitializingBean {
return TransactionSynchronizationManager.isActualTransactionActive();
}
private List<? extends T> getCurrentBuffer() {
@SuppressWarnings("unchecked")
private List<T> getCurrentBuffer() {
if(!TransactionSynchronizationManager.hasResource(bufferKey)) {
TransactionSynchronizationManager.bindResource(bufferKey, new ArrayList());
TransactionSynchronizationManager.bindResource(bufferKey, new ArrayList<T>());
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
@Override
public void beforeCommit(boolean readOnly) {
List items = (List) TransactionSynchronizationManager.getResource(bufferKey);
List<T> items = (List<T>) TransactionSynchronizationManager.getResource(bufferKey);
if(!CollectionUtils.isEmpty(items)) {
if(!readOnly) {
@@ -165,9 +167,10 @@ public class MongoItemWriter<T> implements ItemWriter<T>, InitializingBean {
});
}
return (List) TransactionSynchronizationManager.getResource(bufferKey);
return (List<T>) TransactionSynchronizationManager.getResource(bufferKey);
}
@Override
public void afterPropertiesSet() throws Exception {
Assert.state(template != null, "A MongoOperations implementation is required.");
}

View File

@@ -75,11 +75,11 @@ InitializingBean {
private String whereStatement;
private String orderByStatement;
private Class targetType;
private Class<T> targetType;
private Map<String, Object> parameterValues;
private ResultConverter resultConverter;
private ResultConverter<Map<String, Object>, T> resultConverter;
public Neo4jItemReader() {
setName(ClassUtils.getShortName(Neo4jItemReader.class));
@@ -119,7 +119,7 @@ InitializingBean {
}
/**
* An optional where fragement of the cypher query. WHERE is
* An optional where fragment of the cypher query. WHERE is
* prepended to the statement provided and should <em>not</em>
* be included.
*
@@ -156,7 +156,7 @@ InitializingBean {
*
* @param targetType the type of object to return.
*/
public void setTargetType(Class targetType) {
public void setTargetType(Class<T> targetType) {
this.targetType = targetType;
}
@@ -166,12 +166,11 @@ InitializingBean {
*
* @param resultConverter the converter to use.
*/
public void setResultConverter(ResultConverter resultConverter) {
public void setResultConverter(ResultConverter<Map<String, Object>, T> resultConverter) {
this.resultConverter = resultConverter;
}
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
protected Iterator<T> doPageRead() {
Result<Map<String, Object>> queryResults = template.query(
generateLimitCypherQuery(), parameterValues);
@@ -185,7 +184,7 @@ InitializingBean {
}
}
else {
return new ArrayList().iterator();
return new ArrayList<T>().iterator();
}
}

View File

@@ -33,7 +33,7 @@ import org.springframework.util.CollectionUtils;
* </p>
*
* <p>
* This writer is thread safe once all properties are set (normal singleton
* This writer is thread-safe once all properties are set (normal singleton
* behavior) so it can be used in multiple concurrent transactions.
* </p>
*
@@ -67,6 +67,7 @@ public class Neo4jItemWriter<T> implements ItemWriter<T>, InitializingBean {
*
* @see InitializingBean#afterPropertiesSet()
*/
@Override
public void afterPropertiesSet() throws Exception {
Assert.state(template != null, "A Neo4JOperations implementation is required");
}
@@ -76,6 +77,7 @@ public class Neo4jItemWriter<T> implements ItemWriter<T>, InitializingBean {
*
* @see org.springframework.batch.item.ItemWriter#write(java.util.List)
*/
@Override
public void write(List<? extends T> items) throws Exception {
if(!CollectionUtils.isEmpty(items)) {
doWrite(items);

View File

@@ -54,19 +54,18 @@ import org.springframework.util.MethodInvoker;
* </p>
*
* <p>
* This implementation is thread safe between calls to {@link #open(ExecutionContext)}, but remember to use
* This implementation is thread-safe between calls to {@link #open(ExecutionContext)}, but remember to use
* <code>saveState=false</code> if used in a multi-threaded client (no restart available).
* </p>
*
* @author Michael Minella
* @since 2.2
*/
@SuppressWarnings("rawtypes")
public class RepositoryItemReader<T> extends AbstractItemCountingItemStreamItemReader<T> implements InitializingBean {
protected Log logger = LogFactory.getLog(getClass());
private PagingAndSortingRepository repository;
private PagingAndSortingRepository<T, ?> repository;
private Sort sort;
@@ -76,7 +75,7 @@ public class RepositoryItemReader<T> extends AbstractItemCountingItemStreamItemR
private volatile int current = 0;
private List arguments;
private List<?> arguments;
private volatile List<T> results;
@@ -93,7 +92,7 @@ public class RepositoryItemReader<T> extends AbstractItemCountingItemStreamItemR
*
* @param arguments list of method arguments to be passed to the repository
*/
public void setArguments(List arguments) {
public void setArguments(List<?> arguments) {
this.arguments = arguments;
}
@@ -119,7 +118,7 @@ public class RepositoryItemReader<T> extends AbstractItemCountingItemStreamItemR
*
* @param repository underlying repository for input to be read from.
*/
public void setRepository(PagingAndSortingRepository repository) {
public void setRepository(PagingAndSortingRepository<T, ?> repository) {
this.repository = repository;
}
@@ -195,7 +194,7 @@ public class RepositoryItemReader<T> extends AbstractItemCountingItemStreamItemR
MethodInvoker invoker = createMethodInvoker(repository, methodName);
List parameters = new ArrayList();
List<Object> parameters = new ArrayList<Object>();
if(arguments != null && arguments.size() > 0) {
parameters.addAll(arguments);
@@ -205,7 +204,7 @@ public class RepositoryItemReader<T> extends AbstractItemCountingItemStreamItemR
invoker.setArguments(parameters.toArray());
Page curPage = (Page) doInvoke(invoker);
Page<T> curPage = (Page<T>) doInvoke(invoker);
return curPage.getContent();
}

View File

@@ -50,12 +50,11 @@ import org.springframework.util.MethodInvoker;
* @author Michael Minella
* @since 2.2
*/
@SuppressWarnings("rawtypes")
public class RepositoryItemWriter implements ItemWriter, InitializingBean {
public class RepositoryItemWriter<T> implements ItemWriter<T>, InitializingBean {
protected static final Log logger = LogFactory.getLog(RepositoryItemWriter.class);
private CrudRepository repository;
private CrudRepository<T, ?> repository;
private String methodName;
@@ -75,7 +74,7 @@ public class RepositoryItemWriter implements ItemWriter, InitializingBean {
*
* @param repository the Spring Data repository to be set
*/
public void setRepository(CrudRepository repository) {
public void setRepository(CrudRepository<T, ?> repository) {
this.repository = repository;
}
@@ -85,7 +84,7 @@ public class RepositoryItemWriter implements ItemWriter, InitializingBean {
* @see org.springframework.batch.item.ItemWriter#write(java.util.List)
*/
@Override
public void write(List items) throws Exception {
public void write(List<? extends T> items) throws Exception {
if(!CollectionUtils.isEmpty(items)) {
doWrite(items);
}
@@ -97,14 +96,14 @@ public class RepositoryItemWriter implements ItemWriter, InitializingBean {
*
* @param items the list of items to be persisted.
*/
protected void doWrite(List items) throws Exception {
protected void doWrite(List<? extends T> items) throws Exception {
if (logger.isDebugEnabled()) {
logger.debug("Writing to the repository with " + items.size() + " items.");
}
MethodInvoker invoker = createMethodInvoker(repository, methodName);
for (Object object : items) {
for (T object : items) {
invoker.setArguments(new Object [] {object});
doInvoke(invoker);
}

View File

@@ -142,7 +142,7 @@ implements InitializingBean {
/**
* Assert that mandatory properties are set.
*
* @throws IllegalArgumentException if either data source or sql properties
* @throws IllegalArgumentException if either data source or SQL properties
* not set.
*/
@Override

View File

@@ -35,7 +35,7 @@ import org.springframework.util.Assert;
* default (see {@link #setClearSession(boolean) clearSession} property).<br/>
* <br/>
*
* The writer is thread safe once properties are set (normal singleton behavior)
* The writer is thread-safe once properties are set (normal singleton behavior)
* if a {@link CurrentSessionContext} that uses only one session per thread is
* used.
*

View File

@@ -23,7 +23,6 @@ import org.hibernate.SessionFactory;
import org.hibernate.StatelessSession;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.database.orm.HibernateQueryProvider;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;

View File

@@ -50,7 +50,7 @@ import com.ibatis.sqlmap.engine.execution.BatchResult;
*
* It is expected that {@link #write(List)} is called inside a transaction.<br/>
*
* The writer is thread safe after its properties are set (normal singleton
* The writer is thread-safe after its properties are set (normal singleton
* behavior), so it can be used to write in multiple concurrent transactions.<br/>
*
* <em>Note:</em> This reader was refactored as part of Spring Batch 3.0 to use the iBatis

View File

@@ -51,7 +51,7 @@ import org.springframework.util.Assert;
*
* It is expected that {@link #write(List)} is called inside a transaction.<br/>
*
* The writer is thread safe after its properties are set (normal singleton
* The writer is thread-safe after its properties are set (normal singleton
* behavior), so it can be used to write in multiple concurrent transactions.
*
* @author Dave Syer
@@ -158,8 +158,8 @@ public class JdbcBatchItemWriter<T> implements ItemWriter<T>, InitializingBean {
/* (non-Javadoc)
* @see org.springframework.batch.item.ItemWriter#write(java.util.List)
*/
@SuppressWarnings("unchecked")
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
public void write(final List<? extends T> items) throws Exception {
if (!items.isEmpty()) {
@@ -183,9 +183,9 @@ public class JdbcBatchItemWriter<T> implements ItemWriter<T>, InitializingBean {
}
}
else {
updateCounts = (int[]) namedParameterJdbcTemplate.getJdbcOperations().execute(sql, new PreparedStatementCallback() {
updateCounts = namedParameterJdbcTemplate.getJdbcOperations().execute(sql, new PreparedStatementCallback<int[]>() {
@Override
public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
public int[] doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
for (T item : items) {
itemPreparedStatementSetter.setValues(item, ps);
ps.addBatch();

View File

@@ -50,7 +50,6 @@ import org.springframework.util.ClassUtils;
* @author Robert Kasanicky
* @author Thomas Risberg
*/
@SuppressWarnings("rawtypes")
public class JdbcCursorItemReader<T> extends AbstractCursorItemReader<T> {
PreparedStatement preparedStatement;
@@ -59,7 +58,7 @@ public class JdbcCursorItemReader<T> extends AbstractCursorItemReader<T> {
String sql;
RowMapper rowMapper;
RowMapper<T> rowMapper;
public JdbcCursorItemReader() {
super();
@@ -71,7 +70,7 @@ public class JdbcCursorItemReader<T> extends AbstractCursorItemReader<T> {
*
* @param rowMapper
*/
public void setRowMapper(RowMapper rowMapper) {
public void setRowMapper(RowMapper<T> rowMapper) {
this.rowMapper = rowMapper;
}
@@ -99,7 +98,7 @@ public class JdbcCursorItemReader<T> extends AbstractCursorItemReader<T> {
/**
* Assert that mandatory properties are set.
*
* @throws IllegalArgumentException if either data source or sql properties
* @throws IllegalArgumentException if either data source or SQL properties
* not set.
*/
@Override
@@ -136,9 +135,8 @@ public class JdbcCursorItemReader<T> extends AbstractCursorItemReader<T> {
@Override
@SuppressWarnings("unchecked")
protected T readCursor(ResultSet rs, int currentRow) throws SQLException {
return (T) rowMapper.mapRow(rs, currentRow);
return rowMapper.mapRow(rs, currentRow);
}
/**

View File

@@ -86,8 +86,7 @@ public class JdbcPagingItemReader<T> extends AbstractPagingItemReader<T> impleme
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
@SuppressWarnings("rawtypes")
private RowMapper rowMapper;
private RowMapper<T> rowMapper;
private String firstPageSql;
@@ -139,8 +138,7 @@ public class JdbcPagingItemReader<T> extends AbstractPagingItemReader<T> impleme
* {@link org.springframework.jdbc.core.simple.ParameterizedRowMapper}
* implementation
*/
@SuppressWarnings("rawtypes")
public void setRowMapper(RowMapper rowMapper) {
public void setRowMapper(RowMapper<T> rowMapper) {
this.rowMapper = rowMapper;
}
@@ -263,34 +261,25 @@ public class JdbcPagingItemReader<T> extends AbstractPagingItemReader<T> impleme
}
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
protected void doJumpToPage(int itemIndex) {
/*
* Normally this would be false (the startAfterValue is enough
* information to restart from.
*/
// TODO: this is dead code, startAfterValues is never null - see #open(ExecutionContext)
if (startAfterValues == null && getPage() > 0) {
String jumpToItemSql;
jumpToItemSql = queryProvider.generateJumpToItemQuery(itemIndex, getPageSize());
String jumpToItemSql = queryProvider.generateJumpToItemQuery(itemIndex, getPageSize());
if (logger.isDebugEnabled()) {
logger.debug("SQL used for jumping: [" + jumpToItemSql + "]");
}
RowMapper startMapper = new RowMapper() {
@Override
public Object mapRow(ResultSet rs, int i) throws SQLException {
return rs.getObject(1);
}
};
if (this.queryProvider.isUsingNamedParameters()) {
startAfterValues = (Map<String, Object>) namedParameterJdbcTemplate.queryForObject(jumpToItemSql,
getParameterMap(parameterValues, startAfterValues), startMapper);
startAfterValues = namedParameterJdbcTemplate.queryForMap(jumpToItemSql, getParameterMap(parameterValues, null));
}
else {
startAfterValues = (Map<String, Object>) getJdbcTemplate().queryForObject(jumpToItemSql,
getParameterList(parameterValues, startAfterValues).toArray(), startMapper);
startAfterValues = getJdbcTemplate().queryForMap(jumpToItemSql, getParameterList(parameterValues, null).toArray());
}
}
}
@@ -336,10 +325,9 @@ public class JdbcPagingItemReader<T> extends AbstractPagingItemReader<T> impleme
return parameterList;
}
@SuppressWarnings("rawtypes")
private class PagingRowMapper implements RowMapper {
private class PagingRowMapper implements RowMapper<T> {
@Override
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
public T mapRow(ResultSet rs, int rowNum) throws SQLException {
startAfterValues = new LinkedHashMap<String, Object>();
for (Map.Entry<String, Order> sortKey : queryProvider.getSortKeys().entrySet()) {
startAfterValues.put(sortKey.getKey(), rs.getObject(sortKey.getKey()));

View File

@@ -40,7 +40,7 @@ import org.springframework.util.Assert;
* {@link javax.persistence.EntityManagerFactory} that is capable of
* participating in Spring managed transactions.
*
* The writer is thread safe after its properties are set (normal singleton
* The writer is thread-safe after its properties are set (normal singleton
* behaviour), so it can be used to write in multiple concurrent transactions.
*
* @author Thomas Risberg

View File

@@ -55,7 +55,6 @@ import org.springframework.util.ClassUtils;
*
* @author Thomas Risberg
*/
@SuppressWarnings("rawtypes")
public class StoredProcedureItemReader<T> extends AbstractCursorItemReader<T> {
private CallableStatement callableStatement;
@@ -66,7 +65,7 @@ public class StoredProcedureItemReader<T> extends AbstractCursorItemReader<T> {
private String callString;
private RowMapper rowMapper;
private RowMapper<T> rowMapper;
private SqlParameter[] parameters = new SqlParameter[0];
@@ -84,7 +83,7 @@ public class StoredProcedureItemReader<T> extends AbstractCursorItemReader<T> {
*
* @param rowMapper
*/
public void setRowMapper(RowMapper rowMapper) {
public void setRowMapper(RowMapper<T> rowMapper) {
this.rowMapper = rowMapper;
}
@@ -140,7 +139,7 @@ public class StoredProcedureItemReader<T> extends AbstractCursorItemReader<T> {
/**
* Assert that mandatory properties are set.
*
* @throws IllegalArgumentException if either data source or sql properties
* @throws IllegalArgumentException if either data source or SQL properties
* not set.
*/
@Override
@@ -227,9 +226,8 @@ public class StoredProcedureItemReader<T> extends AbstractCursorItemReader<T> {
}
@Override
@SuppressWarnings("unchecked")
protected T readCursor(ResultSet rs, int currentRow) throws SQLException {
return (T) rowMapper.mapRow(rs, currentRow);
return rowMapper.mapRow(rs, currentRow);
}
/**

View File

@@ -147,7 +147,7 @@ public abstract class AbstractSqlPagingQueryProvider implements PagingQueryProvi
}
/**
* A Map<String, Boolean> of sort columns as the key and boolean for ascending/descending (assending = true).
* A Map<String, Boolean> of sort columns as the key and boolean for ascending/descending (ascending = true).
*
* @return sortKey key to use to sort and limit page content
*/

View File

@@ -49,8 +49,7 @@ import org.springframework.util.StringUtils;
* @author Dave Syer
* @author Michael Minella
*/
@SuppressWarnings("rawtypes")
public class SqlPagingQueryProviderFactoryBean implements FactoryBean {
public class SqlPagingQueryProviderFactoryBean implements FactoryBean<PagingQueryProvider> {
private DataSource dataSource;
@@ -148,7 +147,7 @@ public class SqlPagingQueryProviderFactoryBean implements FactoryBean {
* @see FactoryBean#getObject()
*/
@Override
public Object getObject() throws Exception {
public PagingQueryProvider getObject() throws Exception {
DatabaseType type;
try {

View File

@@ -40,7 +40,7 @@ public class SqlPagingQueryUtils {
*
* @param provider {@link AbstractSqlPagingQueryProvider} providing the
* implementation specifics
* @param remainingPageQuery is this query for the ramining pages (true) as
* @param remainingPageQuery is this query for the remaining pages (true) as
* opposed to the first page (false)
* @param limitClause the implementation specific limit clause to be used
* @return the generated query
@@ -63,7 +63,7 @@ public class SqlPagingQueryUtils {
*
* @param provider {@link AbstractSqlPagingQueryProvider} providing the
* implementation specifics
* @param remainingPageQuery is this query for the ramining pages (true) as
* @param remainingPageQuery is this query for the remaining pages (true) as
* opposed to the first page (false)
* @param limitClause the implementation specific limit clause to be used
* @return the generated query
@@ -91,7 +91,7 @@ public class SqlPagingQueryUtils {
*
* @param provider {@link AbstractSqlPagingQueryProvider} providing the
* implementation specifics
* @param remainingPageQuery is this query for the ramining pages (true) as
* @param remainingPageQuery is this query for the remaining pages (true) as
* opposed to the first page (false)
* @param topClause the implementation specific top clause to be used
* @return the generated query
@@ -113,7 +113,7 @@ public class SqlPagingQueryUtils {
*
* @param provider {@link AbstractSqlPagingQueryProvider} providing the
* implementation specifics
* @param remainingPageQuery is this query for the ramining pages (true) as
* @param remainingPageQuery is this query for the remaining pages (true) as
* opposed to the first page (false)
* @param topClause the implementation specific top clause to be used
* @return the generated query

View File

@@ -19,7 +19,7 @@ package org.springframework.batch.item.database.support;
import org.springframework.util.StringUtils;
/**
* Sql Server implementation of a
* SQL Server implementation of a
* {@link org.springframework.batch.item.database.PagingQueryProvider} using
* database specific features.
*

View File

@@ -49,7 +49,7 @@ import org.springframework.util.ClassUtils;
*
* Uses buffered writer to improve performance.<br/>
*
* The implementation is *not* thread-safe.
* The implementation is <b>not</b> thread-safe.
*
* @author Waseem Malik
* @author Tomas Slanina

View File

@@ -27,6 +27,7 @@ import org.springframework.batch.item.ParseException;
* @author Lucas Ward
* @author Ben Hale
*/
@SuppressWarnings("serial")
public class FlatFileParseException extends ParseException {
private String input;

View File

@@ -42,7 +42,7 @@ public interface LineMapper<T> {
* @param line to be mapped
* @param lineNumber of the current line
* @return mapped object of type T
* @throws Exception if error occured while parsing.
* @throws Exception if error occurred while parsing.
*/
T mapLine(String line, int lineNumber) throws Exception;
}

View File

@@ -22,6 +22,7 @@ import org.springframework.batch.item.NonTransientResourceException;
*
* @author Dave Syer
*/
@SuppressWarnings("serial")
public class NonTransientFlatFileException extends NonTransientResourceException {
private String input;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2009-2014 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.item.file;
import java.util.Arrays;
@@ -19,7 +34,7 @@ import org.springframework.core.io.support.ResourceArrayPropertyEditor;
* <br/>
* <br/>
*
* Thread safe between calls to {@link #open(ExecutionContext)}. The
* Thread-safe between calls to {@link #open(ExecutionContext)}. The
* {@link ExecutionContext} is not accurate in a multi-threaded environment, so
* do not rely on that data for restart (i.e. always open with a fresh context).
*

View File

@@ -247,7 +247,6 @@ public class BeanWrapperFieldSetMapper<T> extends DefaultPropertyEditorRegistrar
* @param properties
* @return
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
private Properties getBeanProperties(Object bean, Properties properties) {
Class<?> cls = bean.getClass();
@@ -259,6 +258,7 @@ public class BeanWrapperFieldSetMapper<T> extends DefaultPropertyEditorRegistrar
}
Map<String, String> matches = new HashMap<String, String>(propertiesMatched.get(distanceKey));
@SuppressWarnings({ "unchecked", "rawtypes" })
Set<String> keys = new HashSet(properties.keySet());
for (String key : keys) {

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2009-2014 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.item.file.mapping;
import java.util.Map;
@@ -7,7 +22,7 @@ import org.codehaus.jackson.map.MappingJsonFactory;
import org.springframework.batch.item.file.LineMapper;
/**
* Interpret a line as a Json object and parse it up to a Map. The line should be a standard Json object, starting with
* Interpret a line as a JSON object and parse it up to a Map. The line should be a standard JSON object, starting with
* "{" and ending with "}" and composed of <code>name:value</code> pairs separated by commas. Whitespace is ignored,
* e.g.
*
@@ -15,7 +30,7 @@ import org.springframework.batch.item.file.LineMapper;
* { "foo" : "bar", "value" : 123 }
* </pre>
*
* The values can also be Json objects (which are converted to maps):
* The values can also be JSON objects (which are converted to maps):
*
* <pre>
* { "foo": "bar", "map": { "one": 1, "two": 2}}

View File

@@ -113,7 +113,7 @@ public class DefaultRecordSeparatorPolicy extends SimpleRecordSeparatorPolicy {
* contains an unterminated quote, indicating that the record is continuing
* onto the next line.
*
* @param result
* @param line
* @return
*/
private boolean isQuoteUnterminated(String line) {
@@ -125,7 +125,7 @@ public class DefaultRecordSeparatorPolicy extends SimpleRecordSeparatorPolicy {
* with the continuation marker, indicating that the record is continuing
* onto the next line.
*
* @param result
* @param line
* @return
*/
private boolean isContinued(String line) {

View File

@@ -97,7 +97,7 @@ public abstract class AbstractLineTokenizer implements LineTokenizer {
* Yields the tokens resulting from the splitting of the supplied
* <code>line</code>.
*
* @param line the line to be tokenised (can be <code>null</code>)
* @param line the line to be tokenized (can be <code>null</code>)
*
* @return the resulting tokens
*/
@@ -115,7 +115,7 @@ public abstract class AbstractLineTokenizer implements LineTokenizer {
adjustTokenCountIfNecessary( tokens );
}
String[] values = (String[]) tokens.toArray(new String[tokens.size()]);
String[] values = tokens.toArray(new String[tokens.size()]);
if (names.length == 0) {
return fieldSetFactory.create(values);

View File

@@ -40,7 +40,7 @@ public enum Alignment {
this.label = label;
}
public Comparable getCode() {
public Comparable<String> getCode() {
return code;
}

View File

@@ -19,6 +19,7 @@ package org.springframework.batch.item.file.transform;
* @author Dave Syer
*
*/
@SuppressWarnings("serial")
public class ConversionException extends RuntimeException {
/**

View File

@@ -108,7 +108,7 @@ public class DefaultFieldSet implements FieldSet {
throw new IllegalArgumentException("Field names must be same length as values: names="
+ Arrays.asList(names) + ", values=" + Arrays.asList(tokens));
}
this.tokens = (String[]) tokens.clone();
this.tokens = tokens.clone();
this.names = Arrays.asList(names);
setNumberFormat(NumberFormat.getInstance(Locale.US));
}
@@ -437,7 +437,7 @@ public class DefaultFieldSet implements FieldSet {
*/
@Override
public double readDouble(int index) {
return (Double) parseNumber(readAndTrim(index)).doubleValue();
return parseNumber(readAndTrim(index)).doubleValue();
}
/*
@@ -740,7 +740,7 @@ public class DefaultFieldSet implements FieldSet {
for (int i = 0; i < tokens.length; i++) {
String value = readAndTrim(i);
if (value != null) {
props.setProperty((String) names.get(i), value);
props.setProperty(names.get(i), value);
}
}
return props;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2009-2012 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.item.file.transform;
import java.text.DateFormat;

View File

@@ -226,10 +226,10 @@ public class DelimitedLineTokenizer extends AbstractLineTokenizer {
/**
* Is the supplied character the delimiter character?
*
* @param c the character to be checked
* @param chars the characters to be checked
* @return <code>true</code> if the supplied character is the delimiter
* character
* @see DelimitedLineTokenizer#DelimitedLineTokenizer(char)
* @see DelimitedLineTokenizer#DelimitedLineTokenizer(String)
*/
private boolean isDelimiter(char[] chars, int i, String token, int endIndexLastDelimiter) {
boolean result = false;

View File

@@ -195,7 +195,7 @@ public interface FieldSet {
* using the supplied <code>defaultValue</code> if the field value is
* blank.
*
* @param index the field index..
* @param index the field index.
* @throws IndexOutOfBoundsException if the index is out of bounds.
*/
int readInt(int index, int defaultValue);
@@ -233,7 +233,7 @@ public interface FieldSet {
* using the supplied <code>defaultValue</code> if the field value is
* blank.
*
* @param index the field index..
* @param index the field index.
* @throws IndexOutOfBoundsException if the index is out of bounds.
*/
long readLong(int index, long defaultValue);

View File

@@ -1,5 +1,17 @@
/**
*
/*
* Copyright 2009-2010 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.item.file.transform;

View File

@@ -90,7 +90,7 @@ public class FixedLengthTokenizer extends AbstractLineTokenizer {
* Yields the tokens resulting from the splitting of the supplied
* <code>line</code>.
*
* @param line the line to be tokenised (can be <code>null</code>)
* @param line the line to be tokenized (can be <code>null</code>)
*
* @return the resulting tokens (empty if the line is null)
* @throws IncorrectLineLengthException if line length is greater than or

View File

@@ -18,12 +18,13 @@ package org.springframework.batch.item.file.transform;
/**
* Exception indicating that some type of error has occured while
* Exception indicating that some type of error has occurred while
* attempting to parse a line of input into tokens.
*
* @author Lucas Ward
*
*/
@SuppressWarnings("serial")
public class FlatFileFormatException extends RuntimeException {
/**

View File

@@ -22,6 +22,7 @@ package org.springframework.batch.item.file.transform;
* @author Lucas Ward
* @since 1.1
*/
@SuppressWarnings("serial")
public class IncorrectLineLengthException extends FlatFileFormatException {
private int actualLength;

View File

@@ -22,6 +22,7 @@ package org.springframework.batch.item.file.transform;
* @author Lucas Ward
* @since 1.1
*/
@SuppressWarnings("serial")
public class IncorrectTokenCountException extends FlatFileFormatException {
private int actualCount;

View File

@@ -24,7 +24,7 @@ import org.springframework.util.Assert;
/**
* A {@link LineTokenizer} implementation that stores a mapping of String
* patterns to delegate {@link LineTokenizer}s. Each line tokenizied will be
* patterns to delegate {@link LineTokenizer}s. Each line tokenized will be
* checked to see if it matches a pattern. If the line matches a key in the map
* of delegates, then the corresponding delegate {@link LineTokenizer} will be
* used. Patterns are sorted starting with the most specific, and the first

View File

@@ -32,7 +32,7 @@ import org.springframework.util.Assert;
* {@link #read()}.<br/>
* <br/>
*
* The implementation is thread safe after its properties are set (normal
* The implementation is thread-safe after its properties are set (normal
* singleton behavior).
*
* @author Dave Syer
@@ -47,7 +47,7 @@ public class JmsItemReader<T> implements ItemReader<T>, InitializingBean {
protected JmsOperations jmsTemplate;
/**
* Setter for jms template.
* Setter for JMS template.
*
* @param jmsTemplate a {@link JmsOperations} instance
*/

View File

@@ -31,7 +31,7 @@ import org.springframework.util.Assert;
* {@link #write(List)}.<br/>
* <br/>
*
* The implementation is thread safe after its properties are set (normal
* The implementation is thread-safe after its properties are set (normal
* singleton behavior).
*
* @author Dave Syer
@@ -61,7 +61,7 @@ public class JmsItemWriter<T> implements ItemWriter<T> {
}
/**
* Send the items one-by-one to the default destination of the jms template.
* Send the items one-by-one to the default destination of the JMS template.
*
* @see org.springframework.batch.item.ItemWriter#write(java.util.List)
*/

View File

@@ -101,7 +101,6 @@ public class SimpleMailMessageItemWriter implements ItemWriter<SimpleMailMessage
mailSender.send(items.toArray(new SimpleMailMessage[items.size()]));
}
catch (MailSendException e) {
@SuppressWarnings("unchecked")
Map<Object, Exception> failedMessages = e.getFailedMessages();
for (Entry<Object, Exception> entry : failedMessages.entrySet()) {
mailErrorHandler.handle((SimpleMailMessage) entry.getKey(), entry.getValue());

View File

@@ -105,7 +105,6 @@ public class MimeMessageItemWriter implements ItemWriter<MimeMessage> {
mailSender.send(items.toArray(new MimeMessage[items.size()]));
}
catch (MailSendException e) {
@SuppressWarnings("unchecked")
Map<Object, Exception> failedMessages = e.getFailedMessages();
for (Entry<Object, Exception> entry : failedMessages.entrySet()) {
mailErrorHandler.handle(new MimeMailMessage((MimeMessage)entry.getKey()), entry.getValue());

View File

@@ -29,7 +29,7 @@ import org.springframework.util.Assert;
* item count in the {@link ExecutionContext} (therefore requires item ordering
* to be preserved between runs).
*
* Subclasses are inherently *not* thread-safe.
* Subclasses are inherently <b>not</b> thread-safe.
*
* @author Robert Kasanicky
*/

View File

@@ -34,7 +34,7 @@ import org.springframework.batch.item.UnexpectedInputException;
* </p>
*
* <p>
* Intentionally not thread safe: it wouldn't be possible to honour the peek in
* Intentionally <b>not</b> thread-safe: it wouldn't be possible to honour the peek in
* multiple threads because only one of the threads that peeked would get that
* item in the next call to read.
* </p>

View File

@@ -116,7 +116,7 @@ public final class FileUtils {
return file.createNewFile() && file.exists();
}
catch (IOException e) {
// On some filesystems you can get an exception here even though the
// On some file systems you can get an exception here even though the
// files was successfully created
if (file.exists()) {
return true;

View File

@@ -23,6 +23,7 @@ import org.springframework.batch.item.ItemReaderException;
*
* @author Ben Hale
*/
@SuppressWarnings("serial")
public class ValidationException extends ItemReaderException {
/**

View File

@@ -50,7 +50,7 @@ import org.springframework.util.StringUtils;
* wrapped with StartDocument and EndDocument events so that the fragments can be further processed like standalone XML
* documents.
*
* The implementation is *not* thread-safe.
* The implementation is <b>not</b> thread-safe.
*
* @author Robert Kasanicky
*/

View File

@@ -66,7 +66,7 @@ import org.springframework.util.StringUtils;
* This item writer also provides restart, statistics and transaction features
* by implementing corresponding interfaces.
*
* The implementation is *not* thread-safe.
* The implementation is <b>not</b> thread-safe.
*
* @author Peter Zozom
* @author Robert Kasanicky
@@ -154,7 +154,7 @@ ResourceAwareItemWriterItemStream<T>, InitializingBean {
private boolean restarted = false;
// List holding the QName of elements that were opened in the header callback, but not closed
private List<QName> unclosedHeaderCallbackElements = Collections.EMPTY_LIST;
private List<QName> unclosedHeaderCallbackElements = Collections.emptyList();
public StaxEventItemWriter() {
setExecutionContextName(ClassUtils.getShortName(StaxEventItemWriter.class));
@@ -417,7 +417,6 @@ ResourceAwareItemWriterItemStream<T>, InitializingBean {
/**
* Helper method for opening output source at given file position
*/
@SuppressWarnings("resource")
private void open(long position) {
File file;
@@ -525,7 +524,7 @@ ResourceAwareItemWriterItemStream<T>, InitializingBean {
}
/**
* Subclasses can override to customize the stax result.
* Subclasses can override to customize the STAX result.
* @return a result for writing to
* @throws Exception
*/

View File

@@ -36,12 +36,11 @@ import org.springframework.util.ClassUtils;
* The returned object determines whether the environment has Spring OXM as included in the Spring 3.x series of relies
* or whether it has Spring OXM from Spring WS 1.5x and factories a StaxSource instance appropriately.
* <p/>
* As the only class state maintained is to cache java reflection metadata, which is thread safe, this class is thread-safe.
* As the only class state maintained is to cache java reflection metadata, which is thread-safe, this class is thread-safe.
*
* @author Josh Long
*
*/
@SuppressWarnings("restriction")
public abstract class StaxUtils {
private static final Log logger = LogFactory.getLog(StaxUtils.class);
@@ -61,8 +60,7 @@ public abstract class StaxUtils {
private static Method staxUtilsSourceMethodOnSpring30, staxUtilsResultMethodOnSpring30;
@SuppressWarnings("rawtypes")
private static Constructor staxSourceClassCtorOnSpringWs15, staxResultClassCtorOnSpringWs15;
private static Constructor<?> staxSourceClassCtorOnSpringWs15, staxResultClassCtorOnSpringWs15;
static {
try {

View File

@@ -1,11 +1,25 @@
/*
* Copyright 2013-2014 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.jsr.item;
import javax.batch.api.chunk.ItemProcessor;
import org.springframework.util.Assert;
@SuppressWarnings("rawtypes")
public class ItemProcessorAdapter implements org.springframework.batch.item.ItemProcessor {
public class ItemProcessorAdapter<I, O> implements org.springframework.batch.item.ItemProcessor<I, O> {
private ItemProcessor delegate;
@@ -14,8 +28,9 @@ public class ItemProcessorAdapter implements org.springframework.batch.item.Item
this.delegate = processor;
}
@SuppressWarnings("unchecked")
@Override
public Object process(Object item) throws Exception {
return delegate.processItem(item);
public O process(I item) throws Exception {
return (O) delegate.processItem(item);
}
}

View File

@@ -29,8 +29,7 @@ import org.springframework.util.ClassUtils;
* @author Michael Minella
* @since 3.0
*/
@SuppressWarnings("rawtypes")
public class ItemReaderAdapter extends CheckpointSupport implements org.springframework.batch.item.ItemReader {
public class ItemReaderAdapter<T> extends CheckpointSupport implements org.springframework.batch.item.ItemReader<T> {
private static final String CHECKPOINT_KEY = "reader.checkpoint";
@@ -49,9 +48,10 @@ public class ItemReaderAdapter extends CheckpointSupport implements org.springfr
/* (non-Javadoc)
* @see org.springframework.batch.item.ItemReader#read()
*/
@SuppressWarnings("unchecked")
@Override
public Object read() throws Exception {
return delegate.readItem();
public T read() throws Exception {
return (T) delegate.readItem();
}
/* (non-Javadoc)

View File

@@ -30,8 +30,7 @@ import org.springframework.util.ClassUtils;
* @author Michael Minella
* @since 3.0
*/
@SuppressWarnings("rawtypes")
public class ItemWriterAdapter extends CheckpointSupport implements org.springframework.batch.item.ItemWriter {
public class ItemWriterAdapter<T> extends CheckpointSupport implements org.springframework.batch.item.ItemWriter<T> {
private static final String CHECKPOINT_KEY = "writer.checkpoint";
@@ -50,10 +49,10 @@ public class ItemWriterAdapter extends CheckpointSupport implements org.springfr
/* (non-Javadoc)
* @see org.springframework.batch.item.ItemWriter#write(java.util.List)
*/
@Override
@SuppressWarnings("unchecked")
public void write(List items) throws Exception {
delegate.writeItems(items);
@Override
public void write(List<? extends T> items) throws Exception {
delegate.writeItems((List<Object>) items);
}
/* (non-Javadoc)

View File

@@ -18,6 +18,7 @@ package org.springframework.batch.repeat;
import org.springframework.core.NestedRuntimeException;
@SuppressWarnings("serial")
public class RepeatException extends NestedRuntimeException {
public RepeatException(String msg) {

View File

@@ -180,7 +180,7 @@ public class RepeatContextSupport extends SynchronizedAttributeAccessor implemen
return;
}
throw (RuntimeException) errors.get(0);
throw errors.get(0);
}
}

View File

@@ -144,6 +144,7 @@ public class RepeatOperationsInterceptor implements MethodInterceptor {
* @author Dave Syer
*
*/
@SuppressWarnings("serial")
private static class RepeatOperationsInterceptorException extends RepeatException {
/**
* @param message

View File

@@ -27,7 +27,7 @@ import org.springframework.batch.repeat.context.RepeatContextSupport;
/**
* Composite policy that loops through a list of delegate policies and answers
* calls by a concensus.
* calls by a consensus.
*
* @author Dave Syer
*

View File

@@ -35,7 +35,7 @@ import org.springframework.batch.repeat.context.RepeatContextSupport;
public class TimeoutTerminationPolicy extends CompletionPolicySupport {
/**
* Default timeout value in millisecs (the value equivalent to 30 seconds).
* Default timeout value in milliseconds (the value equivalent to 30 seconds).
*/
public static final long DEFAULT_TIMEOUT = 30000L;

View File

@@ -90,7 +90,7 @@ public class RepeatTemplate implements RepeatOperations {
public void registerListener(RepeatListener listener) {
List<RepeatListener> list = new ArrayList<RepeatListener>(Arrays.asList(listeners));
list.add(listener);
listeners = (RepeatListener[]) list.toArray(new RepeatListener[list.size()]);
listeners = list.toArray(new RepeatListener[list.size()]);
}
/**
@@ -159,7 +159,7 @@ public class RepeatTemplate implements RepeatOperations {
*
* @param callback the callback to process each element of the loop.
*
* @return the aggregate of {@link ContinuationPolicy#canContinue(Object)}
* @return the aggregate of {@link RepeatTemplate#canContinue(RepeatStatus)}
* for all the results from the callback.
*
*/
@@ -248,7 +248,7 @@ public class RepeatTemplate implements RepeatOperations {
try {
if (!deferred.isEmpty()) {
Throwable throwable = (Throwable) deferred.iterator().next();
Throwable throwable = deferred.iterator().next();
logger.debug("Handling fatal exception explicitly (rethrowing first of " + deferred.size() + "): "
+ throwable.getClass().getName() + ": " + throwable.getMessage());
rethrow(throwable);
@@ -389,7 +389,7 @@ public class RepeatTemplate implements RepeatOperations {
* @return true if the value is {@link RepeatStatus#CONTINUABLE}.
*/
protected final boolean canContinue(RepeatStatus value) {
return ((RepeatStatus) value).isContinuable();
return value.isContinuable();
}
private boolean isMarkedComplete(RepeatContext context) {

View File

@@ -34,12 +34,12 @@ import org.springframework.util.Assert;
* or for the whole batch by making the execute method transactional (but only
* then if the task executor is synchronous).<br/>
*
* This class is thread safe if its collaborators are thread safe (interceptors,
* This class is thread-safe if its collaborators are thread-safe (interceptors,
* terminationPolicy, callback). Normally this will be the case, but clients
* need to be aware that if the task executor is asynchronous, then the other
* collaborators should be also. In particular the {@link RepeatCallback} that
* is wrapped in the execute method must be thread safe - often it is based on
* some form of data source, which itself should be both thread safe and
* is wrapped in the execute method must be thread-safe - often it is based on
* some form of data source, which itself should be both thread-safe and
* transactional (multiple threads could be accessing it at any given time, and
* each thread would have its own transaction).<br/>
*

View File

@@ -29,7 +29,7 @@ import org.springframework.util.ClassUtils;
* A re-usable {@link PropertyEditorRegistrar} that can be used wherever one
* needs to register custom {@link PropertyEditor} instances with a
* {@link PropertyEditorRegistry} (like a bean wrapper, or a type converter). It
* is not thread safe, but useful where one is confident that binding or
* is <b>not</b> thread safe, but useful where one is confident that binding or
* initialisation can only be single threaded (e.g in a standalone application
* with no threads).
*

View File

@@ -52,7 +52,7 @@ public class MethodInvokerUtils {
Method method = ClassUtils.getMethodIfAvailable(object.getClass(), methodName, paramTypes);
if (method == null) {
String errorMsg = "no method found with name [" + methodName + "] on class ["
+ object.getClass().getSimpleName() + "] compatable with the signature ["
+ object.getClass().getSimpleName() + "] compatible with the signature ["
+ getParamTypesString(paramTypes) + "].";
Assert.isTrue(!paramsRequired, errorMsg);
// if no method was found for the given parameters, and the
@@ -124,7 +124,7 @@ public class MethodInvokerUtils {
Class<?>[] paramTypes = method.getParameterTypes();
if (paramTypes.length > 0) {
String errorMsg = "The method [" + method.getName() + "] on target class ["
+ targetClass.getSimpleName() + "] is incompatable with the signature ["
+ targetClass.getSimpleName() + "] is incompatible with the signature ["
+ getParamTypesString(expectedParamTypes) + "] expected for the annotation ["
+ annotationType.getSimpleName() + "].";

View File

@@ -49,7 +49,7 @@ public final class PropertiesConverter {
// prevents the class from being instantiated
private PropertiesConverter() {
};
}
/**
* Parse a String to a Properties object. If string is null, an empty

View File

@@ -22,6 +22,7 @@ package org.springframework.batch.support.transaction;
* @author Lucas Ward
* @author Ben Hale
*/
@SuppressWarnings("serial")
public class FlushFailedException extends RuntimeException {
/**

View File

@@ -24,6 +24,7 @@ import org.springframework.transaction.support.AbstractPlatformTransactionManage
import org.springframework.transaction.support.DefaultTransactionStatus;
import org.springframework.transaction.support.TransactionSynchronizationManager;
@SuppressWarnings("serial")
public class ResourcelessTransactionManager extends AbstractPlatformTransactionManager {
@Override

View File

@@ -159,11 +159,11 @@ public class TransactionAwareProxyFactory<T> {
}
public static <K, V> Map<K, V> createTransactionalMap() {
return (Map<K, V>) new TransactionAwareProxyFactory<ConcurrentHashMap<K, V>>(new ConcurrentHashMap<K, V>()).createInstance();
return new TransactionAwareProxyFactory<ConcurrentHashMap<K, V>>(new ConcurrentHashMap<K, V>()).createInstance();
}
public static <K, V> Map<K, V> createTransactionalMap(Map<K, V> map) {
return (Map<K, V>) new TransactionAwareProxyFactory<ConcurrentHashMap<K, V>>(new ConcurrentHashMap<K, V>(map)).createInstance();
return new TransactionAwareProxyFactory<ConcurrentHashMap<K, V>>(new ConcurrentHashMap<K, V>(map)).createInstance();
}
public static <K, V> ConcurrentMap<K, V> createAppendOnlyTransactionalMap() {
@@ -171,27 +171,27 @@ public class TransactionAwareProxyFactory<T> {
}
public static <T> Set<T> createAppendOnlyTransactionalSet() {
return (Set<T>) new TransactionAwareProxyFactory<CopyOnWriteArraySet<T>>(new CopyOnWriteArraySet<T>(), true).createInstance();
return new TransactionAwareProxyFactory<CopyOnWriteArraySet<T>>(new CopyOnWriteArraySet<T>(), true).createInstance();
}
public static <T> Set<T> createTransactionalSet() {
return (Set<T>) new TransactionAwareProxyFactory<CopyOnWriteArraySet<T>>(new CopyOnWriteArraySet<T>()).createInstance();
return new TransactionAwareProxyFactory<CopyOnWriteArraySet<T>>(new CopyOnWriteArraySet<T>()).createInstance();
}
public static <T> Set<T> createTransactionalSet(Set<T> set) {
return (Set<T>) new TransactionAwareProxyFactory<CopyOnWriteArraySet<T>>(new CopyOnWriteArraySet<T>(set)).createInstance();
return new TransactionAwareProxyFactory<CopyOnWriteArraySet<T>>(new CopyOnWriteArraySet<T>(set)).createInstance();
}
public static <T> List<T> createAppendOnlyTransactionalList() {
return (List<T>) new TransactionAwareProxyFactory<CopyOnWriteArrayList<T>>(new CopyOnWriteArrayList<T>(), true).createInstance();
return new TransactionAwareProxyFactory<CopyOnWriteArrayList<T>>(new CopyOnWriteArrayList<T>(), true).createInstance();
}
public static <T> List<T> createTransactionalList() {
return (List<T>) new TransactionAwareProxyFactory<CopyOnWriteArrayList<T>>(new CopyOnWriteArrayList<T>()).createInstance();
return new TransactionAwareProxyFactory<CopyOnWriteArrayList<T>>(new CopyOnWriteArrayList<T>()).createInstance();
}
public static <T> List<T> createTransactionalList(List<T> list) {
return (List<T>) new TransactionAwareProxyFactory<CopyOnWriteArrayList<T>>(new CopyOnWriteArrayList<T>(list)).createInstance();
return new TransactionAwareProxyFactory<CopyOnWriteArrayList<T>>(new CopyOnWriteArrayList<T>(list)).createInstance();
}
private class TargetSynchronization extends TransactionSynchronizationAdapter {