diff --git a/.gitignore b/.gitignore index be8627a54..38de559db 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ bin integration-repo derby-home derby.log +derbydb com.springsource.sts.config.flow.prefs diff --git a/archetypes/simple-cli/src/test/java/example/ExampleJobConfigurationTests.java b/archetypes/simple-cli/src/test/java/example/ExampleJobConfigurationTests.java index ea0b65791..b722cbe90 100644 --- a/archetypes/simple-cli/src/test/java/example/ExampleJobConfigurationTests.java +++ b/archetypes/simple-cli/src/test/java/example/ExampleJobConfigurationTests.java @@ -16,9 +16,6 @@ package example; import static org.junit.Assert.*; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.batch.core.BatchStatus; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/CoreNamespacePostProcessor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/CoreNamespacePostProcessor.java index 5d25cd1f2..0fca4ea9b 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/CoreNamespacePostProcessor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/CoreNamespacePostProcessor.java @@ -117,7 +117,6 @@ public class CoreNamespacePostProcessor implements BeanPostProcessor, BeanFactor * @param bean * @return */ - @SuppressWarnings("unchecked") private Object injectDefaults(Object bean) { if (bean instanceof JobParserJobFactoryBean) { JobParserJobFactoryBean fb = (JobParserJobFactoryBean) bean; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/CoreNamespaceUtils.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/CoreNamespaceUtils.java index 2d0d5fe61..f3f05a487 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/CoreNamespaceUtils.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/CoreNamespaceUtils.java @@ -16,7 +16,6 @@ package org.springframework.batch.core.configuration.xml; import java.util.Map; -import java.util.Set; import org.springframework.beans.PropertyValue; import org.springframework.beans.factory.config.BeanDefinition; @@ -93,14 +92,13 @@ public class CoreNamespaceUtils { } } - @SuppressWarnings("unchecked") private static boolean rangeArrayEditorAlreadyDefined(BeanDefinitionRegistry registry) { for (String beanName : registry.getBeanDefinitionNames()) { BeanDefinition bd = registry.getBeanDefinition(beanName); if (CUSTOM_EDITOR_CONFIGURER_CLASS_NAME.equals(bd.getBeanClassName())) { PropertyValue pv = bd.getPropertyValues().getPropertyValue("customEditors"); if (pv != null) { - for (Map.Entry entry : (Set) ((Map) pv.getValue()).entrySet()) { + for (Map.Entry entry : ((Map) pv.getValue()).entrySet()) { if (entry.getKey() instanceof TypedStringValue) { if (RANGE_ARRAY_CLASS_NAME.equals(((TypedStringValue) entry.getKey()).getValue())) { return true; @@ -172,9 +170,10 @@ public class CoreNamespaceUtils { * @return true if we find a schema declaration that matches */ public static boolean namespaceMatchesVersion(Element element) { - return matchesVersionInternal(element) && matchesVersionInternal(element.getOwnerDocument().getDocumentElement()); + return matchesVersionInternal(element) + && matchesVersionInternal(element.getOwnerDocument().getDocumentElement()); } - + private static boolean matchesVersionInternal(Element element) { String schemaLocation = element.getAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "schemaLocation"); return schemaLocation.matches("(?m).*spring-batch-2.1.xsd.*") diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobListenerFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobListenerFactoryBean.java index 6393a58df..1294477f7 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobListenerFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobListenerFactoryBean.java @@ -41,8 +41,7 @@ public class JobListenerFactoryBean extends AbstractListenerFactoryBean { return JobExecutionListener.class; } - @SuppressWarnings("unchecked") - public Class getObjectType() { + public Class getObjectType() { return JobExecutionListener.class; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/MulticasterBatchListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/MulticasterBatchListener.java index eb9aa9a14..eaad22e98 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/MulticasterBatchListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/MulticasterBatchListener.java @@ -33,7 +33,7 @@ import org.springframework.batch.item.ItemStream; * */ public class MulticasterBatchListener implements StepExecutionListener, ChunkListener, ItemReadListener, - ItemProcessListener, ItemWriteListener, SkipListener { + ItemProcessListener, ItemWriteListener, SkipListener { private CompositeStepExecutionListener stepListener = new CompositeStepExecutionListener(); @@ -45,7 +45,7 @@ public class MulticasterBatchListener implements StepExecutionListener, Ch private CompositeItemWriteListener itemWriteListener = new CompositeItemWriteListener(); - private CompositeSkipListener skipListener = new CompositeSkipListener(); + private CompositeSkipListener skipListener = new CompositeSkipListener(); /** * Initialise the listener instance. @@ -80,22 +80,22 @@ public class MulticasterBatchListener implements StepExecutionListener, Ch } if (listener instanceof ItemReadListener) { @SuppressWarnings("unchecked") - ItemReadListener itemReadListener = (ItemReadListener) listener; + ItemReadListener itemReadListener = (ItemReadListener) listener; this.itemReadListener.register(itemReadListener); } - if (listener instanceof ItemProcessListener) { + if (listener instanceof ItemProcessListener) { @SuppressWarnings("unchecked") - ItemProcessListener itemProcessListener = (ItemProcessListener) listener; + ItemProcessListener itemProcessListener = (ItemProcessListener) listener; this.itemProcessListener.register(itemProcessListener); } if (listener instanceof ItemWriteListener) { @SuppressWarnings("unchecked") - ItemWriteListener itemWriteListener = (ItemWriteListener) listener; + ItemWriteListener itemWriteListener = (ItemWriteListener) listener; this.itemWriteListener.register(itemWriteListener); } - if (listener instanceof SkipListener) { + if (listener instanceof SkipListener) { @SuppressWarnings("unchecked") - SkipListener skipListener = (SkipListener) listener; + SkipListener skipListener = (SkipListener) listener; this.skipListener.register(skipListener); } } @@ -294,7 +294,8 @@ public class MulticasterBatchListener implements StepExecutionListener, Ch /** * @param item * @param t - * @see org.springframework.batch.core.listener.CompositeSkipListener#onSkipInProcess(Object, Throwable) + * @see org.springframework.batch.core.listener.CompositeSkipListener#onSkipInProcess(Object, + * Throwable) */ public void onSkipInProcess(T item, Throwable t) { skipListener.onSkipInProcess(item, t); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFactoryBean.java index 70faaee48..24500d6d3 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFactoryBean.java @@ -41,7 +41,7 @@ public class StepListenerFactoryBean extends AbstractListenerFactoryBean { return StepListener.class; } - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public Class getObjectType() { return StepListener.class; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/util/PlaceholderTargetSource.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/util/PlaceholderTargetSource.java index 946d0da8b..65b1cb1d6 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/util/PlaceholderTargetSource.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/util/PlaceholderTargetSource.java @@ -116,7 +116,7 @@ public class PlaceholderTargetSource extends SimpleBeanTargetSource implements I beanFactory.copyConfigurationFrom(listableBeanFactory); final TypeConverter contextTypeConverter = new TypeConverter() { - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public Object convertIfNecessary(Object value, Class requiredType, MethodParameter methodParam) throws TypeMismatchException { Object result = null; @@ -158,7 +158,7 @@ public class PlaceholderTargetSource extends SimpleBeanTargetSource implements I return result != null ? result : typeConverter.convertIfNecessary(value, requiredType, methodParam); } - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public Object convertIfNecessary(Object value, Class requiredType) throws TypeMismatchException { return convertIfNecessary(value, requiredType, null); } @@ -309,7 +309,7 @@ public class PlaceholderTargetSource extends SimpleBeanTargetSource implements I super(new PlaceholderStringValueResolver(typeConverter)); } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) protected Object resolveValue(Object value) { if (value instanceof TypedStringValue) { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ChunkElementParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ChunkElementParserTests.java index 126ec8464..a2cfbd363 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ChunkElementParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ChunkElementParserTests.java @@ -55,7 +55,6 @@ import org.springframework.util.StringUtils; public class ChunkElementParserTests { @Test - @SuppressWarnings("unchecked") public void testSimpleAttributes() throws Exception { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ChunkElementSimpleAttributeParserTests-context.xml"); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java index 4818e4f24..6082b82e8 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java @@ -81,7 +81,7 @@ public class StepParserTests { public void testTaskletStepAttributes() throws Exception { ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/StepParserTaskletAttributesTests-context.xml"); - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) Map beans = ctx.getBeansOfType(StepParserStepFactoryBean.class); String factoryName = (String) beans.keySet().toArray()[0]; @SuppressWarnings("unchecked") diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepWithBasicProcessTaskJobParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepWithBasicProcessTaskJobParserTests.java index 4d39bcb7a..580fa20d0 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepWithBasicProcessTaskJobParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepWithBasicProcessTaskJobParserTests.java @@ -62,9 +62,8 @@ public class StepWithBasicProcessTaskJobParserTests { @Autowired private TestWriter writer; - @SuppressWarnings("unchecked") @Autowired - private StepParserStepFactoryBean factory; + private StepParserStepFactoryBean factory; @Test public void testStepWithTask() throws Exception { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepWithFaultTolerantProcessTaskJobParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepWithFaultTolerantProcessTaskJobParserTests.java index 8e2321313..6b00c7d4b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepWithFaultTolerantProcessTaskJobParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepWithFaultTolerantProcessTaskJobParserTests.java @@ -68,9 +68,8 @@ public class StepWithFaultTolerantProcessTaskJobParserTests { @Autowired private TestWriter writer; - @SuppressWarnings("unchecked") @Autowired - private StepParserStepFactoryBean factory; + private StepParserStepFactoryBean factory; @Test public void testStepWithTask() throws Exception { @@ -83,10 +82,10 @@ public class StepWithFaultTolerantProcessTaskJobParserTests { assertEquals("wrong retry-limit:", 3, rl); Object cc = ReflectionTestUtils.getField(factory, "cacheCapacity"); assertEquals("wrong cache-capacity:", 100, cc); - assertEquals("wrong transaction-attribute:", Propagation.REQUIRED, ReflectionTestUtils.getField(factory, - "propagation")); - assertEquals("wrong transaction-attribute:", Isolation.DEFAULT, ReflectionTestUtils.getField(factory, - "isolation")); + assertEquals("wrong transaction-attribute:", Propagation.REQUIRED, + ReflectionTestUtils.getField(factory, "propagation")); + assertEquals("wrong transaction-attribute:", Isolation.DEFAULT, + ReflectionTestUtils.getField(factory, "isolation")); assertEquals("wrong transaction-attribute:", 10, ReflectionTestUtils.getField(factory, "transactionTimeout")); Object txq = ReflectionTestUtils.getField(factory, "readerTransactionalQueue"); assertEquals("wrong reader-transactional-queue:", true, txq); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/StepListenerFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/StepListenerFactoryBeanTests.java index feed1194f..2f4309b50 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/StepListenerFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/StepListenerFactoryBeanTests.java @@ -99,7 +99,7 @@ public class StepListenerFactoryBeanTests { ((ChunkListener) listener).afterChunk(); ((ItemReadListener) listener).beforeRead(); ((ItemReadListener) listener).afterRead(readItem); - ((ItemReadListener) listener).onReadError(new Exception()); + ((ItemReadListener) listener).onReadError(new Exception()); ((ItemProcessListener) listener).beforeProcess(readItem); ((ItemProcessListener) listener).afterProcess(readItem, writeItem); ((ItemProcessListener) listener).onProcessError(readItem, new Exception()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/StepSynchronizationManagerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/StepSynchronizationManagerTests.java index e06bf5fae..b1ee1f02b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/StepSynchronizationManagerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/StepSynchronizationManagerTests.java @@ -23,8 +23,7 @@ import org.springframework.util.ReflectionUtils; public class StepSynchronizationManagerTests { - private StepExecution stepExecution = new StepExecution("step", - new JobExecution(0L)); + private StepExecution stepExecution = new StepExecution("step", new JobExecution(0L)); @Before @After @@ -44,8 +43,7 @@ public class StepSynchronizationManagerTests { @Test public void testClose() throws Exception { final List list = new ArrayList(); - StepContext context = StepSynchronizationManager - .register(stepExecution); + StepContext context = StepSynchronizationManager.register(stepExecution); context.registerDestructionCallback("foo", new Runnable() { public void run() { list.add("foo"); @@ -54,51 +52,45 @@ public class StepSynchronizationManagerTests { StepSynchronizationManager.close(); assertNull(StepSynchronizationManager.getContext()); assertEquals(0, list.size()); - // check for possible memory leak + // check for possible memory leak assertEquals(0, extractStaticMap("counts").size()); assertEquals(0, extractStaticMap("contexts").size()); } - @SuppressWarnings("unchecked") - private Map extractStaticMap(String name) throws IllegalAccessException { - Field field = ReflectionUtils.findField( - StepSynchronizationManager.class, name); + private Map extractStaticMap(String name) throws IllegalAccessException { + Field field = ReflectionUtils.findField(StepSynchronizationManager.class, name); ReflectionUtils.makeAccessible(field); - Map map = (Map) field.get(StepSynchronizationManager.class); + Map map = (Map) field.get(StepSynchronizationManager.class); return map; } @Test public void testMultithreaded() throws Exception { - StepContext context = StepSynchronizationManager - .register(stepExecution); + StepContext context = StepSynchronizationManager.register(stepExecution); ExecutorService executorService = Executors.newFixedThreadPool(2); - FutureTask task = new FutureTask( - new Callable() { - public StepContext call() throws Exception { - try { - StepSynchronizationManager.register(stepExecution); - StepContext context = StepSynchronizationManager - .getContext(); - context.setAttribute("foo", "bar"); - return context; - } finally { - StepSynchronizationManager.close(); - } - } - }); + FutureTask task = new FutureTask(new Callable() { + public StepContext call() throws Exception { + try { + StepSynchronizationManager.register(stepExecution); + StepContext context = StepSynchronizationManager.getContext(); + context.setAttribute("foo", "bar"); + return context; + } + finally { + StepSynchronizationManager.close(); + } + } + }); executorService.execute(task); executorService.awaitTermination(1, TimeUnit.SECONDS); - assertEquals(context.attributeNames().length, task.get() - .attributeNames().length); + assertEquals(context.attributeNames().length, task.get().attributeNames().length); StepSynchronizationManager.close(); assertNull(StepSynchronizationManager.getContext()); } @Test public void testRelease() { - StepContext context = StepSynchronizationManager - .register(stepExecution); + StepContext context = StepSynchronizationManager.register(stepExecution); final List list = new ArrayList(); context.registerDestructionCallback("foo", new Runnable() { public void run() { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/TransactionAwareProxyFactory.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/TransactionAwareProxyFactory.java index c1759ccd2..efac6507a 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/TransactionAwareProxyFactory.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/TransactionAwareProxyFactory.java @@ -86,7 +86,7 @@ public class TransactionAwareProxyFactory { * @param target the target object (List, Set or Map) * @return an independent copy */ - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) protected final T begin(T target) { // Unfortunately in Java 5 this method has to synchronized // (works OK without in Java 6). @@ -123,7 +123,7 @@ public class TransactionAwareProxyFactory { * @param copy the working copy. * @param target the original target of the factory. */ - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) protected void commit(T copy, T target) { // Unfortunately in Java 5 this method has to be synchronized // (works OK without in Java 6). @@ -157,49 +157,40 @@ public class TransactionAwareProxyFactory { } - @SuppressWarnings("unchecked") public static Map createTransactionalMap() { - return (Map) new TransactionAwareProxyFactory(new ConcurrentHashMap()).createInstance(); + return (Map) new TransactionAwareProxyFactory>(new ConcurrentHashMap()).createInstance(); } - @SuppressWarnings("unchecked") public static Map createTransactionalMap(Map map) { - return (Map) new TransactionAwareProxyFactory(new ConcurrentHashMap(map)).createInstance(); + return (Map) new TransactionAwareProxyFactory>(new ConcurrentHashMap(map)).createInstance(); } - @SuppressWarnings("unchecked") public static Map createAppendOnlyTransactionalMap() { - return (Map) new TransactionAwareProxyFactory(new ConcurrentHashMap(), true).createInstance(); + return (Map) new TransactionAwareProxyFactory>(new ConcurrentHashMap(), true).createInstance(); } - @SuppressWarnings("unchecked") public static Set createAppendOnlyTransactionalSet() { - return (Set) new TransactionAwareProxyFactory(new CopyOnWriteArraySet(), true).createInstance(); + return (Set) new TransactionAwareProxyFactory>(new CopyOnWriteArraySet(), true).createInstance(); } - @SuppressWarnings("unchecked") public static Set createTransactionalSet() { - return (Set) new TransactionAwareProxyFactory(new CopyOnWriteArraySet()).createInstance(); + return (Set) new TransactionAwareProxyFactory>(new CopyOnWriteArraySet()).createInstance(); } - @SuppressWarnings("unchecked") public static Set createTransactionalSet(Set set) { - return (Set) new TransactionAwareProxyFactory(new CopyOnWriteArraySet(set)).createInstance(); + return (Set) new TransactionAwareProxyFactory>(new CopyOnWriteArraySet(set)).createInstance(); } - @SuppressWarnings("unchecked") public static List createAppendOnlyTransactionalList() { - return (List) new TransactionAwareProxyFactory(new CopyOnWriteArrayList(), true).createInstance(); + return (List) new TransactionAwareProxyFactory>(new CopyOnWriteArrayList(), true).createInstance(); } - @SuppressWarnings("unchecked") public static List createTransactionalList() { - return (List) new TransactionAwareProxyFactory(new CopyOnWriteArrayList()).createInstance(); + return (List) new TransactionAwareProxyFactory>(new CopyOnWriteArrayList()).createInstance(); } - @SuppressWarnings("unchecked") public static List createTransactionalList(List list) { - return (List) new TransactionAwareProxyFactory(new CopyOnWriteArrayList(list)).createInstance(); + return (List) new TransactionAwareProxyFactory>(new CopyOnWriteArrayList(list)).createInstance(); } private class TargetSynchronization extends TransactionSynchronizationAdapter { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderCommonTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderCommonTests.java index 04a06ec3e..41de3f5a9 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderCommonTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderCommonTests.java @@ -10,7 +10,6 @@ import org.springframework.orm.ibatis.SqlMapClientFactoryBean; import com.ibatis.sqlmap.client.SqlMapClient; -@SuppressWarnings("unchecked") @RunWith(JUnit4ClassRunner.class) public class IbatisPagingItemReaderCommonTests extends AbstractDatabaseItemStreamItemReaderTests { @@ -21,7 +20,7 @@ public class IbatisPagingItemReaderCommonTests extends AbstractDatabaseItemStrea factory.afterPropertiesSet(); SqlMapClient sqlMapClient = createSqlMapClient(); - IbatisPagingItemReader reader = new IbatisPagingItemReader(); + IbatisPagingItemReader reader = new IbatisPagingItemReader(); reader.setQueryId("getPagedFoos"); reader.setPageSize(2); reader.setSqlMapClient(sqlMapClient); @@ -41,7 +40,7 @@ public class IbatisPagingItemReaderCommonTests extends AbstractDatabaseItemStrea } protected void pointToEmptyInput(ItemReader tested) throws Exception { - IbatisPagingItemReader reader = (IbatisPagingItemReader) tested; + IbatisPagingItemReader reader = (IbatisPagingItemReader) tested; reader.close(); reader.setQueryId("getNoFoos"); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderParameterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderParameterTests.java index c7fdf3c79..0cd545446 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderParameterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/IbatisPagingItemReaderParameterTests.java @@ -11,7 +11,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.ibatis.sqlmap.client.SqlMapClient; -@SuppressWarnings("unchecked") @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "/org/springframework/batch/item/database/data-source-context.xml") public class IbatisPagingItemReaderParameterTests extends AbstractPagingItemReaderParameterTests { @@ -23,7 +22,7 @@ public class IbatisPagingItemReaderParameterTests extends AbstractPagingItemRead factory.afterPropertiesSet(); SqlMapClient sqlMapClient = createSqlMapClient(); - IbatisPagingItemReader reader = new IbatisPagingItemReader(); + IbatisPagingItemReader reader = new IbatisPagingItemReader(); reader.setQueryId("getPagedFoos3AndUp"); reader.setParameterValues(Collections.singletonMap("limit", 3)); reader.setSqlMapClient(sqlMapClient); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderXmlTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderXmlTests.java index c465aee36..ba0b2f41b 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderXmlTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemReaderXmlTests.java @@ -51,7 +51,7 @@ public class MultiResourceItemReaderXmlTests extends AbstractItemStreamItemReade return foo; } - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public boolean supports(Class clazz) { return true; } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemWriterXmlTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemWriterXmlTests.java index 76994f0b1..5c2b2f760 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemWriterXmlTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemWriterXmlTests.java @@ -59,7 +59,7 @@ public class MultiResourceItemWriterXmlTests extends AbstractMultiResourceItemWr } } - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public boolean supports(Class clazz) { return true; } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/validator/SpringValidatorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/validator/SpringValidatorTests.java index 249c08c45..d8b56bcd8 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/validator/SpringValidatorTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/validator/SpringValidatorTests.java @@ -111,7 +111,7 @@ public class SpringValidatorTests { public static final TestBean REJECT_MULTI_VALUE = new TestBean("foo", "bar"); - @SuppressWarnings("unchecked") + @SuppressWarnings({ "rawtypes", "unchecked" }) public boolean supports(Class clazz) { return clazz.isAssignableFrom(TestBean.class); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemReaderCommonTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemReaderCommonTests.java index 5e04579a4..82f7ffe76 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemReaderCommonTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemReaderCommonTests.java @@ -49,7 +49,7 @@ public class StaxEventItemReaderCommonTests extends AbstractItemStreamItemReader return foo; } - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public boolean supports(Class clazz) { return true; } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemReaderTests.java index 02e0b3682..07da58b95 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemReaderTests.java @@ -374,7 +374,7 @@ public class StaxEventItemReaderTests { return events; } - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public boolean supports(Class clazz) { return true; } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemWriterTests.java index 4d4fcd69f..4db326204 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/StaxEventItemWriterTests.java @@ -418,7 +418,7 @@ public class StaxEventItemWriterTests { } } - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public boolean supports(Class clazz) { return true; } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/TransactionalStaxEventItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/TransactionalStaxEventItemWriterTests.java index 2411c365e..5e2ac697e 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/TransactionalStaxEventItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/TransactionalStaxEventItemWriterTests.java @@ -226,7 +226,7 @@ public class TransactionalStaxEventItemWriterTests { } } - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public boolean supports(Class clazz) { return true; } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItem.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItem.java index 7c7726870..708de125b 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItem.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItem.java @@ -28,7 +28,7 @@ import org.springframework.batch.item.ItemReaderException; */ public class AggregateItem { - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") private static final AggregateItem FOOTER = new AggregateItem(false, true) { @Override public Object getItem() throws ItemReaderException { @@ -45,7 +45,7 @@ public class AggregateItem { return FOOTER; } - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") private static final AggregateItem HEADER = new AggregateItem(true, false) { @Override public Object getItem() throws ItemReaderException { diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/OrderItemReaderTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/OrderItemReaderTests.java index 5aff79258..de0c64829 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/OrderItemReaderTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/order/OrderItemReaderTests.java @@ -78,6 +78,7 @@ public class OrderItemReaderTests { LineItem item = new LineItem(); // create mock mapper + @SuppressWarnings("rawtypes") FieldSetMapper mapper = createMock(FieldSetMapper.class); // set how mapper should respond - set return values for mapper expect(mapper.mapFieldSet(headerFS)).andReturn(order);