diff --git a/spring-batch-infrastructure/.settings/org.eclipse.jdt.core.prefs b/spring-batch-infrastructure/.settings/org.eclipse.jdt.core.prefs index 064c44c20..65b674997 100644 --- a/spring-batch-infrastructure/.settings/org.eclipse.jdt.core.prefs +++ b/spring-batch-infrastructure/.settings/org.eclipse.jdt.core.prefs @@ -1,15 +1,22 @@ -#Tue Apr 22 10:18:03 CEST 2008 +#Tue Jul 15 10:10:09 CEST 2008 eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4 -org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore @@ -72,4 +79,4 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.4 +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContext.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContext.java index b17c40f29..ae49f83c2 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContext.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContext.java @@ -18,7 +18,6 @@ package org.springframework.batch.item; import java.io.Serializable; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; import java.util.Properties; import java.util.Set; @@ -27,10 +26,9 @@ import java.util.Map.Entry; import org.springframework.util.Assert; /** - * Object representing a context for an {@link ItemStream}. It is a thin - * wrapper for a map that allows optionally for type safety on reads. It also - * allows for dirty checking by setting a 'dirty' flag whenever any put is - * called. + * Object representing a context for an {@link ItemStream}. It is a thin wrapper + * for a map that allows optionally for type safety on reads. It also allows for + * dirty checking by setting a 'dirty' flag whenever any put is called. * * @author Lucas Ward * @author Douglas Kaminsky @@ -39,14 +37,14 @@ public class ExecutionContext implements Serializable { private boolean dirty = false; - private final Map map; + private final Map map; /** * Default constructor. Initializes a new execution context with an empty * internal map. */ public ExecutionContext() { - map = new HashMap(); + map = new HashMap(); } /** @@ -54,7 +52,7 @@ public class ExecutionContext implements Serializable { * * @param map Initial contents of context. */ - public ExecutionContext(Map map) { + public ExecutionContext(Map map) { this.map = map; } @@ -63,11 +61,10 @@ public class ExecutionContext implements Serializable { */ public ExecutionContext(ExecutionContext executionContext) { this(); - if (executionContext==null) { + if (executionContext == null) { return; } - for (Iterator iterator = executionContext.entrySet().iterator(); iterator.hasNext();) { - Entry entry = (Entry) iterator.next(); + for (Entry entry : executionContext.entrySet()) { this.map.put(entry.getKey(), entry.getValue()); } } @@ -233,7 +230,7 @@ public class ExecutionContext implements Serializable { * @param type Class against which value should be validated * @return Value typed to the specified Class */ - private Object readAndValidate(String key, Class type) { + private Object readAndValidate(String key, Class type) { Object value = map.get(key); @@ -268,7 +265,7 @@ public class ExecutionContext implements Serializable { * @return A set representing the contents of the context * @see java.util.Map#entrySet() */ - public Set entrySet() { + public Set> entrySet() { return map.entrySet(); } @@ -305,8 +302,7 @@ public class ExecutionContext implements Serializable { */ public Properties getProperties() { Properties props = new Properties(); - for (Iterator it = map.entrySet().iterator(); it.hasNext();) { - Entry entry = (Entry) it.next(); + for (Entry entry : map.entrySet()) { props.setProperty(entry.getKey().toString(), entry.getValue().toString()); } @@ -315,6 +311,7 @@ public class ExecutionContext implements Serializable { /* * (non-Javadoc) + * * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { @@ -330,6 +327,7 @@ public class ExecutionContext implements Serializable { /* * (non-Javadoc) + * * @see java.lang.Object#hashCode() */ public int hashCode() { @@ -338,6 +336,7 @@ public class ExecutionContext implements Serializable { /* * (non-Javadoc) + * * @see java.lang.Object#toString() */ public String toString() { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/adapter/AbstractMethodInvokingDelegator.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/adapter/AbstractMethodInvokingDelegator.java index b1b5f051d..360e82b83 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/adapter/AbstractMethodInvokingDelegator.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/adapter/AbstractMethodInvokingDelegator.java @@ -130,7 +130,7 @@ public class AbstractMethodInvokingDelegator implements InitializingBean { for (int i=0; i < methods.length; i++) { if (methods[i].getName().equals(targetMethodName)) { - Class[] params = methods[i].getParameterTypes(); + Class[] params = methods[i].getParameterTypes(); if (arguments == null) { return true; } else if (arguments.length == params.length) { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/AbstractTransactionalResourceItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/AbstractTransactionalResourceItemWriter.java index 04f1d87e4..0eb82720a 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/AbstractTransactionalResourceItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/AbstractTransactionalResourceItemWriter.java @@ -39,7 +39,7 @@ import org.springframework.util.Assert; */ public abstract class AbstractTransactionalResourceItemWriter implements ItemWriter { - private Set failed = new HashSet(); + private Set failed = new HashSet(); /** * Flushing delegated to subclass surrounded by binding and unbinding of @@ -140,7 +140,7 @@ public abstract class AbstractTransactionalResourceItemWriter implements ItemWri if (TransactionSynchronizationManager.hasResource(getResourceKey())) { return; } - TransactionSynchronizationManager.bindResource(getResourceKey(), new HashSet()); + TransactionSynchronizationManager.bindResource(getResourceKey(), new HashSet()); } /** @@ -158,10 +158,11 @@ public abstract class AbstractTransactionalResourceItemWriter implements ItemWri * * @return the processed */ - protected Set getProcessed() { + @SuppressWarnings("unchecked") + protected Set getProcessed() { Assert.state(TransactionSynchronizationManager.hasResource(getResourceKey()), "Processed items not bound to transaction."); - Set processed = (Set) TransactionSynchronizationManager.getResource(getResourceKey()); + Set processed = (Set) TransactionSynchronizationManager.getResource(getResourceKey()); return processed; } } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/BatchSqlUpdateItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/BatchSqlUpdateItemWriter.java index fffb83b83..0a4649521 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/BatchSqlUpdateItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/BatchSqlUpdateItemWriter.java @@ -18,7 +18,6 @@ package org.springframework.batch.item.database; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.springframework.batch.item.ClearFailedException; @@ -36,7 +35,8 @@ import org.springframework.util.Assert; * {@link PreparedStatement} if available and can take some rudimentary steps to * locate a failure during a flush, and identify the items that failed. When one * of those items is encountered again the batch is flushed aggressively so that - * the bad item is eventually identified and can be dealt with in isolation.
+ * the bad item is eventually identified and can be dealt with in + * isolation.
* * The user must provide an SQL query and a special callback * {@link ItemPreparedStatementSetter}, which is responsible for mapping the @@ -117,18 +117,19 @@ public class BatchSqlUpdateItemWriter extends AbstractTransactionalResourceItemW /** * Create and execute batch prepared statement. - * @throws EmptyResultDataAccessException if any of the items does not cause an update + * @throws EmptyResultDataAccessException if any of the items does not cause + * an update */ protected void doFlush() throws EmptyResultDataAccessException { - final List processed = new ArrayList(getProcessed()); + final List processed = new ArrayList(getProcessed()); if (!processed.isEmpty()) { int[] values = (int[]) jdbcTemplate.execute(sql, new PreparedStatementCallback() { public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException { - for (Iterator iterator = processed.iterator(); iterator.hasNext();) { - Object item = (Object) iterator.next(); + + for (Object item : processed) { preparedStatementSetter.setValues(item, ps); ps.addBatch(); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/DrivingQueryItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/DrivingQueryItemReader.java index 87f7c54e0..c29ce288b 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/DrivingQueryItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/DrivingQueryItemReader.java @@ -69,9 +69,9 @@ public class DrivingQueryItemReader implements ItemReader, InitializingBean, Ite private boolean initialized = false; - private List keys; + private List keys; - private Iterator keysIterator; + private Iterator keysIterator; private int currentIndex = 0; @@ -90,7 +90,7 @@ public class DrivingQueryItemReader implements ItemReader, InitializingBean, Ite * * @param keys */ - public DrivingQueryItemReader(List keys) { + public DrivingQueryItemReader(List keys) { this.keys = keys; this.keysIterator = keys.iterator(); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/KeyCollector.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/KeyCollector.java index d38a7dba3..f181daccf 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/KeyCollector.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/KeyCollector.java @@ -28,7 +28,7 @@ public interface KeyCollector { * that could potentially be used to retrieve the correct keys. * @return list of keys returned by the driving query (can be empty but not null) */ - List retrieveKeys(ExecutionContext executionContext); + List retrieveKeys(ExecutionContext executionContext); /** * Given the provided key, store it in the provided ExecutionContext. This