diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobParameter.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobParameter.java index fde86b820..cd9853a5a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobParameter.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobParameter.java @@ -36,11 +36,11 @@ import org.springframework.util.Assert; */ public class JobParameter implements Serializable { - private T value; + private final T value; - private Class type; + private final Class type; - private boolean identifying; + private final boolean identifying; /** * Create a new {@link JobParameter}. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/StepContribution.java b/spring-batch-core/src/main/java/org/springframework/batch/core/StepContribution.java index 7aecf8314..d37c38d1d 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/StepContribution.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/StepContribution.java @@ -44,7 +44,7 @@ public class StepContribution implements Serializable { private ExitStatus exitStatus = ExitStatus.EXECUTING; - private volatile StepExecution stepExecution; + private final StepExecution stepExecution; /** * @param execution {@link StepExecution} the stepExecution used to initialize diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/AbstractApplicationContextFactory.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/AbstractApplicationContextFactory.java index 1c41f0c38..535886f96 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/AbstractApplicationContextFactory.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/AbstractApplicationContextFactory.java @@ -52,7 +52,7 @@ public abstract class AbstractApplicationContextFactory implements ApplicationCo private static final Log logger = LogFactory.getLog(AbstractApplicationContextFactory.class); - private Object[] resources; + private final Object[] resources; private ConfigurableApplicationContext parent; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrar.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrar.java index c2ed314e1..e8496b83d 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrar.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrar.java @@ -45,7 +45,7 @@ import org.springframework.util.Assert; */ public class AutomaticJobRegistrar implements Ordered, SmartLifecycle, ApplicationContextAware, InitializingBean { - private Collection applicationContextFactories = new ArrayList<>(); + private final Collection applicationContextFactories = new ArrayList<>(); private JobLoader jobLoader; @@ -57,7 +57,7 @@ public class AutomaticJobRegistrar implements Ordered, SmartLifecycle, Applicati private boolean autoStartup = true; - private Object lifecycleMonitor = new Object(); + private final Object lifecycleMonitor = new Object(); private int order = Ordered.LOWEST_PRECEDENCE; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.java index 652bafc2d..7350670d9 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -50,15 +50,15 @@ import org.springframework.util.Assert; */ public class DefaultJobLoader implements JobLoader, InitializingBean { - private static Log logger = LogFactory.getLog(DefaultJobLoader.class); + private static final Log logger = LogFactory.getLog(DefaultJobLoader.class); private JobRegistry jobRegistry; private StepRegistry stepRegistry; - private Map contexts = new ConcurrentHashMap<>(); + private final Map contexts = new ConcurrentHashMap<>(); - private Map> contextToJobNames = new ConcurrentHashMap<>(); + private final Map> contextToJobNames = new ConcurrentHashMap<>(); /** * Default constructor. Useful for declarative configuration. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobFactoryRegistrationListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobFactoryRegistrationListener.java index 2b17f4b8f..3ed14c297 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobFactoryRegistrationListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobFactoryRegistrationListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -31,7 +31,7 @@ import org.springframework.batch.core.configuration.JobRegistry; */ public class JobFactoryRegistrationListener { - private Log logger = LogFactory.getLog(getClass()); + private final Log logger = LogFactory.getLog(getClass()); private JobRegistry jobRegistry; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessor.java index 55a87483b..0670560c9 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessor.java @@ -48,12 +48,12 @@ import org.springframework.util.Assert; public class JobRegistryBeanPostProcessor implements BeanPostProcessor, BeanFactoryAware, InitializingBean, DisposableBean { - private static Log logger = LogFactory.getLog(JobRegistryBeanPostProcessor.class); + private static final Log logger = LogFactory.getLog(JobRegistryBeanPostProcessor.class); // It doesn't make sense for this to have a default value... private JobRegistry jobRegistry = null; - private Collection jobNames = new HashSet<>(); + private final Collection jobNames = new HashSet<>(); private String groupName = null; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ReferenceJobFactory.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ReferenceJobFactory.java index f30ef213e..4664448c0 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ReferenceJobFactory.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ReferenceJobFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -27,7 +27,7 @@ import org.springframework.batch.core.configuration.JobFactory; */ public class ReferenceJobFactory implements JobFactory { - private Job job; + private final Job job; /** * @param job the {@link Job} to return from {@link #createJob()}. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ScopeConfiguration.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ScopeConfiguration.java index dce3368a8..79a46bf0d 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ScopeConfiguration.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ScopeConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2022 the original author or authors. + * Copyright 2021-2023 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. @@ -29,9 +29,9 @@ import org.springframework.context.annotation.Configuration; @Configuration(proxyBeanMethods = false) public class ScopeConfiguration { - private static StepScope stepScope; + private static final StepScope stepScope; - private static JobScope jobScope; + private static final JobScope jobScope; static { jobScope = new JobScope(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParserJobFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParserJobFactoryBean.java index 547aeb25c..b46ff3987 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParserJobFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParserJobFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -37,7 +37,7 @@ import org.springframework.util.StringUtils; */ public class JobParserJobFactoryBean implements SmartFactoryBean { - private String name; + private final String name; private Boolean restartable; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBean.java index 54ba58426..a63b4fb0f 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBean.java @@ -114,7 +114,7 @@ public class StepParserStepFactoryBean implements FactoryBean, BeanN private PlatformTransactionManager transactionManager; - private Set stepExecutionListeners = new LinkedHashSet<>(); + private final Set stepExecutionListeners = new LinkedHashSet<>(); // // Flow Elements @@ -154,7 +154,7 @@ public class StepParserStepFactoryBean implements FactoryBean, BeanN private Isolation isolation; - private Set chunkListeners = new LinkedHashSet<>(); + private final Set chunkListeners = new LinkedHashSet<>(); // // Chunk Attributes @@ -204,13 +204,13 @@ public class StepParserStepFactoryBean implements FactoryBean, BeanN private ItemStream[] streams; - private Set> readListeners = new LinkedHashSet<>(); + private final Set> readListeners = new LinkedHashSet<>(); - private Set> writeListeners = new LinkedHashSet<>(); + private final Set> writeListeners = new LinkedHashSet<>(); - private Set> processListeners = new LinkedHashSet<>(); + private final Set> processListeners = new LinkedHashSet<>(); - private Set> skipListeners = new LinkedHashSet<>(); + private final Set> skipListeners = new LinkedHashSet<>(); // // Additional diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/AbstractJobExplorerFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/AbstractJobExplorerFactoryBean.java index 1c0e0492b..8f6ae2052 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/AbstractJobExplorerFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/AbstractJobExplorerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -54,7 +54,7 @@ public abstract class AbstractJobExplorerFactoryBean implements FactoryBean steps = new ArrayList<>(); + private final List steps = new ArrayList<>(); /** * Default constructor for job with null name diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowBuilder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowBuilder.java index 6116e0df3..c105a795c 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowBuilder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2023 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. @@ -47,27 +47,28 @@ import org.springframework.core.task.TaskExecutor; * * @author Dave Syer * @author Michael Minella + * @author Mahmoud Ben Hassine * @since 2.2 * @param the type of object returned by the builder (by default a Flow) * */ public class FlowBuilder { - private String name; + private final String name; - private String prefix; + private final String prefix; - private List transitions = new ArrayList<>(); + private final List transitions = new ArrayList<>(); - private Map tos = new HashMap<>(); + private final Map tos = new HashMap<>(); private State currentState; - private EndState failedState; + private final EndState failedState; - private EndState completedState; + private final EndState completedState; - private EndState stoppedState; + private final EndState stoppedState; private int stepCounter = 0; @@ -79,7 +80,7 @@ public class FlowBuilder { private int endCounter = 0; - private Map states = new HashMap<>(); + private final Map states = new HashMap<>(); private SimpleFlow flow; @@ -606,7 +607,7 @@ public class FlowBuilder { private final FlowBuilder parent; - private TaskExecutor executor; + private final TaskExecutor executor; /** * @param parent the parent builder diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/JobFlowBuilder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/JobFlowBuilder.java index 57b4337ae..db456d486 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/JobFlowBuilder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/JobFlowBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2023 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. @@ -22,11 +22,12 @@ import org.springframework.beans.factory.InitializingBean; /** * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class JobFlowBuilder extends FlowBuilder { - private FlowJobBuilder parent; + private final FlowJobBuilder parent; public JobFlowBuilder(FlowJobBuilder parent) { super(parent.getName()); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/SimpleJobBuilder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/SimpleJobBuilder.java index f881e66cf..a8be4c6b3 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/SimpleJobBuilder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/SimpleJobBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2023 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. @@ -27,12 +27,13 @@ import org.springframework.util.Assert; /** * @author Dave Syer + * @author Mahmoud Ben Hassine * @since 2.2 * */ public class SimpleJobBuilder extends JobBuilderHelper { - private List steps = new ArrayList<>(); + private final List steps = new ArrayList<>(); private JobFlowBuilder builder; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowJob.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowJob.java index eb565f25a..114d0af8d 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowJob.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowJob.java @@ -42,7 +42,7 @@ public class FlowJob extends AbstractJob { protected Flow flow; - private Map stepMap = new ConcurrentHashMap<>(); + private final Map stepMap = new ConcurrentHashMap<>(); private volatile boolean initialized = false; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/SimpleFlow.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/SimpleFlow.java index d3a62efaa..2101c171d 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/SimpleFlow.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/SimpleFlow.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 the original author or authors. + * Copyright 2006-2023 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. @@ -56,9 +56,9 @@ public class SimpleFlow implements Flow, InitializingBean { private State startState; - private Map> transitionMap = new HashMap<>(); + private final Map> transitionMap = new HashMap<>(); - private Map stateMap = new HashMap<>(); + private final Map stateMap = new HashMap<>(); private List stateTransitions = new ArrayList<>(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/SplitState.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/SplitState.java index 402b0b920..52de636ee 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/SplitState.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/SplitState.java @@ -46,7 +46,7 @@ public class SplitState extends AbstractState implements FlowHolder { private TaskExecutor taskExecutor = new SyncTaskExecutor(); - private FlowExecutionAggregator aggregator = new MaxValueFlowExecutionAggregator(); + private final FlowExecutionAggregator aggregator = new MaxValueFlowExecutionAggregator(); /** * @param flows collection of {@link Flow} instances. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobOperatorFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobOperatorFactoryBean.java index d11d08972..ce2ef8e4f 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobOperatorFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobOperatorFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2023 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. @@ -65,7 +65,7 @@ public class JobOperatorFactoryBean implements FactoryBean, Initial private JobParametersConverter jobParametersConverter = new DefaultJobParametersConverter(); - private ProxyFactory proxyFactory = new ProxyFactory(); + private final ProxyFactory proxyFactory = new ProxyFactory(); @Override public void afterPropertiesSet() throws Exception { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunner.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunner.java index 08e452f37..9a47c6085 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunner.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunner.java @@ -69,7 +69,7 @@ public class JobRegistryBackgroundJobRunner { */ public static final String EMBEDDED = JobRegistryBackgroundJobRunner.class.getSimpleName() + ".EMBEDDED"; - private static Log logger = LogFactory.getLog(JobRegistryBackgroundJobRunner.class); + private static final Log logger = LogFactory.getLog(JobRegistryBackgroundJobRunner.class); private JobLoader jobLoader; @@ -81,7 +81,7 @@ public class JobRegistryBackgroundJobRunner { private JobRegistry jobRegistry; - private static List errors = Collections.synchronizedList(new ArrayList<>()); + private static final List errors = Collections.synchronizedList(new ArrayList<>()); /** * @param parentContextPath the parentContextPath to be used by the diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapper.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapper.java index ea560cfc3..8f6d37c9f 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapper.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapper.java @@ -38,7 +38,7 @@ public class SimpleJvmExitCodeMapper implements ExitCodeMapper { protected Log logger = LogFactory.getLog(getClass()); - private Map mapping; + private final Map mapping; public SimpleJvmExitCodeMapper() { mapping = new HashMap<>(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeChunkListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeChunkListener.java index 7818ea313..1d7b74701 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeChunkListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeChunkListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -25,11 +25,12 @@ import org.springframework.core.Ordered; /** * @author Lucas Ward + * @author Mahmoud Ben Hassine * */ public class CompositeChunkListener implements ChunkListener { - private OrderedComposite listeners = new OrderedComposite<>(); + private final OrderedComposite listeners = new OrderedComposite<>(); /** * Default constructor diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemProcessListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemProcessListener.java index 86ff47092..882770dbd 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemProcessListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemProcessListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2018 the original author or authors. + * Copyright 2006-2023 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. @@ -29,7 +29,7 @@ import org.springframework.lang.Nullable; */ public class CompositeItemProcessListener implements ItemProcessListener { - private OrderedComposite> listeners = new OrderedComposite<>(); + private final OrderedComposite> listeners = new OrderedComposite<>(); /** * Public setter for the listeners. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemReadListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemReadListener.java index 05edf2b93..18fa7599a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemReadListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemReadListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2013 the original author or authors. + * Copyright 2006-2023 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. @@ -24,11 +24,12 @@ import org.springframework.core.Ordered; /** * @author Lucas Ward * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class CompositeItemReadListener implements ItemReadListener { - private OrderedComposite> listeners = new OrderedComposite<>(); + private final OrderedComposite> listeners = new OrderedComposite<>(); /** * Public setter for the listeners. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemWriteListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemWriteListener.java index 9c00e4ae5..300bc30a9 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemWriteListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemWriteListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -30,7 +30,7 @@ import org.springframework.core.Ordered; */ public class CompositeItemWriteListener implements ItemWriteListener { - private OrderedComposite> listeners = new OrderedComposite<>(); + private final OrderedComposite> listeners = new OrderedComposite<>(); /** * Public setter for the listeners. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeJobExecutionListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeJobExecutionListener.java index b65c3c290..304b1b2a9 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeJobExecutionListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeJobExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2013 the original author or authors. + * Copyright 2006-2023 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. @@ -24,11 +24,12 @@ import org.springframework.core.Ordered; /** * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class CompositeJobExecutionListener implements JobExecutionListener { - private OrderedComposite listeners = new OrderedComposite<>(); + private final OrderedComposite listeners = new OrderedComposite<>(); /** * Public setter for the listeners. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeSkipListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeSkipListener.java index 7edc8c032..13a355b8c 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeSkipListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeSkipListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2013 the original author or authors. + * Copyright 2006-2023 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. @@ -23,11 +23,12 @@ import org.springframework.core.Ordered; /** * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class CompositeSkipListener implements SkipListener { - private OrderedComposite> listeners = new OrderedComposite<>(); + private final OrderedComposite> listeners = new OrderedComposite<>(); /** * Public setter for the listeners. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeStepExecutionListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeStepExecutionListener.java index e0d8c40f6..bfaa77092 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeStepExecutionListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeStepExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2019 the original author or authors. + * Copyright 2006-2023 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. @@ -27,11 +27,12 @@ import org.springframework.lang.Nullable; /** * @author Lucas Ward * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class CompositeStepExecutionListener implements StepExecutionListener { - private OrderedComposite list = new OrderedComposite<>(); + private final OrderedComposite list = new OrderedComposite<>(); /** * Public setter for the listeners. 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 fe517bebe..81db37094 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 @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -41,17 +41,17 @@ import org.springframework.lang.Nullable; public class MulticasterBatchListener implements StepExecutionListener, ChunkListener, ItemReadListener, ItemProcessListener, ItemWriteListener, SkipListener { - private CompositeStepExecutionListener stepListener = new CompositeStepExecutionListener(); + private final CompositeStepExecutionListener stepListener = new CompositeStepExecutionListener(); - private CompositeChunkListener chunkListener = new CompositeChunkListener(); + private final CompositeChunkListener chunkListener = new CompositeChunkListener(); - private CompositeItemReadListener itemReadListener = new CompositeItemReadListener<>(); + private final CompositeItemReadListener itemReadListener = new CompositeItemReadListener<>(); - private CompositeItemProcessListener itemProcessListener = new CompositeItemProcessListener<>(); + private final CompositeItemProcessListener itemProcessListener = new CompositeItemProcessListener<>(); - private CompositeItemWriteListener itemWriteListener = new CompositeItemWriteListener<>(); + private final CompositeItemWriteListener itemWriteListener = new CompositeItemWriteListener<>(); - private CompositeSkipListener skipListener = new CompositeSkipListener<>(); + private final CompositeSkipListener skipListener = new CompositeSkipListener<>(); /** * Initialize the listener instance. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/OrderedComposite.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/OrderedComposite.java index 84a679313..9bb9a5b0a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/OrderedComposite.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/OrderedComposite.java @@ -33,13 +33,13 @@ import org.springframework.core.annotation.Order; */ class OrderedComposite { - private List unordered = new ArrayList<>(); + private final List unordered = new ArrayList<>(); - private List ordered = new ArrayList<>(); + private final List ordered = new ArrayList<>(); - private Comparator comparator = new AnnotationAwareOrderComparator(); + private final Comparator comparator = new AnnotationAwareOrderComparator(); - private List list = new ArrayList<>(); + private final List list = new ArrayList<>(); /** * Public setter for the listeners. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java index 61d7d0d32..f4c28cb7a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java @@ -129,7 +129,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements private DataFieldMaxValueIncrementer jobInstanceIncrementer; - private JobKeyGenerator jobKeyGenerator = new DefaultJobKeyGenerator(); + private final JobKeyGenerator jobKeyGenerator = new DefaultJobKeyGenerator(); /** * In this JDBC implementation a job instance id is obtained by asking the @@ -235,7 +235,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements ResultSetExtractor> extractor = new ResultSetExtractor<>() { - private List list = new ArrayList<>(); + private final List list = new ArrayList<>(); @Override public List extractData(ResultSet rs) throws SQLException, DataAccessException { @@ -372,7 +372,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements public List findJobInstancesByName(String jobName, final int start, final int count) { @SuppressWarnings("rawtypes") ResultSetExtractor extractor = new ResultSetExtractor() { - private List list = new ArrayList<>(); + private final List list = new ArrayList<>(); @Override public Object extractData(ResultSet rs) throws SQLException, DataAccessException { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/AbstractJobRepositoryFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/AbstractJobRepositoryFactoryBean.java index 80415834a..639a034eb 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/AbstractJobRepositoryFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/AbstractJobRepositoryFactoryBean.java @@ -55,7 +55,7 @@ public abstract class AbstractJobRepositoryFactoryBean implements FactoryBean> callbacks = new HashMap<>(); + private final Map> callbacks = new HashMap<>(); public JobContext(JobExecution jobExecution) { super(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContext.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContext.java index 7253362c1..63d7a3906 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContext.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContext.java @@ -51,9 +51,9 @@ import org.springframework.util.Assert; */ public class StepContext extends SynchronizedAttributeAccessor { - private StepExecution stepExecution; + private final StepExecution stepExecution; - private Map> callbacks = new HashMap<>(); + private final Map> callbacks = new HashMap<>(); /** * Create a new instance of {@link StepContext} for this {@link StepExecution}. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStep.java index f116e2d56..9ac094dc4 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStep.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStep.java @@ -74,7 +74,7 @@ public abstract class AbstractStep implements Step, InitializingBean, BeanNameAw private boolean allowStartIfComplete = false; - private CompositeStepExecutionListener stepExecutionListener = new CompositeStepExecutionListener(); + private final CompositeStepExecutionListener stepExecutionListener = new CompositeStepExecutionListener(); private JobRepository jobRepository; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/AbstractTaskletStepBuilder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/AbstractTaskletStepBuilder.java index 11944a20f..8ab4fb2a1 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/AbstractTaskletStepBuilder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/AbstractTaskletStepBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2023 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. @@ -62,7 +62,7 @@ public abstract class AbstractTaskletStepBuilder streams = new LinkedHashSet<>(); + private final Set streams = new LinkedHashSet<>(); private ExceptionHandler exceptionHandler = new DefaultExceptionHandler(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/FaultTolerantStepBuilder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/FaultTolerantStepBuilder.java index 1efb06b8b..7dca854e6 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/FaultTolerantStepBuilder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/FaultTolerantStepBuilder.java @@ -94,7 +94,7 @@ import org.springframework.util.Assert; */ public class FaultTolerantStepBuilder extends SimpleStepBuilder { - private ChunkMonitor chunkMonitor = new ChunkMonitor(); + private final ChunkMonitor chunkMonitor = new ChunkMonitor(); private boolean streamIsReader; @@ -102,7 +102,7 @@ public class FaultTolerantStepBuilder extends SimpleStepBuilder { private BackOffPolicy backOffPolicy; - private Set retryListeners = new LinkedHashSet<>(); + private final Set retryListeners = new LinkedHashSet<>(); private RetryPolicy retryPolicy; @@ -110,17 +110,17 @@ public class FaultTolerantStepBuilder extends SimpleStepBuilder { private KeyGenerator keyGenerator; - private Collection> noRollbackExceptionClasses = new LinkedHashSet<>(); + private final Collection> noRollbackExceptionClasses = new LinkedHashSet<>(); - private Map, Boolean> skippableExceptionClasses = new HashMap<>(); + private final Map, Boolean> skippableExceptionClasses = new HashMap<>(); private Collection> nonSkippableExceptionClasses = new HashSet<>(); - private Map, Boolean> retryableExceptionClasses = new HashMap<>(); + private final Map, Boolean> retryableExceptionClasses = new HashMap<>(); private Collection> nonRetryableExceptionClasses = new HashSet<>(); - private Set> skipListeners = new LinkedHashSet<>(); + private final Set> skipListeners = new LinkedHashSet<>(); private int skipLimit = 0; @@ -696,7 +696,7 @@ public class FaultTolerantStepBuilder extends SimpleStepBuilder { */ private static class TerminateOnExceptionChunkListenerDelegate implements ChunkListener { - private ChunkListener chunkListener; + private final ChunkListener chunkListener; TerminateOnExceptionChunkListenerDelegate(ChunkListener chunkListener) { this.chunkListener = chunkListener; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkMonitor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkMonitor.java index 1f4a74e81..ae83b261c 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkMonitor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2013 the original author or authors. + * Copyright 2006-2023 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. @@ -31,11 +31,12 @@ import org.springframework.batch.item.support.CompositeItemStream; * wrapped {@link ItemStream}. * * @author Dave Syer + * @author Mahmoud Ben Hassine * @since 2.0 */ public class ChunkMonitor extends ItemStreamSupport { - private Log logger = LogFactory.getLog(getClass()); + private final Log logger = LogFactory.getLog(getClass()); private boolean streamsRegistered = false; @@ -54,9 +55,9 @@ public class ChunkMonitor extends ItemStreamSupport { private static final String OFFSET = "OFFSET"; - private CompositeItemStream stream = new CompositeItemStream(); + private final CompositeItemStream stream = new CompositeItemStream(); - private ThreadLocal holder = new ThreadLocal<>(); + private final ThreadLocal holder = new ThreadLocal<>(); private ItemReader reader; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkOrientedTasklet.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkOrientedTasklet.java index fbeb0425b..ef29d45e2 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkOrientedTasklet.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkOrientedTasklet.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -42,7 +42,7 @@ public class ChunkOrientedTasklet implements Tasklet { private boolean buffering = true; - private static Log logger = LogFactory.getLog(ChunkOrientedTasklet.class); + private static final Log logger = LogFactory.getLog(ChunkOrientedTasklet.class); public ChunkOrientedTasklet(ChunkProvider chunkProvider, ChunkProcessor chunkProcessor) { this.chunkProvider = chunkProvider; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantChunkProcessor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantChunkProcessor.java index b051a4288..f1eb7321f 100755 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantChunkProcessor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantChunkProcessor.java @@ -61,7 +61,7 @@ public class FaultTolerantChunkProcessor extends SimpleChunkProcessor rollbackClassifier = new BinaryExceptionClassifier(true); - private Log logger = LogFactory.getLog(getClass()); + private final Log logger = LogFactory.getLog(getClass()); private boolean buffering = true; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java index cbc541ea6..b5941c1ec 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java @@ -79,12 +79,12 @@ public class TaskletStep extends AbstractStep { private RepeatOperations stepOperations = new RepeatTemplate(); - private CompositeChunkListener chunkListener = new CompositeChunkListener(); + private final CompositeChunkListener chunkListener = new CompositeChunkListener(); // default to checking current thread for interruption. private StepInterruptionPolicy interruptionPolicy = new ThreadStepInterruptionPolicy(); - private CompositeItemStream stream = new CompositeItemStream(); + private final CompositeItemStream stream = new CompositeItemStream(); private PlatformTransactionManager transactionManager; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/JobScopeConfigurationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/JobScopeConfigurationTests.java index a584d1085..af0b5fc1a 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/JobScopeConfigurationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/JobScopeConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -218,7 +218,7 @@ public class JobScopeConfigurationTests { public static class Wrapper { - private SimpleHolder value; + private final SimpleHolder value; public Wrapper(SimpleHolder value) { this.value = value; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/StepScopeConfigurationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/StepScopeConfigurationTests.java index 7cfb83036..0e24d07b8 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/StepScopeConfigurationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/StepScopeConfigurationTests.java @@ -238,7 +238,7 @@ public class StepScopeConfigurationTests { public static class Wrapper { - private SimpleHolder value; + private final SimpleHolder value; public Wrapper(SimpleHolder value) { this.value = value; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/PartitionStepParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/PartitionStepParserTests.java index 254d7ad92..263a59b70 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/PartitionStepParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/PartitionStepParserTests.java @@ -83,7 +83,7 @@ public class PartitionStepParserTests implements ApplicationContextAware { private ApplicationContext applicationContext; - private List savedStepNames = new ArrayList<>(); + private final List savedStepNames = new ArrayList<>(); @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/JobSupport.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/JobSupport.java index c369285cc..53d25ef99 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/JobSupport.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/JobSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2019 the original author or authors. + * Copyright 2006-2023 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. @@ -44,7 +44,7 @@ import org.springframework.util.ClassUtils; */ public class JobSupport implements BeanNameAware, Job, StepLocator { - private Map steps = new HashMap<>(); + private final Map steps = new HashMap<>(); private String name; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java index e08bbacfe..9f99e445b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java @@ -537,7 +537,7 @@ class SimpleJobTests { private Throwable exception; - private JobRepository jobRepository; + private final JobRepository jobRepository; private ExecutionContext passedInStepContext; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/FlowJobFailureTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/FlowJobFailureTests.java index 41fc07741..4d4b00fbd 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/FlowJobFailureTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/FlowJobFailureTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 the original author or authors. + * Copyright 2010-2023 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. @@ -50,7 +50,7 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; */ class FlowJobFailureTests { - private FlowJob job = new FlowJob(); + private final FlowJob job = new FlowJob(); private JobExecution execution; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/CommandLineJobRunnerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/CommandLineJobRunnerTests.java index c71471841..625145f0e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/CommandLineJobRunnerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/CommandLineJobRunnerTests.java @@ -170,7 +170,7 @@ class CommandLineJobRunnerTests { @Test void testWithStdinCommandLine() throws Throwable { System.setIn(new InputStream() { - char[] input = (jobPath + "\n" + jobName + "\nfoo=bar\nspam=bucket").toCharArray(); + final char[] input = (jobPath + "\n" + jobName + "\nfoo=bar\nspam=bucket").toCharArray(); int index = 0; @@ -192,7 +192,7 @@ class CommandLineJobRunnerTests { @Test void testWithStdinCommandLineWithEmptyLines() throws Throwable { System.setIn(new InputStream() { - char[] input = (jobPath + "\n" + jobName + "\nfoo=bar\n\nspam=bucket\n\n").toCharArray(); + final char[] input = (jobPath + "\n" + jobName + "\nfoo=bar\n\nspam=bucket\n\n").toCharArray(); int index = 0; @@ -215,7 +215,7 @@ class CommandLineJobRunnerTests { void testWithStdinParameters() throws Throwable { String[] args = new String[] { jobPath, jobName }; System.setIn(new InputStream() { - char[] input = ("foo=bar\nspam=bucket").toCharArray(); + final char[] input = ("foo=bar\nspam=bucket").toCharArray(); int index = 0; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/JobOperatorFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/JobOperatorFactoryBeanTests.java index 659e90bc3..b984fe438 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/JobOperatorFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/JobOperatorFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2023 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. @@ -39,17 +39,17 @@ import org.springframework.transaction.interceptor.TransactionInterceptor; */ class JobOperatorFactoryBeanTests { - private PlatformTransactionManager transactionManager = Mockito.mock(PlatformTransactionManager.class); + private final PlatformTransactionManager transactionManager = Mockito.mock(PlatformTransactionManager.class); - private JobRepository jobRepository = Mockito.mock(JobRepository.class); + private final JobRepository jobRepository = Mockito.mock(JobRepository.class); - private JobLauncher jobLauncher = Mockito.mock(JobLauncher.class); + private final JobLauncher jobLauncher = Mockito.mock(JobLauncher.class); - private JobRegistry jobRegistry = Mockito.mock(JobRegistry.class); + private final JobRegistry jobRegistry = Mockito.mock(JobRegistry.class); - private JobExplorer jobExplorer = Mockito.mock(JobExplorer.class); + private final JobExplorer jobExplorer = Mockito.mock(JobExplorer.class); - private JobParametersConverter jobParametersConverter = Mockito.mock(JobParametersConverter.class); + private final JobParametersConverter jobParametersConverter = Mockito.mock(JobParametersConverter.class); @Test public void testJobOperatorCreation() throws Exception { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/ItemListenerErrorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/ItemListenerErrorTests.java index 12a95871b..a89485aa1 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/ItemListenerErrorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/ItemListenerErrorTests.java @@ -229,7 +229,7 @@ class ItemListenerErrorTests { private boolean goingToFail = false; - private ItemReader delegate = new ListItemReader<>(Collections.singletonList("1")); + private final ItemReader delegate = new ListItemReader<>(Collections.singletonList("1")); private int count = 0; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java index 8d944be45..68a90fdb4 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java @@ -550,7 +550,7 @@ class MulticasterBatchListenerTests { private static final class AnnotationBasedStepListener { - private IllegalStateException exception = new IllegalStateException("listener error"); + private final IllegalStateException exception = new IllegalStateException("listener error"); @BeforeRead public void beforeRead() { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemReader.java b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemReader.java index fcb020342..348d1e77e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemReader.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2019 the original author or authors. + * Copyright 2008-2023 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. @@ -29,9 +29,9 @@ import org.springframework.util.ClassUtils; */ public class ExampleItemReader extends AbstractItemStreamItemReader { - private Log logger = LogFactory.getLog(getClass()); + private final Log logger = LogFactory.getLog(getClass()); - private String[] input = { "Hello", "world!", "Go", "on", "punk", "make", "my", "day!" }; + private final String[] input = { "Hello", "world!", "Go", "on", "punk", "make", "my", "day!" }; private int index = 0; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemWriter.java b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemWriter.java index 53b8beab7..003843cd0 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemWriter.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/ExampleItemWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 the original author or authors. + * Copyright 2008-2023 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. @@ -31,7 +31,7 @@ public class ExampleItemWriter implements ItemWriter { private static final Log log = LogFactory.getLog(ExampleItemWriter.class); - private static List items = new ArrayList<>(); + private static final List items = new ArrayList<>(); public static void clear() { items.clear(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/PartitionStepTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/PartitionStepTests.java index 224c2d05b..0325f97b1 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/PartitionStepTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/partition/support/PartitionStepTests.java @@ -44,7 +44,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; */ class PartitionStepTests { - private PartitionStep step = new PartitionStep(); + private final PartitionStep step = new PartitionStep(); private JobRepository jobRepository; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/NonAbstractStepTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/NonAbstractStepTests.java index d458544fc..5fa6aa516 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/NonAbstractStepTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/NonAbstractStepTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2022 the original author or authors. + * Copyright 2009-2023 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. @@ -101,7 +101,7 @@ class NonAbstractStepTests { */ private class EventTrackingListener implements StepExecutionListener { - private String name; + private final String name; public EventTrackingListener(String name) { this.name = name; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/RegisterMultiListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/RegisterMultiListenerTests.java index c5a6e297e..85d1bf015 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/RegisterMultiListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/builder/RegisterMultiListenerTests.java @@ -260,7 +260,7 @@ class RegisterMultiListenerTests { private static class MultiListener implements StepExecutionListener, ChunkListener, ItemWriteListener, SkipListener { - private CallChecker callChecker; + private final CallChecker callChecker; private MultiListener(CallChecker callChecker) { super(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ExceptionThrowingTaskletStub.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ExceptionThrowingTaskletStub.java index 40be641d2..ffb7c777d 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ExceptionThrowingTaskletStub.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ExceptionThrowingTaskletStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2019 the original author or authors. + * Copyright 2006-2023 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. @@ -29,15 +29,16 @@ import org.springframework.lang.Nullable; /** * @author Dan Garrette + * @author Mahmoud Ben Hassine * @since 2.0.2 */ public class ExceptionThrowingTaskletStub implements Tasklet { - private int maxTries = 4; + private final int maxTries = 4; protected Log logger = LogFactory.getLog(getClass()); - private List committed = TransactionAwareProxyFactory.createTransactionalList(); + private final List committed = TransactionAwareProxyFactory.createTransactionalList(); private Constructor exception; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanNonBufferingTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanNonBufferingTests.java index f5c2fbe6d..f775d86cf 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanNonBufferingTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanNonBufferingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 the original author or authors. + * Copyright 2008-2023 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. @@ -126,7 +126,7 @@ class FaultTolerantStepFactoryBeanNonBufferingTests { protected final Log logger = LogFactory.getLog(getClass()); // simulate transactional output - private List written = TransactionAwareProxyFactory.createTransactionalList(); + private final List written = TransactionAwareProxyFactory.createTransactionalList(); private final Collection failures; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanRetryTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanRetryTests.java index 9cfce880b..079481841 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanRetryTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBeanRetryTests.java @@ -73,13 +73,13 @@ class FaultTolerantStepFactoryBeanRetryTests { private FaultTolerantStepFactoryBean factory; - private List recovered = new ArrayList<>(); + private final List recovered = new ArrayList<>(); - private List processed = new ArrayList<>(); + private final List processed = new ArrayList<>(); - private List provided = new ArrayList<>(); + private final List provided = new ArrayList<>(); - private List written = TransactionAwareProxyFactory.createTransactionalList(); + private final List written = TransactionAwareProxyFactory.createTransactionalList(); int count = 0; @@ -89,7 +89,7 @@ class FaultTolerantStepFactoryBeanRetryTests { JobExecution jobExecution; - private ItemWriter writer = data -> processed.addAll(data.getItems()); + private final ItemWriter writer = data -> processed.addAll(data.getItems()); @SuppressWarnings("unchecked") @BeforeEach diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleStepFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleStepFactoryBeanTests.java index 6763f2c99..816e35440 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleStepFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleStepFactoryBeanTests.java @@ -278,7 +278,7 @@ class SimpleStepFactoryBeanTests { int failedCount = 0; - private AssertingWriteListener writeListener; + private final AssertingWriteListener writeListener; public CountingChunkListener(AssertingWriteListener writeListener) { super(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipProcessorStub.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipProcessorStub.java index 32dfc944c..d24f806d1 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipProcessorStub.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipProcessorStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2019 the original author or authors. + * Copyright 2006-2023 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. @@ -24,13 +24,14 @@ import org.springframework.lang.Nullable; /** * @author Dan Garrette + * @author Mahmoud Ben Hassine * @since 2.0.1 */ public class SkipProcessorStub extends AbstractExceptionThrowingItemHandlerStub implements ItemProcessor { - private List processed = new ArrayList<>(); + private final List processed = new ArrayList<>(); - private List committed = TransactionAwareProxyFactory.createTransactionalList(); + private final List committed = TransactionAwareProxyFactory.createTransactionalList(); private boolean filter = false; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipReaderStub.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipReaderStub.java index 71dd2b112..cfc00ac7e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipReaderStub.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipReaderStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2019 the original author or authors. + * Copyright 2006-2023 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. @@ -26,13 +26,14 @@ import org.springframework.util.Assert; /** * @author Dan Garrette + * @author Mahmoud Ben Hassine * @since 2.0.1 */ public class SkipReaderStub extends AbstractExceptionThrowingItemHandlerStub implements ItemReader { private T[] items; - private List read = new ArrayList<>(); + private final List read = new ArrayList<>(); private int counter = -1; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipWriterStub.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipWriterStub.java index aafad502c..404f8c599 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipWriterStub.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipWriterStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -29,9 +29,9 @@ import org.springframework.batch.support.transaction.TransactionAwareProxyFactor */ public class SkipWriterStub extends AbstractExceptionThrowingItemHandlerStub implements ItemWriter { - private List written = new ArrayList<>(); + private final List written = new ArrayList<>(); - private List committed = TransactionAwareProxyFactory.createTransactionalList(); + private final List committed = TransactionAwareProxyFactory.createTransactionalList(); public SkipWriterStub() throws Exception { super(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletStepTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletStepTests.java index ec1fcfb04..f10516980 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletStepTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/tasklet/TaskletStepTests.java @@ -934,7 +934,7 @@ class TaskletStepTests { private boolean getExecutionAttributesCalled = false; - private boolean restoreFromCalled = false; + private final boolean restoreFromCalled = false; @Nullable @Override diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/test/repository/JobSupport.java b/spring-batch-core/src/test/java/org/springframework/batch/core/test/repository/JobSupport.java index d09731a3f..0ba57e895 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/test/repository/JobSupport.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/test/repository/JobSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2019 the original author or authors. + * Copyright 2006-2023 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. @@ -40,7 +40,7 @@ import org.springframework.util.ClassUtils; */ public class JobSupport implements BeanNameAware, Job { - private List steps = new ArrayList<>(); + private final List steps = new ArrayList<>(); private String name; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanIntegrationTests.java index 3fb0bee41..e991e537f 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanIntegrationTests.java @@ -199,11 +199,11 @@ class FaultTolerantStepFactoryBeanIntegrationTests { private static class SkipWriterStub implements ItemWriter { - private List written = new ArrayList<>(); + private final List written = new ArrayList<>(); - private Collection failures = Collections.emptySet(); + private final Collection failures = Collections.emptySet(); - private JdbcTemplate jdbcTemplate; + private final JdbcTemplate jdbcTemplate; public SkipWriterStub(DataSource dataSource) { jdbcTemplate = new JdbcTemplate(dataSource); @@ -240,9 +240,9 @@ class FaultTolerantStepFactoryBeanIntegrationTests { private final Log logger = LogFactory.getLog(getClass()); - private List processed = new ArrayList<>(); + private final List processed = new ArrayList<>(); - private JdbcTemplate jdbcTemplate; + private final JdbcTemplate jdbcTemplate; /** * @param dataSource diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanRollbackIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanRollbackIntegrationTests.java index db6e7816e..294799de3 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanRollbackIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanRollbackIntegrationTests.java @@ -221,11 +221,11 @@ class FaultTolerantStepFactoryBeanRollbackIntegrationTests { private static class SkipWriterStub implements ItemWriter { - private List written = new CopyOnWriteArrayList<>(); + private final List written = new CopyOnWriteArrayList<>(); private Collection failures = Collections.emptySet(); - private JdbcTemplate jdbcTemplate; + private final JdbcTemplate jdbcTemplate; public SkipWriterStub(DataSource dataSource) { jdbcTemplate = new JdbcTemplate(dataSource); @@ -266,9 +266,9 @@ class FaultTolerantStepFactoryBeanRollbackIntegrationTests { private final Log logger = LogFactory.getLog(getClass()); - private List processed = new CopyOnWriteArrayList<>(); + private final List processed = new CopyOnWriteArrayList<>(); - private JdbcTemplate jdbcTemplate; + private final JdbcTemplate jdbcTemplate; /** * @param dataSource diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/avro/AvroItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/avro/AvroItemReader.java index 5eb0de3ee..ab39d8157 100755 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/avro/AvroItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/avro/AvroItemReader.java @@ -58,9 +58,9 @@ public class AvroItemReader extends AbstractItemCountingItemStreamItemReader< private DataFileStream dataFileReader; - private InputStream inputStream; + private final InputStream inputStream; - private DatumReader datumReader; + private final DatumReader datumReader; /** * @param resource the {@link Resource} containing objects serialized with Avro. diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/avro/AvroItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/avro/AvroItemWriter.java index 39effa80c..0d300a958 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/avro/AvroItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/avro/AvroItemWriter.java @@ -58,11 +58,11 @@ public class AvroItemWriter extends AbstractItemStreamItemWriter { private OutputStreamWriter outputStreamWriter; - private WritableResource resource; + private final WritableResource resource; - private Resource schemaResource; + private final Resource schemaResource; - private Class clazz; + private final Class clazz; private boolean embedSchema = true; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/AbstractPaginatedDataItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/AbstractPaginatedDataItemReader.java index a5bbe826d..466d01391 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/AbstractPaginatedDataItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/AbstractPaginatedDataItemReader.java @@ -44,7 +44,7 @@ public abstract class AbstractPaginatedDataItemReader extends AbstractItemCou protected Iterator results; - private Object lock = new Object(); + private final Object lock = new Object(); /** * The number of items to be read with each page. diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/RepositoryItemWriterBuilder.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/RepositoryItemWriterBuilder.java index 95fb6add2..1ef96ca06 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/RepositoryItemWriterBuilder.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/RepositoryItemWriterBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 the original author or authors. + * Copyright 2017-2023 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. @@ -128,9 +128,9 @@ public class RepositoryItemWriterBuilder { */ public static class RepositoryMethodReference { - private RepositoryMethodInterceptor repositoryInvocationHandler; + private final RepositoryMethodInterceptor repositoryInvocationHandler; - private CrudRepository repository; + private final CrudRepository repository; public RepositoryMethodReference(CrudRepository repository) { this.repository = repository; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/AbstractPagingItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/AbstractPagingItemReader.java index 92a23f125..45504e7af 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/AbstractPagingItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/AbstractPagingItemReader.java @@ -58,7 +58,7 @@ public abstract class AbstractPagingItemReader extends AbstractItemCountingIt protected volatile List results; - private Object lock = new Object(); + private final Object lock = new Object(); public AbstractPagingItemReader() { setName(ClassUtils.getShortName(AbstractPagingItemReader.class)); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateCursorItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateCursorItemReader.java index f6367c23f..4fdcde65d 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateCursorItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateCursorItemReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -59,7 +59,7 @@ import org.springframework.util.ClassUtils; public class HibernateCursorItemReader extends AbstractItemCountingItemStreamItemReader implements InitializingBean { - private HibernateItemReaderHelper helper = new HibernateItemReaderHelper<>(); + private final HibernateItemReaderHelper helper = new HibernateItemReaderHelper<>(); public HibernateCursorItemReader() { setName(ClassUtils.getShortName(HibernateCursorItemReader.class)); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernatePagingItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernatePagingItemReader.java index 53d993d76..41c50e267 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernatePagingItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernatePagingItemReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -58,7 +58,7 @@ import org.springframework.util.ClassUtils; @Deprecated(since = "5.0", forRemoval = true) public class HibernatePagingItemReader extends AbstractPagingItemReader implements InitializingBean { - private HibernateItemReaderHelper helper = new HibernateItemReaderHelper<>(); + private final HibernateItemReaderHelper helper = new HibernateItemReaderHelper<>(); private Map parameterValues; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/DefaultDataFieldMaxValueIncrementerFactory.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/DefaultDataFieldMaxValueIncrementerFactory.java index d41372d33..ba0c28edd 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/DefaultDataFieldMaxValueIncrementerFactory.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/DefaultDataFieldMaxValueIncrementerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -64,7 +64,7 @@ import static org.springframework.batch.support.DatabaseType.SYBASE; */ public class DefaultDataFieldMaxValueIncrementerFactory implements DataFieldMaxValueIncrementerFactory { - private DataSource dataSource; + private final DataSource dataSource; private String incrementerColumnName = "ID"; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/SqlPagingQueryProviderFactoryBean.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/SqlPagingQueryProviderFactoryBean.java index c31b57905..608e0f2e5 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/SqlPagingQueryProviderFactoryBean.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/SqlPagingQueryProviderFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -70,7 +70,7 @@ public class SqlPagingQueryProviderFactoryBean implements FactoryBean sortKeys; - private Map providers = new HashMap<>(); + private final Map providers = new HashMap<>(); { providers.put(DB2, new Db2PagingQueryProvider()); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileParseException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileParseException.java index 7e7eb720d..3aeedc50f 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileParseException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileParseException.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2023 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. @@ -24,11 +24,12 @@ import org.springframework.batch.item.ParseException; * * @author Lucas Ward * @author Ben Hale + * @author Mahmoud Ben Hassine */ @SuppressWarnings("serial") public class FlatFileParseException extends ParseException { - private String input; + private final String input; private int lineNumber; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/NonTransientFlatFileException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/NonTransientFlatFileException.java index 8a98ab53d..7174996f3 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/NonTransientFlatFileException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/NonTransientFlatFileException.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2023 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. @@ -21,11 +21,12 @@ import org.springframework.batch.item.NonTransientResourceException; * Exception thrown when errors are encountered with the underlying resource. * * @author Dave Syer + * @author Mahmoud Ben Hassine */ @SuppressWarnings("serial") public class NonTransientFlatFileException extends NonTransientResourceException { - private String input; + private final String input; private int lineNumber; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/ResourcesItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/ResourcesItemReader.java index d101ecf77..9f675de38 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/ResourcesItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/ResourcesItemReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2021 the original author or authors. + * Copyright 2009-2023 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. @@ -50,7 +50,7 @@ public class ResourcesItemReader extends AbstractItemStreamItemReader private Resource[] resources = new Resource[0]; - private AtomicInteger counter = new AtomicInteger(0); + private final AtomicInteger counter = new AtomicInteger(0); public ResourcesItemReader() { /* diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/builder/FlatFileItemReaderBuilder.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/builder/FlatFileItemReaderBuilder.java index 15b857d56..0a88a178c 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/builder/FlatFileItemReaderBuilder.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/builder/FlatFileItemReaderBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2022 the original author or authors. + * Copyright 2016-2023 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. @@ -97,7 +97,7 @@ public class FlatFileItemReaderBuilder { private BeanFactory beanFactory; - private Map, PropertyEditor> customEditors = new HashMap<>(); + private final Map, PropertyEditor> customEditors = new HashMap<>(); private int distanceLimit = 5; @@ -521,19 +521,19 @@ public class FlatFileItemReaderBuilder { */ public static class DelimitedBuilder { - private FlatFileItemReaderBuilder parent; + private final FlatFileItemReaderBuilder parent; - private List names = new ArrayList<>(); + private final List names = new ArrayList<>(); private String delimiter; private Character quoteCharacter; - private List includedFields = new ArrayList<>(); + private final List includedFields = new ArrayList<>(); private FieldSetFactory fieldSetFactory = new DefaultFieldSetFactory(); - private boolean strict = true; + private final boolean strict = true; protected DelimitedBuilder(FlatFileItemReaderBuilder parent) { this.parent = parent; @@ -665,11 +665,11 @@ public class FlatFileItemReaderBuilder { */ public static class FixedLengthBuilder { - private FlatFileItemReaderBuilder parent; + private final FlatFileItemReaderBuilder parent; - private List ranges = new ArrayList<>(); + private final List ranges = new ArrayList<>(); - private List names = new ArrayList<>(); + private final List names = new ArrayList<>(); private boolean strict = true; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/builder/FlatFileItemWriterBuilder.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/builder/FlatFileItemWriterBuilder.java index a18f8760f..335e06e1c 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/builder/FlatFileItemWriterBuilder.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/builder/FlatFileItemWriterBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2022 the original author or authors. + * Copyright 2016-2023 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. @@ -277,7 +277,7 @@ public class FlatFileItemWriterBuilder { */ public static class FormattedBuilder { - private FlatFileItemWriterBuilder parent; + private final FlatFileItemWriterBuilder parent; private String format; @@ -289,7 +289,7 @@ public class FlatFileItemWriterBuilder { private FieldExtractor fieldExtractor; - private List names = new ArrayList<>(); + private final List names = new ArrayList<>(); private Class sourceType; @@ -418,9 +418,9 @@ public class FlatFileItemWriterBuilder { */ public static class DelimitedBuilder { - private FlatFileItemWriterBuilder parent; + private final FlatFileItemWriterBuilder parent; - private List names = new ArrayList<>(); + private final List names = new ArrayList<>(); private String delimiter = ","; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapper.java index 5e41fdc69..665cf4ec7 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapper.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapper.java @@ -99,7 +99,7 @@ public class BeanWrapperFieldSetMapper extends DefaultPropertyEditorRegistrar private BeanFactory beanFactory; - private ConcurrentMap> propertiesMatched = new ConcurrentHashMap<>(); + private final ConcurrentMap> propertiesMatched = new ConcurrentHashMap<>(); private int distanceLimit = 5; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/JsonLineMapper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/JsonLineMapper.java index 127be9102..a8b6c87f4 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/JsonLineMapper.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/JsonLineMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2014 the original author or authors. + * Copyright 2009-2023 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. @@ -42,7 +42,7 @@ import org.springframework.batch.item.file.LineMapper; */ public class JsonLineMapper implements LineMapper> { - private MappingJsonFactory factory = new MappingJsonFactory(); + private final MappingJsonFactory factory = new MappingJsonFactory(); /** * Interpret the line as a Json object and create a Map from it. diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/PatternMatchingCompositeLineMapper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/PatternMatchingCompositeLineMapper.java index 58f0d3ffd..def6a6a90 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/PatternMatchingCompositeLineMapper.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/PatternMatchingCompositeLineMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -41,11 +41,12 @@ import org.springframework.util.Assert; * @see PatternMatchingCompositeLineTokenizer * @author Dan Garrette * @author Dave Syer + * @author Mahmoud Ben Hassine * @since 2.0 */ public class PatternMatchingCompositeLineMapper implements LineMapper, InitializingBean { - private PatternMatchingCompositeLineTokenizer tokenizer = new PatternMatchingCompositeLineTokenizer(); + private final PatternMatchingCompositeLineTokenizer tokenizer = new PatternMatchingCompositeLineTokenizer(); private PatternMatcher> patternMatcher; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/PropertyMatches.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/PropertyMatches.java index 6ca49fb7b..308d62355 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/PropertyMatches.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/PropertyMatches.java @@ -73,7 +73,7 @@ final class PropertyMatches { private final String propertyName; - private String[] possibleMatches; + private final String[] possibleMatches; /** * Create a new PropertyMatches instance for the given property. diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/AbstractLineTokenizer.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/AbstractLineTokenizer.java index 2ee581d87..c649e5776 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/AbstractLineTokenizer.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/AbstractLineTokenizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2019 the original author or authors. + * Copyright 2006-2023 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. @@ -31,6 +31,7 @@ import org.springframework.util.StringUtils; * @author Robert Kasanicky * @author Lucas Ward * @author Michael Minella + * @author Mahmoud Ben Hassine */ public abstract class AbstractLineTokenizer implements LineTokenizer { @@ -38,7 +39,7 @@ public abstract class AbstractLineTokenizer implements LineTokenizer { private boolean strict = true; - private String emptyToken = ""; + private final String emptyToken = ""; private FieldSetFactory fieldSetFactory = new DefaultFieldSetFactory(); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/DefaultFieldSet.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/DefaultFieldSet.java index c2e7baf01..df75d60a2 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/DefaultFieldSet.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/DefaultFieldSet.java @@ -59,7 +59,7 @@ public class DefaultFieldSet implements FieldSet { /** * The fields wrapped by this 'FieldSet' instance. */ - private String[] tokens; + private final String[] tokens; private List names; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/IncorrectLineLengthException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/IncorrectLineLengthException.java index 72feb1433..d751950e8 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/IncorrectLineLengthException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/IncorrectLineLengthException.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2008 the original author or authors. + * Copyright 2006-2023 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. @@ -20,14 +20,15 @@ package org.springframework.batch.item.file.transform; * * @author Lucas Ward * @author Michael Minella + * @author Mahmoud Ben Hassine * @since 1.1 */ @SuppressWarnings("serial") public class IncorrectLineLengthException extends FlatFileFormatException { - private int actualLength; + private final int actualLength; - private int expectedLength; + private final int expectedLength; /** * @param message the message for this exception. diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/IncorrectTokenCountException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/IncorrectTokenCountException.java index bf5d9ee9b..ce897a3ea 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/IncorrectTokenCountException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/IncorrectTokenCountException.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2014 the original author or authors. + * Copyright 2006-2023 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. @@ -21,14 +21,15 @@ package org.springframework.batch.item.file.transform; * * @author Lucas Ward * @author "Michael Minella" + * @author Mahmoud Ben Hassine * @since 1.1 */ @SuppressWarnings("serial") public class IncorrectTokenCountException extends FlatFileFormatException { - private int actualCount; + private final int actualCount; - private int expectedCount; + private final int expectedCount; private String input; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/RecordFieldExtractor.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/RecordFieldExtractor.java index 1e186a3a3..b9de4da2d 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/RecordFieldExtractor.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/RecordFieldExtractor.java @@ -36,9 +36,9 @@ public class RecordFieldExtractor implements FieldExtractor { private List names; - private Class targetType; + private final Class targetType; - private RecordComponent[] recordComponents; + private final RecordComponent[] recordComponents; public RecordFieldExtractor(Class targetType) { Assert.notNull(targetType, "target type must not be null"); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/kafka/KafkaItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/kafka/KafkaItemReader.java index 4d3bf8b2a..22f4b014e 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/kafka/KafkaItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/kafka/KafkaItemReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 the original author or authors. + * Copyright 2019-2023 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. @@ -56,13 +56,13 @@ public class KafkaItemReader extends AbstractItemStreamItemReader { private static final long DEFAULT_POLL_TIMEOUT = 30L; - private List topicPartitions; + private final List topicPartitions; private Map partitionOffsets; private KafkaConsumer kafkaConsumer; - private Properties consumerProperties; + private final Properties consumerProperties; private Iterator> consumerRecords; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/ListItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/ListItemReader.java index 146eeec0e..23a18da31 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/ListItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/ListItemReader.java @@ -32,11 +32,12 @@ import org.springframework.lang.Nullable; * * @author Dave Syer * @author jojoldu + * @author Mahmoud Ben Hassine * */ public class ListItemReader implements ItemReader { - private List list; + private final List list; public ListItemReader(List list) { // If it is a proxy we assume it knows how to deal with its own state. diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/ListItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/ListItemWriter.java index 786fa4656..58247b9ad 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/ListItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/ListItemWriter.java @@ -33,7 +33,7 @@ import java.util.List; */ public class ListItemWriter implements ItemWriter { - private List writtenItems = new ArrayList<>(); + private final List writtenItems = new ArrayList<>(); @Override public void write(Chunk chunk) throws Exception { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/validator/BeanValidatingItemProcessor.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/validator/BeanValidatingItemProcessor.java index 4b6ed2da4..ccb9f05b5 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/validator/BeanValidatingItemProcessor.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/validator/BeanValidatingItemProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2021 the original author or authors. + * Copyright 2018-2023 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. @@ -32,7 +32,7 @@ import org.springframework.validation.beanvalidation.SpringValidatorAdapter; */ public class BeanValidatingItemProcessor extends ValidatingItemProcessor { - private Validator validator; + private final Validator validator; /** * Create a new instance of {@link BeanValidatingItemProcessor} with the default diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/builder/StaxEventItemReaderBuilder.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/builder/StaxEventItemReaderBuilder.java index 71682bfff..85f374698 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/builder/StaxEventItemReaderBuilder.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/builder/StaxEventItemReaderBuilder.java @@ -51,7 +51,7 @@ public class StaxEventItemReaderBuilder { private Unmarshaller unmarshaller; - private List fragmentRootElements = new ArrayList<>(); + private final List fragmentRootElements = new ArrayList<>(); private boolean saveState = true; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/stax/UnclosedElementCollectingEventWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/stax/UnclosedElementCollectingEventWriter.java index 4adc4c9fe..3f8cbe45d 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/stax/UnclosedElementCollectingEventWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/stax/UnclosedElementCollectingEventWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 the original author or authors. + * Copyright 2014-2023 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. @@ -29,11 +29,12 @@ import javax.xml.stream.events.XMLEvent; * not closed. * * @author Jimmy Praet + * @author Mahmoud Ben Hassine * @since 3.0 */ public class UnclosedElementCollectingEventWriter extends AbstractEventWriterWrapper { - private LinkedList unclosedElements = new LinkedList<>(); + private final LinkedList unclosedElements = new LinkedList<>(); public UnclosedElementCollectingEventWriter(XMLEventWriter wrappedEventWriter) { super(wrappedEventWriter); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/stax/UnopenedElementClosingEventWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/stax/UnopenedElementClosingEventWriter.java index 5098784aa..95b109b9a 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/stax/UnopenedElementClosingEventWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/stax/UnopenedElementClosingEventWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-2023 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. @@ -34,13 +34,14 @@ import org.springframework.util.StringUtils; * XMLEventWriter. * * @author Jimmy Praet + * @author Mahmoud Ben Hassine * @since 3.0 */ public class UnopenedElementClosingEventWriter extends AbstractEventWriterWrapper { - private LinkedList unopenedElements; + private final LinkedList unopenedElements; - private Writer ioWriter; + private final Writer ioWriter; public UnopenedElementClosingEventWriter(XMLEventWriter wrappedEventWriter, Writer ioWriter, List unopenedElements) { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/callback/NestedRepeatCallback.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/callback/NestedRepeatCallback.java index 873a5acfe..73864b6e7 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/callback/NestedRepeatCallback.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/callback/NestedRepeatCallback.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2023 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. @@ -27,13 +27,14 @@ import org.springframework.batch.repeat.RepeatStatus; * into chunks. * * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class NestedRepeatCallback implements RepeatCallback { - private RepeatOperations template; + private final RepeatOperations template; - private RepeatCallback callback; + private final RepeatCallback callback; /** * Constructor setting mandatory fields. diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/context/RepeatContextSupport.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/context/RepeatContextSupport.java index 68fc7030a..63699a906 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/context/RepeatContextSupport.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/context/RepeatContextSupport.java @@ -27,7 +27,7 @@ import org.springframework.batch.repeat.RepeatContext; public class RepeatContextSupport extends SynchronizedAttributeAccessor implements RepeatContext { - private RepeatContext parent; + private final RepeatContext parent; private int count; @@ -35,7 +35,7 @@ public class RepeatContextSupport extends SynchronizedAttributeAccessor implemen private volatile boolean terminateOnly; - private Map> callbacks = new HashMap<>(); + private final Map> callbacks = new HashMap<>(); /** * Constructor for {@link RepeatContextSupport}. The parent can be null, but should be diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/exception/SimpleLimitExceptionHandler.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/exception/SimpleLimitExceptionHandler.java index 68a9a7e18..d3592695a 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/exception/SimpleLimitExceptionHandler.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/exception/SimpleLimitExceptionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2023 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. @@ -34,10 +34,11 @@ import org.springframework.beans.factory.InitializingBean; * * @author Dave Syer * @author Robert Kasanicky + * @author Mahmoud Ben Hassine */ public class SimpleLimitExceptionHandler implements ExceptionHandler, InitializingBean { - private RethrowOnThresholdExceptionHandler delegate = new RethrowOnThresholdExceptionHandler(); + private final RethrowOnThresholdExceptionHandler delegate = new RethrowOnThresholdExceptionHandler(); private Collection> exceptionClasses = Collections .>singleton(Exception.class); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/CompositeCompletionPolicy.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/CompositeCompletionPolicy.java index b8177a17d..798a1383d 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/CompositeCompletionPolicy.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/CompositeCompletionPolicy.java @@ -119,12 +119,12 @@ public class CompositeCompletionPolicy implements CompletionPolicy { */ protected class CompositeBatchContext extends RepeatContextSupport { - private RepeatContext[] contexts; + private final RepeatContext[] contexts; // Save a reference to the policies when we were created - gives some // protection against reference changes (e.g. if the number of policies // change). - private CompletionPolicy[] policies; + private final CompletionPolicy[] policies; public CompositeBatchContext(RepeatContext context, List contexts) { super(context); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/TimeoutTerminationPolicy.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/TimeoutTerminationPolicy.java index dae86e3aa..cc2824c9a 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/TimeoutTerminationPolicy.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/TimeoutTerminationPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2023 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. @@ -30,6 +30,7 @@ import org.springframework.batch.repeat.context.RepeatContextSupport; * than the termination policy. * * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class TimeoutTerminationPolicy extends CompletionPolicySupport { @@ -80,7 +81,7 @@ public class TimeoutTerminationPolicy extends CompletionPolicySupport { protected class TimeoutBatchContext extends RepeatContextSupport { - private volatile long time = System.currentTimeMillis(); + private final long time = System.currentTimeMillis(); private final long timeout = TimeoutTerminationPolicy.this.timeout; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/AnnotationMethodResolver.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/AnnotationMethodResolver.java index a26abcb8b..69c75abb4 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/AnnotationMethodResolver.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/AnnotationMethodResolver.java @@ -38,7 +38,7 @@ import org.springframework.util.ReflectionUtils; */ public class AnnotationMethodResolver implements MethodResolver { - private Class annotationType; + private final Class annotationType; /** * Create a {@link MethodResolver} for the specified Method-level annotation type. diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/TransactionAwareBufferedWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/TransactionAwareBufferedWriter.java index c839a3c75..390fd98e8 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/TransactionAwareBufferedWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/TransactionAwareBufferedWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 the original author or authors. + * Copyright 2006-2023 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. @@ -34,6 +34,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager * @author Dave Syer * @author Michael Minella * @author Niels Ferguson + * @author Mahmoud Ben Hassine * */ public class TransactionAwareBufferedWriter extends Writer { @@ -42,7 +43,7 @@ public class TransactionAwareBufferedWriter extends Writer { private final Object closeKey; - private FileChannel channel; + private final FileChannel channel; private final Runnable closeCallback; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/container/jms/BatchMessageListenerContainer.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/container/jms/BatchMessageListenerContainer.java index 8558ff2c2..66302cf48 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/container/jms/BatchMessageListenerContainer.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/container/jms/BatchMessageListenerContainer.java @@ -65,7 +65,7 @@ public class BatchMessageListenerContainer extends DefaultMessageListenerContain private Advice[] advices = new Advice[0]; - private ContainerDelegate delegate = BatchMessageListenerContainer.super::receiveAndExecute; + private final ContainerDelegate delegate = BatchMessageListenerContainer.super::receiveAndExecute; private ContainerDelegate proxy = delegate; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/AbstractDelegatorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/AbstractDelegatorTests.java index 55d434fd1..ce2d20467 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/AbstractDelegatorTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/adapter/AbstractDelegatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 the original author or authors. + * Copyright 2008-2023 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. @@ -32,6 +32,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; * Tests for {@link AbstractMethodInvokingDelegator} * * @author Robert Kasanicky + * @author Mahmoud Ben Hassine */ class AbstractDelegatorTests { @@ -199,7 +200,7 @@ class AbstractDelegatorTests { private String name; - private int value; + private final int value; public Foo(String name, int value) { this.name = name; @@ -230,7 +231,7 @@ class AbstractDelegatorTests { private static class FooService { - private List processedFooNameValuePairs = new ArrayList<>(); + private final List processedFooNameValuePairs = new ArrayList<>(); @SuppressWarnings("unused") public void processNameValuePair(String name, int value) { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/avro/example/User.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/avro/example/User.java index 45d2eab6e..166fcd0f9 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/avro/example/User.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/avro/example/User.java @@ -40,7 +40,7 @@ public class User extends org.apache.avro.specific.SpecificRecordBase return SCHEMA$; } - private static SpecificData MODEL$ = new SpecificData(); + private static final SpecificData MODEL$ = new SpecificData(); private static final BinaryMessageEncoder ENCODER = new BinaryMessageEncoder<>(MODEL$, SCHEMA$); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/avro/support/AvroTestFixtures.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/avro/support/AvroTestFixtures.java index f7f39ecfa..2d0c52a53 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/avro/support/AvroTestFixtures.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/avro/support/AvroTestFixtures.java @@ -51,7 +51,7 @@ public abstract class AvroTestFixtures { new User("Alana", 13, "yellow"), new User("Joe", 1, "pink")); - private Chunk plainOldUsers = Chunk.of( + private final Chunk plainOldUsers = Chunk.of( new PlainOldUser("David", 20, "blue"), new PlainOldUser("Sue", 4, "red"), new PlainOldUser("Alana", 13, "yellow"), diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterNamedParameterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterNamedParameterTests.java index 5a6cbb55d..33e1ee9ae 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterNamedParameterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/JdbcBatchItemWriterNamedParameterTests.java @@ -191,7 +191,7 @@ public class JdbcBatchItemWriterNamedParameterTests { public static class SqlParameterSourceArrayEquals extends BaseMatcher { - private SqlParameterSource[] expected; + private final SqlParameterSource[] expected; public SqlParameterSourceArrayEquals(SqlParameterSource[] expected) { this.expected = expected; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemWriterFlatFileTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemWriterFlatFileTests.java index 6c4b056a9..ffe91317e 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemWriterFlatFileTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/MultiResourceItemWriterFlatFileTests.java @@ -41,7 +41,7 @@ public class MultiResourceItemWriterFlatFileTests extends AbstractMultiResourceI */ private final class WriterCallback implements TransactionCallback { - private Chunk list; + private final Chunk list; public WriterCallback(Chunk list) { super(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/builder/FlatFileItemReaderBuilderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/builder/FlatFileItemReaderBuilderTests.java index a398820ae..90b11ef4c 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/builder/FlatFileItemReaderBuilderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/builder/FlatFileItemReaderBuilderTests.java @@ -377,7 +377,7 @@ class FlatFileItemReaderBuilderTests { .resource(getResource("1,2,3")) .delimited() .fieldSetFactory(new FieldSetFactory() { - private FieldSet fieldSet = new DefaultFieldSet(new String[] { "1", "3", "foo" }, names); + private final FieldSet fieldSet = new DefaultFieldSet(new String[] { "1", "3", "foo" }, names); @Override public FieldSet create(String[] values, String[] names) { @@ -409,7 +409,7 @@ class FlatFileItemReaderBuilderTests { .resource(getResource("1 2 3")) .fixedLength() .fieldSetFactory(new FieldSetFactory() { - private FieldSet fieldSet = new DefaultFieldSet(new String[] { "1", "3", "foo" }, names); + private final FieldSet fieldSet = new DefaultFieldSet(new String[] { "1", "3", "foo" }, names); @Override public FieldSet create(String[] values, String[] names) { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/RecordFieldSetMapperTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/RecordFieldSetMapperTests.java index f419f295f..379220931 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/RecordFieldSetMapperTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/mapping/RecordFieldSetMapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 the original author or authors. + * Copyright 2020-2023 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. @@ -71,9 +71,9 @@ class RecordFieldSetMapperTests { public static class Person { // TODO change to record in v5 - private int id; + private final int id; - private String name; + private final String name; public Person(int id, String name) { this.id = id; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/FormatterLineAggregatorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/FormatterLineAggregatorTests.java index 1eb719d6f..baa9d63d9 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/FormatterLineAggregatorTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/transform/FormatterLineAggregatorTests.java @@ -107,7 +107,7 @@ class FormatterLineAggregatorTests { aggregator.setMaximumLength(25); aggregator.setFieldExtractor(new FieldExtractor<>() { - private int[] widths = new int[] { 13, 12 }; + private final int[] widths = new int[] { 13, 12 }; @Override public Object[] extract(String[] item) { @@ -140,7 +140,7 @@ class FormatterLineAggregatorTests { aggregator.setMaximumLength(24); aggregator.setFieldExtractor(new FieldExtractor<>() { - private int[] widths = new int[] { 13, 11 }; + private final int[] widths = new int[] { 13, 11 }; @Override public Object[] extract(String[] item) { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/sample/FooService.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/sample/FooService.java index ee2c1662a..64f078e48 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/sample/FooService.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/sample/FooService.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 the original author or authors. + * Copyright 2008-2023 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. @@ -24,6 +24,7 @@ import java.util.List; * class can be reused by the framework. * * @author Robert Kasanicky + * @author Mahmoud Ben Hassine */ public class FooService { @@ -31,11 +32,11 @@ public class FooService { private int counter = 0; - private List generatedFoos = new ArrayList<>(GENERATION_LIMIT); + private final List generatedFoos = new ArrayList<>(GENERATION_LIMIT); - private List processedFoos = new ArrayList<>(GENERATION_LIMIT); + private final List processedFoos = new ArrayList<>(GENERATION_LIMIT); - private List processedFooNameValuePairs = new ArrayList<>(GENERATION_LIMIT); + private final List processedFooNameValuePairs = new ArrayList<>(GENERATION_LIMIT); public Foo generateFoo() { if (counter++ >= GENERATION_LIMIT) diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/ItemCountingItemStreamItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/ItemCountingItemStreamItemReaderTests.java index 8cb4fd5ce..c2d75646c 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/ItemCountingItemStreamItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/support/ItemCountingItemStreamItemReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -30,6 +30,7 @@ import org.springframework.lang.Nullable; /** * @author Dave Syer + * @author Mahmoud Ben Hassine * */ class ItemCountingItemStreamItemReaderTests { @@ -132,7 +133,7 @@ class ItemCountingItemStreamItemReaderTests { private boolean openCalled = false; - private Iterator items = Arrays.asList("a", "b", "c").iterator(); + private final Iterator items = Arrays.asList("a", "b", "c").iterator(); @Override protected void doClose() throws Exception { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/Jaxb2NamespaceUnmarshallingTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/Jaxb2NamespaceUnmarshallingTests.java index a8df64c1c..24c75cb66 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/Jaxb2NamespaceUnmarshallingTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/xml/Jaxb2NamespaceUnmarshallingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 the original author or authors. + * Copyright 2010-2023 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. @@ -113,7 +113,7 @@ class Jaxb2NamespaceUnmarshallingTests { reader.close(); } - private static String TRADE_XML = "" + private static final String TRADE_XML = "" + "Customer1XYZ000111.395" + ""; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/ResultHolderResultQueueTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/ResultHolderResultQueueTests.java index e57919f3a..0f793a3b2 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/ResultHolderResultQueueTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/ResultHolderResultQueueTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2022 the original author or authors. + * Copyright 2009-2023 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. @@ -50,7 +50,7 @@ class ResultHolderResultQueueTests { private static class TestResultHolder implements ResultHolder { - private RepeatStatus result; + private final RepeatStatus result; private Throwable error; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/Trade.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/Trade.java index c03919a52..5c254d68d 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/Trade.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/Trade.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2023 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. @@ -22,14 +22,15 @@ import org.springframework.batch.item.file.transform.FieldSet; /** * @author Rob Harrop + * @author Mahmoud Ben Hassine */ public class Trade { - private String isin; + private final String isin; - private long quantity; + private final long quantity; - private BigDecimal price; + private final BigDecimal price; Trade(FieldSet fieldSet) { this.isin = fieldSet.readString(0); diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/MessageSourcePollerInterceptor.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/MessageSourcePollerInterceptor.java index 2a2abd11d..e5633fe29 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/MessageSourcePollerInterceptor.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/MessageSourcePollerInterceptor.java @@ -17,11 +17,12 @@ import org.springframework.util.Assert; * case the receive() can join a transaction which was started by the caller. * * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class MessageSourcePollerInterceptor implements ChannelInterceptor, InitializingBean { - private static Log logger = LogFactory.getLog(MessageSourcePollerInterceptor.class); + private static final Log logger = LogFactory.getLog(MessageSourcePollerInterceptor.class); private MessageSource source; diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkHandlerFactoryBean.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkHandlerFactoryBean.java index ba946a6f0..ea73395f2 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkHandlerFactoryBean.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkHandlerFactoryBean.java @@ -51,7 +51,7 @@ import org.springframework.util.ReflectionUtils; */ public class RemoteChunkHandlerFactoryBean implements FactoryBean> { - private static Log logger = LogFactory.getLog(RemoteChunkHandlerFactoryBean.class); + private static final Log logger = LogFactory.getLog(RemoteChunkHandlerFactoryBean.class); private TaskletStep step; diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkingManagerStepBuilderFactory.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkingManagerStepBuilderFactory.java index 2568d1db2..5c6da2886 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkingManagerStepBuilderFactory.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/chunk/RemoteChunkingManagerStepBuilderFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 the original author or authors. + * Copyright 2019-2023 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. @@ -27,9 +27,9 @@ import org.springframework.transaction.PlatformTransactionManager; */ public class RemoteChunkingManagerStepBuilderFactory { - private JobRepository jobRepository; + private final JobRepository jobRepository; - private PlatformTransactionManager transactionManager; + private final PlatformTransactionManager transactionManager; /** * Create a new {@link RemoteChunkingManagerStepBuilderFactory}. diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/config/annotation/BatchIntegrationConfiguration.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/config/annotation/BatchIntegrationConfiguration.java index 7e16563d9..fb04dd735 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/config/annotation/BatchIntegrationConfiguration.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/config/annotation/BatchIntegrationConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2022 the original author or authors. + * Copyright 2018-2023 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. @@ -36,11 +36,11 @@ import org.springframework.transaction.PlatformTransactionManager; @Configuration(proxyBeanMethods = false) public class BatchIntegrationConfiguration implements InitializingBean { - private JobExplorer jobExplorer; + private final JobExplorer jobExplorer; - private JobRepository jobRepository; + private final JobRepository jobRepository; - private PlatformTransactionManager transactionManager; + private final PlatformTransactionManager transactionManager; private RemoteChunkingManagerStepBuilderFactory remoteChunkingManagerStepBuilderFactory; diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/config/xml/RemoteChunkingWorkerParser.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/config/xml/RemoteChunkingWorkerParser.java index 25fd3a3dc..570720c8a 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/config/xml/RemoteChunkingWorkerParser.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/config/xml/RemoteChunkingWorkerParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-2023 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. @@ -114,7 +114,7 @@ public class RemoteChunkingWorkerParser extends AbstractBeanDefinitionParser { private static final String CHUNK_PROCESSOR_CHUNK_HANDLER_BEAN_NAME_PREFIX = "chunkProcessorChunkHandler_"; - private String id; + private final String id; public ServiceActivatorParser(String id) { this.id = id; diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/partition/MessageChannelPartitionHandler.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/partition/MessageChannelPartitionHandler.java index e4ac74e8d..20be4c397 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/partition/MessageChannelPartitionHandler.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/partition/MessageChannelPartitionHandler.java @@ -88,7 +88,7 @@ import org.springframework.util.CollectionUtils; @MessageEndpoint public class MessageChannelPartitionHandler extends AbstractPartitionHandler implements InitializingBean { - private static Log logger = LogFactory.getLog(MessageChannelPartitionHandler.class); + private static final Log logger = LogFactory.getLog(MessageChannelPartitionHandler.class); private MessagingTemplate messagingGateway; diff --git a/spring-batch-integration/src/test/java/org/springframework/batch/integration/StepSupport.java b/spring-batch-integration/src/test/java/org/springframework/batch/integration/StepSupport.java index b9a64e735..fdfce19c0 100644 --- a/spring-batch-integration/src/test/java/org/springframework/batch/integration/StepSupport.java +++ b/spring-batch-integration/src/test/java/org/springframework/batch/integration/StepSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2023 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. @@ -21,11 +21,12 @@ import org.springframework.batch.core.StepExecution; /** * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class StepSupport implements Step { - private String name; + private final String name; private int startLimit = 1; diff --git a/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/RemoteChunkingManagerStepBuilderTests.java b/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/RemoteChunkingManagerStepBuilderTests.java index 3173a0e89..ffa117799 100644 --- a/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/RemoteChunkingManagerStepBuilderTests.java +++ b/spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/RemoteChunkingManagerStepBuilderTests.java @@ -254,7 +254,7 @@ class RemoteChunkingManagerStepBuilderTests { int count = 0; - List items = Arrays.asList("a", "b", "c", "d", "d", "e", "f", "g", "h", "i"); + final List items = Arrays.asList("a", "b", "c", "d", "d", "e", "f", "g", "h", "i"); @Nullable @Override diff --git a/spring-batch-integration/src/test/java/org/springframework/batch/integration/partition/BeanFactoryStepLocatorTests.java b/spring-batch-integration/src/test/java/org/springframework/batch/integration/partition/BeanFactoryStepLocatorTests.java index 8cb410fb5..e51bfd06c 100644 --- a/spring-batch-integration/src/test/java/org/springframework/batch/integration/partition/BeanFactoryStepLocatorTests.java +++ b/spring-batch-integration/src/test/java/org/springframework/batch/integration/partition/BeanFactoryStepLocatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2022 the original author or authors. + * Copyright 2009-2023 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. @@ -47,7 +47,7 @@ class BeanFactoryStepLocatorTests { private static final class StubStep implements Step { - private String name; + private final String name; public StubStep(String name) { this.name = name; diff --git a/spring-batch-integration/src/test/java/org/springframework/batch/integration/partition/ExampleItemReader.java b/spring-batch-integration/src/test/java/org/springframework/batch/integration/partition/ExampleItemReader.java index d1d714ede..cc9965e7c 100644 --- a/spring-batch-integration/src/test/java/org/springframework/batch/integration/partition/ExampleItemReader.java +++ b/spring-batch-integration/src/test/java/org/springframework/batch/integration/partition/ExampleItemReader.java @@ -13,9 +13,9 @@ import org.springframework.lang.Nullable; */ public class ExampleItemReader implements ItemReader, ItemStream { - private Log logger = LogFactory.getLog(getClass()); + private final Log logger = LogFactory.getLog(getClass()); - private String[] input = { "Hello", "world!", "Go", "on", "punk", "make", "my", "day!" }; + private final String[] input = { "Hello", "world!", "Go", "on", "punk", "make", "my", "day!" }; private int index = 0; diff --git a/spring-batch-integration/src/test/java/org/springframework/batch/integration/retry/SimpleRecoverer.java b/spring-batch-integration/src/test/java/org/springframework/batch/integration/retry/SimpleRecoverer.java index 33dc85614..8a1c7345d 100644 --- a/spring-batch-integration/src/test/java/org/springframework/batch/integration/retry/SimpleRecoverer.java +++ b/spring-batch-integration/src/test/java/org/springframework/batch/integration/retry/SimpleRecoverer.java @@ -9,11 +9,12 @@ import org.springframework.retry.interceptor.MethodInvocationRecoverer; /** * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public final class SimpleRecoverer implements MethodInvocationRecoverer { - private Log logger = LogFactory.getLog(getClass()); + private final Log logger = LogFactory.getLog(getClass()); private final List recovered = new ArrayList<>(); diff --git a/spring-batch-integration/src/test/java/org/springframework/batch/integration/retry/SimpleService.java b/spring-batch-integration/src/test/java/org/springframework/batch/integration/retry/SimpleService.java index 8ef470a90..8afe70be0 100644 --- a/spring-batch-integration/src/test/java/org/springframework/batch/integration/retry/SimpleService.java +++ b/spring-batch-integration/src/test/java/org/springframework/batch/integration/retry/SimpleService.java @@ -13,13 +13,13 @@ import org.springframework.integration.annotation.ServiceActivator; @MessageEndpoint public class SimpleService implements Service { - private Log logger = LogFactory.getLog(getClass()); + private final Log logger = LogFactory.getLog(getClass()); - private List processed = new CopyOnWriteArrayList<>(); + private final List processed = new CopyOnWriteArrayList<>(); private List expected = new ArrayList<>(); - private AtomicInteger count = new AtomicInteger(0); + private final AtomicInteger count = new AtomicInteger(0); public void setExpected(List expected) { this.expected = expected; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/LogAdvice.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/LogAdvice.java index 1c1130545..1bc9580cb 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/LogAdvice.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/LogAdvice.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 the original author or authors. + * Copyright 2006-2023 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. @@ -24,10 +24,11 @@ import org.apache.commons.logging.LogFactory; * representation of the object to the log. * * @author Lucas Ward + * @author Mahmoud Ben Hassine */ public class LogAdvice { - private static Log log = LogFactory.getLog(LogAdvice.class); + private static final Log log = LogFactory.getLog(LogAdvice.class); public void doStronglyTypedLogging(Object item) { if (log.isInfoEnabled()) { diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/ProcessIndicatorItemWrapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/ProcessIndicatorItemWrapper.java index 2ec6ba73b..96bc9f56a 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/ProcessIndicatorItemWrapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/ProcessIndicatorItemWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2009 the original author or authors. + * Copyright 2009-2023 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. @@ -24,12 +24,13 @@ package org.springframework.batch.sample.common; * @see StagingItemReader * @see StagingItemProcessor * @author Robert Kasanicky + * @author Mahmoud Ben Hassine */ public class ProcessIndicatorItemWrapper { - private long id; + private final long id; - private T item; + private final T item; public ProcessIndicatorItemWrapper(long id, T item) { this.id = id; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemReader.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemReader.java index 193a39801..55d925413 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemReader.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemReader.java @@ -46,7 +46,7 @@ import org.springframework.util.Assert; public class StagingItemReader implements ItemReader>, StepExecutionListener, InitializingBean, DisposableBean { - private static Log logger = LogFactory.getLog(StagingItemReader.class); + private static final Log logger = LogFactory.getLog(StagingItemReader.class); private StepExecution stepExecution; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/TestMailErrorHandler.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/TestMailErrorHandler.java index 37b7ae0b6..4d1c4eaae 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/TestMailErrorHandler.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/TestMailErrorHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2014 the original author or authors. + * Copyright 2006-2023 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. @@ -29,13 +29,14 @@ import org.springframework.mail.MailMessage; * * @author Dan Garrette * @author Dave Syer + * @author Mahmoud Ben Hassine * @since 2.1 */ public class TestMailErrorHandler implements MailErrorHandler { private static final Log LOGGER = LogFactory.getLog(TestMailErrorHandler.class); - private List failedMessages = new ArrayList<>(); + private final List failedMessages = new ArrayList<>(); @Override public void handle(MailMessage failedMessage, Exception ex) { diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/TestMailSender.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/TestMailSender.java index 30ba0a298..1772dc586 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/TestMailSender.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/mail/internal/TestMailSender.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 the original author or authors. + * Copyright 2006-2023 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. @@ -37,7 +37,7 @@ public class TestMailSender implements MailSender { private List subjectsToFail = new ArrayList<>(); - private List received = new ArrayList<>(); + private final List received = new ArrayList<>(); public void clear() { received.clear(); 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 ab186a35d..85bc3bf7d 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 @@ -60,7 +60,7 @@ public class AggregateItem { return HEADER; } - private T item; + private final T item; private boolean footer = false; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItemReader.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItemReader.java index 8f6256315..cf96e3da8 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItemReader.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItemReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 the original author or authors. + * Copyright 2006-2023 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. @@ -39,6 +39,7 @@ import org.springframework.lang.Nullable; * @see AggregateItem#isHeader() * @see AggregateItem#isFooter() * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class AggregateItemReader implements ItemReader> { @@ -109,7 +110,7 @@ public class AggregateItemReader implements ItemReader> { */ private class ResultHolder { - private List records = new ArrayList<>(); + private final List records = new ArrayList<>(); private boolean exhausted = false; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/OrderItemReader.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/OrderItemReader.java index db52b262f..17ecfa772 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/OrderItemReader.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/OrderItemReader.java @@ -38,7 +38,7 @@ import org.springframework.lang.Nullable; */ public class OrderItemReader implements ItemReader { - private static Log log = LogFactory.getLog(OrderItemReader.class); + private static final Log log = LogFactory.getLog(OrderItemReader.class); private Order order; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/HeaderFieldExtractor.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/HeaderFieldExtractor.java index bc8cebda4..27445ce9a 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/HeaderFieldExtractor.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/order/internal/extractor/HeaderFieldExtractor.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2014 the original author or authors. + * Copyright 2009-2023 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. @@ -22,11 +22,12 @@ import org.springframework.batch.sample.domain.order.Order; /** * @author Dan Garrette + * @author Mahmoud Ben Hassine * @since 2.0.1 */ public class HeaderFieldExtractor implements FieldExtractor { - private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); + private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); @Override public Object[] extract(Order order) { diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/person/internal/PersonWriter.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/person/internal/PersonWriter.java index 4d4ac192d..a35633e96 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/person/internal/PersonWriter.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/person/internal/PersonWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -25,7 +25,7 @@ import org.springframework.batch.sample.domain.person.Person; public class PersonWriter implements ItemWriter { - private static Log log = LogFactory.getLog(PersonWriter.class); + private static final Log log = LogFactory.getLog(PersonWriter.class); @Override public void write(Chunk data) { diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/HibernateCreditDao.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/HibernateCreditDao.java index b6857d87f..81a63dd49 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/HibernateCreditDao.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/HibernateCreditDao.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2023 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. @@ -28,13 +28,14 @@ import org.springframework.batch.sample.domain.trade.CustomerCreditDao; /** * @author Lucas Ward * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class HibernateCreditDao implements CustomerCreditDao, RepeatListener { private int failOnFlush = -1; - private List errors = new ArrayList<>(); + private final List errors = new ArrayList<>(); private SessionFactory sessionFactory; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcTradeDao.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcTradeDao.java index c9a02359c..63e63340f 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcTradeDao.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcTradeDao.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 the original author or authors. + * Copyright 2006-2023 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. @@ -30,10 +30,11 @@ import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer * Writes a Trade object to a database * * @author Robert Kasanicky + * @author Mahmoud Ben Hassine */ public class JdbcTradeDao implements TradeDao { - private Log log = LogFactory.getLog(JdbcTradeDao.class); + private final Log log = LogFactory.getLog(JdbcTradeDao.class); /** * template for inserting a row diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeWriter.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeWriter.java index 8692761d4..a385b56db 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeWriter.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/TradeWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -38,7 +38,7 @@ import org.springframework.util.Assert; */ public class TradeWriter extends ItemStreamSupport implements ItemWriter { - private static Log log = LogFactory.getLog(TradeWriter.class); + private static final Log log = LogFactory.getLog(TradeWriter.class); public static final String TOTAL_AMOUNT_KEY = "TOTAL_AMOUNT"; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/jmx/SimpleMessageApplicationEvent.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/jmx/SimpleMessageApplicationEvent.java index 96075d573..5e628d346 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/jmx/SimpleMessageApplicationEvent.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/jmx/SimpleMessageApplicationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2023 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. @@ -20,12 +20,13 @@ import org.springframework.context.ApplicationEvent; /** * @author Dave Syer + * @author Mahmoud Ben Hassine * */ @SuppressWarnings("serial") public class SimpleMessageApplicationEvent extends ApplicationEvent { - private String message; + private final String message; public SimpleMessageApplicationEvent(Object source, String message) { super(source); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/launch/DefaultJobLoader.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/launch/DefaultJobLoader.java index 8726196a5..6ddd1c650 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/launch/DefaultJobLoader.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/launch/DefaultJobLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2014 the original author or authors. + * Copyright 2006-2023 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. @@ -36,7 +36,7 @@ public class DefaultJobLoader implements JobLoader, ApplicationContextAware { private ApplicationContext applicationContext; - private Map configurations = new HashMap<>(); + private final Map configurations = new HashMap<>(); @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/metrics/Job1Configuration.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/metrics/Job1Configuration.java index bc572489e..03ac75c3e 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/metrics/Job1Configuration.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/metrics/Job1Configuration.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2023 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. @@ -30,7 +30,7 @@ import org.springframework.transaction.PlatformTransactionManager; @Configuration public class Job1Configuration { - private Random random; + private final Random random; public Job1Configuration() { this.random = new Random(); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/metrics/Job2Configuration.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/metrics/Job2Configuration.java index 17a07ca14..77bf4adcb 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/metrics/Job2Configuration.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/metrics/Job2Configuration.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2023 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. @@ -34,7 +34,7 @@ import org.springframework.transaction.PlatformTransactionManager; @Configuration public class Job2Configuration { - private Random random; + private final Random random; public Job2Configuration() { this.random = new Random(); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/metrics/PrometheusConfiguration.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/metrics/PrometheusConfiguration.java index 0a5f611a3..b27526f63 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/metrics/PrometheusConfiguration.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/metrics/PrometheusConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2022 the original author or authors. + * Copyright 2021-2023 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. @@ -45,7 +45,7 @@ public class PrometheusConfiguration { @Value("${prometheus.pushgateway.url}") private String prometheusPushGatewayUrl; - private Map groupingKey = new HashMap<>(); + private final Map groupingKey = new HashMap<>(); private PushGateway pushGateway; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/quartz/JobLauncherDetails.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/quartz/JobLauncherDetails.java index 2e91e26fe..b90d98368 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/quartz/JobLauncherDetails.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/quartz/JobLauncherDetails.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2021 the original author or authors. + * Copyright 2006-2023 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. @@ -31,6 +31,7 @@ import org.springframework.scheduling.quartz.QuartzJobBean; /** * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class JobLauncherDetails extends QuartzJobBean { @@ -40,7 +41,7 @@ public class JobLauncherDetails extends QuartzJobBean { */ static final String JOB_NAME = "jobName"; - private static Log log = LogFactory.getLog(JobLauncherDetails.class); + private static final Log log = LogFactory.getLog(JobLauncherDetails.class); private JobLocator jobLocator; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/CustomerFilterJobFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/CustomerFilterJobFunctionalTests.java index 3755b29e3..83d036ccc 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/CustomerFilterJobFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/CustomerFilterJobFunctionalTests.java @@ -108,9 +108,9 @@ class CustomerFilterJobFunctionalTests { private static class Customer { - private String name; + private final String name; - private double credit; + private final double credit; public Customer(String name, double credit) { this.name = name; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/TradeJobFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/TradeJobFunctionalTests.java index 4faf885fe..76a519607 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/TradeJobFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/TradeJobFunctionalTests.java @@ -116,9 +116,9 @@ class TradeJobFunctionalTests { private static class Customer { - private String name; + private final String name; - private double credit; + private final double credit; public Customer(String name, double credit) { this.name = name; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/ColumnRangePartitionerTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/ColumnRangePartitionerTests.java index 843cba97a..035239126 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/ColumnRangePartitionerTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/ColumnRangePartitionerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2022 the original author or authors. + * Copyright 2009-2023 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. @@ -37,7 +37,7 @@ class ColumnRangePartitionerTests { this.dataSource = dataSource; } - private ColumnRangePartitioner partitioner = new ColumnRangePartitioner(); + private final ColumnRangePartitioner partitioner = new ColumnRangePartitioner(); @Test void testPartition() { diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/CustomItemReaderTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/CustomItemReaderTests.java index 302c1f8db..e6f084f6c 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/CustomItemReaderTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/CustomItemReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -36,6 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertNull; * * @author Lucas Ward * @author Glenn Renfro + * @author Mahmoud Ben Hassine * */ class CustomItemReaderTests { @@ -80,7 +81,7 @@ class CustomItemReaderTests { private static final String CURRENT_INDEX = "current.index"; - private List items; + private final List items; private int currentIndex = 0; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/CustomItemWriterTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/CustomItemWriterTests.java index f2d9e8324..422660498 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/CustomItemWriterTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/CustomItemWriterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2023 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. @@ -47,7 +47,7 @@ class CustomItemWriterTests { static class CustomItemWriter implements ItemWriter { - private List output = TransactionAwareProxyFactory.createTransactionalList(); + private final List output = TransactionAwareProxyFactory.createTransactionalList(); @Override public void write(Chunk chunk) throws Exception { diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/ItemTrackingTradeItemWriter.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/ItemTrackingTradeItemWriter.java index ef0a3f4f4..7b287925e 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/ItemTrackingTradeItemWriter.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/domain/trade/internal/ItemTrackingTradeItemWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2022 the original author or authors. + * Copyright 2008-2023 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. @@ -29,7 +29,7 @@ import org.springframework.jdbc.core.JdbcTemplate; public class ItemTrackingTradeItemWriter implements ItemWriter { - private List items = new ArrayList<>(); + private final List items = new ArrayList<>(); private String writeFailureISIN; diff --git a/spring-batch-test/src/main/java/org/springframework/batch/test/JobLauncherTestUtils.java b/spring-batch-test/src/main/java/org/springframework/batch/test/JobLauncherTestUtils.java index 27a0aea8a..dbeb4dab2 100644 --- a/spring-batch-test/src/main/java/org/springframework/batch/test/JobLauncherTestUtils.java +++ b/spring-batch-test/src/main/java/org/springframework/batch/test/JobLauncherTestUtils.java @@ -69,7 +69,7 @@ import org.springframework.lang.Nullable; */ public class JobLauncherTestUtils { - private SecureRandom secureRandom = new SecureRandom(); + private final SecureRandom secureRandom = new SecureRandom(); /** Logger */ protected final Log logger = LogFactory.getLog(getClass()); diff --git a/spring-batch-test/src/main/java/org/springframework/batch/test/JobScopeTestExecutionListener.java b/spring-batch-test/src/main/java/org/springframework/batch/test/JobScopeTestExecutionListener.java index 0096d88cf..6fca83388 100644 --- a/spring-batch-test/src/main/java/org/springframework/batch/test/JobScopeTestExecutionListener.java +++ b/spring-batch-test/src/main/java/org/springframework/batch/test/JobScopeTestExecutionListener.java @@ -142,7 +142,7 @@ public class JobScopeTestExecutionListener implements TestExecutionListener { */ private static final class ExtractorMethodCallback implements MethodCallback { - private String preferredName; + private final String preferredName; private final Class preferredType; diff --git a/spring-batch-test/src/main/java/org/springframework/batch/test/StepRunner.java b/spring-batch-test/src/main/java/org/springframework/batch/test/StepRunner.java index 3badf0b32..57cc6bc6b 100755 --- a/spring-batch-test/src/main/java/org/springframework/batch/test/StepRunner.java +++ b/spring-batch-test/src/main/java/org/springframework/batch/test/StepRunner.java @@ -70,9 +70,9 @@ public class StepRunner { /** Logger */ protected final Log logger = LogFactory.getLog(getClass()); - private JobLauncher launcher; + private final JobLauncher launcher; - private JobRepository jobRepository; + private final JobRepository jobRepository; public StepRunner(JobLauncher launcher, JobRepository jobRepository) { this.launcher = launcher; diff --git a/spring-batch-test/src/main/java/org/springframework/batch/test/StepScopeTestExecutionListener.java b/spring-batch-test/src/main/java/org/springframework/batch/test/StepScopeTestExecutionListener.java index 8948ee440..865864761 100644 --- a/spring-batch-test/src/main/java/org/springframework/batch/test/StepScopeTestExecutionListener.java +++ b/spring-batch-test/src/main/java/org/springframework/batch/test/StepScopeTestExecutionListener.java @@ -145,7 +145,7 @@ public class StepScopeTestExecutionListener implements TestExecutionListener { */ private static final class ExtractorMethodCallback implements MethodCallback { - private String preferredName; + private final String preferredName; private final Class preferredType; diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/common/LogAdvice.java b/spring-batch-test/src/test/java/org/springframework/batch/test/common/LogAdvice.java index 6a3e37277..481d88d40 100755 --- a/spring-batch-test/src/test/java/org/springframework/batch/test/common/LogAdvice.java +++ b/spring-batch-test/src/test/java/org/springframework/batch/test/common/LogAdvice.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2023 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. @@ -25,10 +25,11 @@ import org.aspectj.lang.JoinPoint; * representation of the object to the log. * * @author Lucas Ward + * @author Mahmoud Ben Hassine */ public class LogAdvice { - private static Log log = LogFactory.getLog(LogAdvice.class); + private static final Log log = LogFactory.getLog(LogAdvice.class); /* * Wraps original method and adds logging both before and after method diff --git a/spring-batch-test/src/test/java/org/springframework/batch/test/jmx/SimpleMessageApplicationEvent.java b/spring-batch-test/src/test/java/org/springframework/batch/test/jmx/SimpleMessageApplicationEvent.java index 95eae5d0c..abce51907 100755 --- a/spring-batch-test/src/test/java/org/springframework/batch/test/jmx/SimpleMessageApplicationEvent.java +++ b/spring-batch-test/src/test/java/org/springframework/batch/test/jmx/SimpleMessageApplicationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2012 the original author or authors. + * Copyright 2008-2023 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. @@ -19,12 +19,13 @@ import org.springframework.context.ApplicationEvent; /** * @author Dave Syer + * @author Mahmoud Ben Hassine * */ @SuppressWarnings("serial") public class SimpleMessageApplicationEvent extends ApplicationEvent { - private String message; + private final String message; public SimpleMessageApplicationEvent(Object source, String message) { super(source);