From 52064c0541a5845aaf5640de69f601267cfa8317 Mon Sep 17 00:00:00 2001
From: Mahmoud Ben Hassine
Date: Wed, 12 Jul 2023 23:25:18 +0200
Subject: [PATCH] Code cleanup
- Inline variables
- Remove unused variables
- Remove redundant array creation
- Remove redundant `@SuppressWarnings`
- Remove unnecessary exceptions from throws list
- Remove redundant initializers
- Use List.subList().clear() where appropriate
- Use try-with-resources where needed
- Use pattern variables where appropriate
---
.../java/org/springframework/batch/core/Entity.java | 1 -
.../org/springframework/batch/core/ExitStatus.java | 2 +-
.../springframework/batch/core/JobExecution.java | 1 -
.../batch/core/JobExecutionException.java | 4 ++--
.../org/springframework/batch/core/JobInstance.java | 1 -
.../batch/core/JobInterruptedException.java | 4 ++--
.../springframework/batch/core/JobParameters.java | 4 +---
.../batch/core/JobParametersInvalidException.java | 4 ++--
.../batch/core/StartLimitExceededException.java | 3 +--
.../batch/core/StepContribution.java | 1 -
.../springframework/batch/core/StepExecution.java | 1 -
.../core/configuration/DuplicateJobException.java | 4 ++--
.../support/ApplicationContextJobFactory.java | 4 ++--
.../support/DefaultBatchConfiguration.java | 5 -----
.../configuration/support/DefaultJobLoader.java | 1 -
.../xml/StepParserStepFactoryBean.java | 1 -
.../core/job/builder/FlowBuilderException.java | 4 ++--
.../batch/core/job/builder/JobBuilderException.java | 4 ++--
.../batch/core/job/flow/FlowExecutionException.java | 4 ++--
.../core/launch/JobExecutionNotFailedException.java | 4 ++--
.../launch/JobExecutionNotRunningException.java | 4 ++--
.../launch/JobExecutionNotStoppedException.java | 4 ++--
.../launch/JobInstanceAlreadyExistsException.java | 4 ++--
.../core/launch/JobParametersNotFoundException.java | 4 ++--
.../batch/core/launch/NoSuchJobException.java | 4 ++--
.../core/launch/NoSuchJobExecutionException.java | 4 ++--
.../core/launch/NoSuchJobInstanceException.java | 4 ++--
.../core/launch/support/CommandLineJobRunner.java | 4 +---
.../batch/core/launch/support/RunIdIncrementer.java | 2 +-
.../core/listener/StepListenerFailedException.java | 4 ++--
.../JobExecutionAlreadyRunningException.java | 4 ++--
.../JobInstanceAlreadyCompleteException.java | 4 ++--
.../batch/core/repository/JobRestartException.java | 4 ++--
.../repository/dao/JdbcExecutionContextDao.java | 2 +-
.../core/repository/dao/JdbcJobExecutionDao.java | 5 ++---
.../core/repository/dao/JdbcJobInstanceDao.java | 11 +++--------
.../support/JobRepositoryFactoryBean.java | 6 ++----
.../repository/support/SimpleJobRepository.java | 4 +---
.../batch/core/scope/context/ChunkContext.java | 4 ++--
.../core/step/FatalStepExecutionException.java | 4 ++--
.../batch/core/step/NoSuchStepException.java | 4 ++--
.../step/builder/AbstractTaskletStepBuilder.java | 3 +--
.../core/step/builder/FaultTolerantStepBuilder.java | 2 --
.../core/step/builder/StepBuilderException.java | 4 ++--
.../core/step/factory/SimpleStepFactoryBean.java | 4 +---
.../batch/core/step/item/BatchRetryTemplate.java | 1 -
.../core/step/item/DefaultItemFailureHandler.java | 4 ++--
.../item/ForceRollbackForWriteSkipException.java | 4 ++--
.../batch/core/step/item/SimpleChunkProvider.java | 2 +-
.../batch/core/step/item/SkipOverflowException.java | 4 ++--
.../step/skip/ExceptionClassifierSkipPolicy.java | 6 ++----
.../step/skip/NonSkippableProcessException.java | 4 ++--
.../core/step/skip/NonSkippableReadException.java | 4 ++--
.../core/step/skip/NonSkippableWriteException.java | 4 ++--
.../batch/core/step/skip/SkipException.java | 4 ++--
.../core/step/skip/SkipLimitExceededException.java | 3 +--
.../core/step/skip/SkipListenerFailedException.java | 4 ++--
.../core/step/skip/SkipPolicyFailedException.java | 4 ++--
.../batch/core/step/tasklet/TaskletStep.java | 1 -
.../step/tasklet/UncheckedTransactionException.java | 4 ++--
.../batch/item/ExecutionContext.java | 4 +---
.../batch/item/ItemReaderException.java | 4 ++--
.../batch/item/ItemStreamException.java | 4 ++--
.../batch/item/ItemWriterException.java | 4 ++--
.../batch/item/NonTransientResourceException.java | 4 ++--
.../springframework/batch/item/ParseException.java | 4 ++--
.../batch/item/ReaderNotOpenException.java | 4 ++--
.../batch/item/UnexpectedInputException.java | 4 ++--
.../batch/item/WriteFailedException.java | 4 ++--
.../batch/item/WriterNotOpenException.java | 4 ++--
.../adapter/AbstractMethodInvokingDelegator.java | 3 +--
.../batch/item/data/RepositoryItemWriter.java | 2 +-
.../batch/item/database/JdbcCursorItemReader.java | 4 ++--
.../item/database/StoredProcedureItemReader.java | 2 +-
.../item/file/DefaultBufferedReaderFactory.java | 5 +++--
.../batch/item/file/FlatFileParseException.java | 1 -
.../item/file/NonTransientFlatFileException.java | 1 -
.../file/SimpleBinaryBufferedReaderFactory.java | 2 +-
.../separator/DefaultRecordSeparatorPolicy.java | 5 +++--
.../item/file/transform/AbstractLineTokenizer.java | 4 +---
.../item/file/transform/ConversionException.java | 4 ++--
.../file/transform/FlatFileFormatException.java | 4 ++--
.../transform/IncorrectLineLengthException.java | 1 -
.../transform/IncorrectTokenCountException.java | 1 -
.../batch/item/support/AbstractFileItemWriter.java | 7 +++----
.../AbstractItemCountingItemStreamItemReader.java | 2 +-
.../item/support/SingleItemPeekableItemReader.java | 8 ++++----
.../item/support/SynchronizedItemStreamReader.java | 3 +--
.../item/validator/BeanValidatingItemProcessor.java | 7 ++++---
.../batch/item/validator/ValidationException.java | 4 ++--
.../batch/item/xml/StaxEventItemReader.java | 2 +-
.../batch/item/xml/StaxEventItemWriter.java | 13 ++++++-------
.../item/xml/stax/DefaultFragmentEventReader.java | 7 ++++---
.../springframework/batch/poller/DirectPoller.java | 5 +++--
.../batch/repeat/RepeatException.java | 3 +--
.../interceptor/RepeatOperationsInterceptor.java | 1 -
.../support/DefaultPropertyEditorRegistrar.java | 2 +-
.../batch/support/MethodInvokerUtils.java | 5 ++---
.../support/transaction/FlushFailedException.java | 4 ++--
.../transaction/ResourcelessTransactionManager.java | 3 +--
.../batch/integration/async/AsyncItemProcessor.java | 3 +--
.../batch/test/JobScopeTestExecutionListener.java | 11 ++++-------
.../batch/test/StepScopeTestExecutionListener.java | 11 ++++-------
103 files changed, 169 insertions(+), 224 deletions(-)
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/Entity.java b/spring-batch-core/src/main/java/org/springframework/batch/core/Entity.java
index 5478765bc..6bcc5818a 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/Entity.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/Entity.java
@@ -30,7 +30,6 @@ import org.springframework.util.ClassUtils;
* @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class Entity implements Serializable {
private Long id;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/ExitStatus.java b/spring-batch-core/src/main/java/org/springframework/batch/core/ExitStatus.java
index 0464017b2..aa41a85c5 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/ExitStatus.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/ExitStatus.java
@@ -27,9 +27,9 @@ import java.io.StringWriter;
* {@code ExitStatus} is immutable and, therefore, thread-safe.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class ExitStatus implements Serializable, Comparable {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java
index fc2096e71..ee8873031 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java
@@ -41,7 +41,6 @@ import org.springframework.lang.Nullable;
* @author Taeik Lim
*
*/
-@SuppressWarnings("serial")
public class JobExecution extends Entity {
private final JobParameters jobParameters;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecutionException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecutionException.java
index 6f557ba90..f64cd022e 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecutionException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecutionException.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.
@@ -22,9 +22,9 @@ package org.springframework.batch.core;
* instructions and the data.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class JobExecutionException extends Exception {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobInstance.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobInstance.java
index 6fd343a4e..cecdc5481 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobInstance.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobInstance.java
@@ -37,7 +37,6 @@ import org.springframework.util.Assert;
* @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class JobInstance extends Entity {
private final String jobName;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobInterruptedException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobInterruptedException.java
index bec41fdb0..8ba4c7583 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobInterruptedException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobInterruptedException.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.
@@ -24,9 +24,9 @@ package org.springframework.batch.core;
*
* @author Lucas Ward
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class JobInterruptedException extends JobExecutionException {
private BatchStatus status = BatchStatus.STOPPED;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobParameters.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobParameters.java
index 44078f7db..be416811b 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobParameters.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobParameters.java
@@ -49,7 +49,6 @@ import org.springframework.util.Assert;
* @author Taeik Lim
* @since 1.0
*/
-@SuppressWarnings("serial")
public class JobParameters implements Serializable {
private final Map> parameters;
@@ -339,7 +338,7 @@ public class JobParameters implements Serializable {
@Override
public boolean equals(Object obj) {
- if (obj instanceof JobParameters == false) {
+ if (!(obj instanceof JobParameters rhs)) {
return false;
}
@@ -347,7 +346,6 @@ public class JobParameters implements Serializable {
return true;
}
- JobParameters rhs = (JobParameters) obj;
return this.parameters.equals(rhs.parameters);
}
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersInvalidException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersInvalidException.java
index 40c0f3a08..c769bda7c 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersInvalidException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersInvalidException.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.
@@ -19,9 +19,9 @@ package org.springframework.batch.core;
* Exception for {@link Job} to signal that some {@link JobParameters} are invalid.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class JobParametersInvalidException extends JobExecutionException {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/StartLimitExceededException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/StartLimitExceededException.java
index 7af4a41e9..46e658258 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/StartLimitExceededException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/StartLimitExceededException.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.
@@ -19,7 +19,6 @@ package org.springframework.batch.core;
/**
* Indicates the step's start limit has been exceeded.
*/
-@SuppressWarnings("serial")
public class StartLimitExceededException extends RuntimeException {
/**
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 d37c38d1d..2396e05d3 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
@@ -25,7 +25,6 @@ import java.io.Serializable;
* @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class StepContribution implements Serializable {
private volatile long readCount = 0;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/StepExecution.java b/spring-batch-core/src/main/java/org/springframework/batch/core/StepExecution.java
index 7c7039f97..8dbfb020e 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/StepExecution.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/StepExecution.java
@@ -38,7 +38,6 @@ import org.springframework.util.Assert;
* @author Taeik Lim
*
*/
-@SuppressWarnings("serial")
public class StepExecution extends Entity {
private final JobExecution jobExecution;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/DuplicateJobException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/DuplicateJobException.java
index 53d5642a5..72890dcaf 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/DuplicateJobException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/DuplicateJobException.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.
@@ -22,9 +22,9 @@ import org.springframework.batch.core.JobExecutionException;
* Checked exception that indicates a name clash when registering {@link Job} instances.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class DuplicateJobException extends JobExecutionException {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ApplicationContextJobFactory.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ApplicationContextJobFactory.java
index b066ed0dc..a60c6b961 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ApplicationContextJobFactory.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ApplicationContextJobFactory.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,6 +25,7 @@ import org.springframework.context.ConfigurableApplicationContext;
* out when asked to create a {@link Job}.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
public class ApplicationContextJobFactory implements JobFactory {
@@ -37,7 +38,6 @@ public class ApplicationContextJobFactory implements JobFactory {
* a job with the job name provided.
*/
public ApplicationContextJobFactory(String jobName, ApplicationContextFactory applicationContextFactory) {
- @SuppressWarnings("resource")
ConfigurableApplicationContext context = applicationContextFactory.createApplicationContext();
this.job = context.getBean(jobName, Job.class);
}
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultBatchConfiguration.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultBatchConfiguration.java
index 60a89dbf2..1f726c977 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultBatchConfiguration.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultBatchConfiguration.java
@@ -21,9 +21,6 @@ import java.sql.Types;
import javax.sql.DataSource;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.springframework.batch.core.configuration.BatchConfigurationException;
import org.springframework.batch.core.configuration.JobRegistry;
import org.springframework.batch.core.converter.DateToStringConverter;
@@ -114,8 +111,6 @@ import org.springframework.transaction.annotation.Isolation;
@Import(ScopeConfiguration.class)
public class DefaultBatchConfiguration implements ApplicationContextAware {
- private static final Log LOGGER = LogFactory.getLog(DefaultBatchConfiguration.class);
-
@Autowired
protected ApplicationContext applicationContext;
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 7350670d9..4dde8ea15 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
@@ -149,7 +149,6 @@ public class DefaultJobLoader implements JobLoader, InitializingBean {
return doLoad(factory, false);
}
- @SuppressWarnings("resource")
private Collection doLoad(ApplicationContextFactory factory, boolean unregister) throws DuplicateJobException {
Collection jobNamesBefore = jobRegistry.getJobNames();
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 c3d2a742b..5d80eebfd 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
@@ -465,7 +465,6 @@ public class StepParserStepFactoryBean implements FactoryBean, BeanN
* established for the factory bean.
* @param builder The {@link AbstractTaskletStepBuilder} to be modified.
*/
- @SuppressWarnings("serial")
protected void enhanceTaskletStepBuilder(AbstractTaskletStepBuilder> builder) {
enhanceCommonStep(builder);
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowBuilderException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowBuilderException.java
index 999ae7b1e..4e3b2d1f7 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowBuilderException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowBuilderException.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.
@@ -17,10 +17,10 @@ package org.springframework.batch.core.job.builder;
/**
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
* @since 2.2
*
*/
-@SuppressWarnings("serial")
public class FlowBuilderException extends RuntimeException {
public FlowBuilderException(String msg, Exception e) {
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/JobBuilderException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/JobBuilderException.java
index 751647c08..fe2f119e8 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/JobBuilderException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/JobBuilderException.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.
@@ -17,10 +17,10 @@ package org.springframework.batch.core.job.builder;
/**
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
* @since 2.2
*
*/
-@SuppressWarnings("serial")
public class JobBuilderException extends RuntimeException {
public JobBuilderException(Exception e) {
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowExecutionException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowExecutionException.java
index 6edbf43e7..b850044a3 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowExecutionException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowExecutionException.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.
@@ -17,9 +17,9 @@ package org.springframework.batch.core.job.flow;
/**
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class FlowExecutionException extends Exception {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotFailedException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotFailedException.java
index 29788479b..b76206d94 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotFailedException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotFailedException.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,9 +22,9 @@ import org.springframework.batch.core.JobExecutionException;
* actually it didn't fail.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class JobExecutionNotFailedException extends JobExecutionException {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotRunningException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotRunningException.java
index b94b47e70..d376735ee 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotRunningException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotRunningException.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,9 +22,9 @@ import org.springframework.batch.core.JobExecutionException;
* requested to stop.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
* @since 2.0
*/
-@SuppressWarnings("serial")
public class JobExecutionNotRunningException extends JobExecutionException {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotStoppedException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotStoppedException.java
index a0ab2ac31..11567df81 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotStoppedException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobExecutionNotStoppedException.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,9 +22,9 @@ import org.springframework.batch.core.JobExecutionException;
* hasn't been stopped.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class JobExecutionNotStoppedException extends JobExecutionException {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobInstanceAlreadyExistsException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobInstanceAlreadyExistsException.java
index f354e00dd..f99bc1972 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobInstanceAlreadyExistsException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobInstanceAlreadyExistsException.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,9 +22,9 @@ import org.springframework.batch.core.JobExecutionException;
* Checked exception to indicate that a required {@link Job} is not available.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class JobInstanceAlreadyExistsException extends JobExecutionException {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobParametersNotFoundException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobParametersNotFoundException.java
index 2f3f94cb9..8ff1f3663 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobParametersNotFoundException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobParametersNotFoundException.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.
@@ -23,9 +23,9 @@ import org.springframework.batch.core.JobParametersIncrementer;
* available.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class JobParametersNotFoundException extends JobExecutionException {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobException.java
index 12fad9a52..8131ecfa6 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobException.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,9 +22,9 @@ import org.springframework.batch.core.JobExecutionException;
* Checked exception to indicate that a required {@link Job} is not available.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class NoSuchJobException extends JobExecutionException {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobExecutionException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobExecutionException.java
index 855848573..7135d5cfe 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobExecutionException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobExecutionException.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,9 +22,9 @@ import org.springframework.batch.core.JobExecutionException;
* Checked exception to indicate that a required {@link JobExecution} is not available.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class NoSuchJobExecutionException extends JobExecutionException {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobInstanceException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobInstanceException.java
index 4841d38c4..1f6a48c9f 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobInstanceException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/NoSuchJobInstanceException.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.
@@ -23,9 +23,9 @@ import org.springframework.batch.core.JobInstance;
* {@link JobInstance}.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class NoSuchJobInstanceException extends JobExecutionException {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java
index e39ad413e..469ff1562 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java
@@ -192,8 +192,7 @@ public class CommandLineJobRunner {
private JobRepository jobRepository;
- private final static List VALID_OPTS = Arrays
- .asList(new String[] { "-restart", "-next", "-stop", "-abandon" });
+ private final static List VALID_OPTS = Arrays.asList("-restart", "-next", "-stop", "-abandon");
/**
* Injection setter for the {@link JobLauncher}.
@@ -284,7 +283,6 @@ public class CommandLineJobRunner {
* If a JobLocator has been set, then use it to obtain an actual job, if not ask the
* context for it.
*/
- @SuppressWarnings("resource")
int start(String jobPath, String jobIdentifier, String[] parameters, Set opts) {
ConfigurableApplicationContext context = null;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/RunIdIncrementer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/RunIdIncrementer.java
index 919ccb026..824aa1036 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/RunIdIncrementer.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/RunIdIncrementer.java
@@ -54,7 +54,7 @@ public class RunIdIncrementer implements JobParametersIncrementer {
public JobParameters getNext(@Nullable JobParameters parameters) {
JobParameters params = (parameters == null) ? new JobParameters() : parameters;
- JobParameter runIdParameter = params.getParameters().get(this.key);
+ JobParameter> runIdParameter = params.getParameters().get(this.key);
long id = 1;
if (runIdParameter != null) {
try {
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFailedException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFailedException.java
index df544d8d2..894cb57d6 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFailedException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFailedException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2012 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,9 +20,9 @@ package org.springframework.batch.core.listener;
*
* @author Dave Syer
* @author Michael Minella
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class StepListenerFailedException extends RuntimeException {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobExecutionAlreadyRunningException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobExecutionAlreadyRunningException.java
index ab1b6f091..a2f682896 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobExecutionAlreadyRunningException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobExecutionAlreadyRunningException.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.
@@ -19,9 +19,9 @@ import org.springframework.batch.core.JobExecutionException;
/**
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class JobExecutionAlreadyRunningException extends JobExecutionException {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobInstanceAlreadyCompleteException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobInstanceAlreadyCompleteException.java
index a735eec3c..577ae8ad1 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobInstanceAlreadyCompleteException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobInstanceAlreadyCompleteException.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,9 +22,9 @@ import org.springframework.batch.core.JobExecutionException;
* successfully.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class JobInstanceAlreadyCompleteException extends JobExecutionException {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRestartException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRestartException.java
index 07b7edbb9..4a33ee182 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRestartException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRestartException.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,9 +21,9 @@ import org.springframework.batch.core.JobExecutionException;
* An exception indicating an illegal attempt to restart a job.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class JobRestartException extends JobExecutionException {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDao.java
index 3276c46b5..d6fd74cde 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDao.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDao.java
@@ -350,7 +350,7 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
- String results = "";
+ String results;
try {
serializer.serialize(m, out);
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDao.java
index 4ba34678c..3c260dd43 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDao.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDao.java
@@ -354,9 +354,8 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
@Nullable
public JobExecution getJobExecution(Long executionId) {
try {
- JobExecution jobExecution = getJdbcTemplate().queryForObject(getQuery(GET_EXECUTION_BY_ID),
- new JobExecutionRowMapper(), executionId);
- return jobExecution;
+ return getJdbcTemplate().queryForObject(getQuery(GET_EXECUTION_BY_ID), new JobExecutionRowMapper(),
+ executionId);
}
catch (EmptyResultDataAccessException e) {
return null;
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 f4c28cb7a..256bf6c3f 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
@@ -253,9 +253,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
};
- List result = getJdbcTemplate().query(getQuery(FIND_LAST_JOBS_BY_NAME), extractor, jobName);
-
- return result;
+ return getJdbcTemplate().query(getQuery(FIND_LAST_JOBS_BY_NAME), extractor, jobName);
}
/*
@@ -369,8 +367,8 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
}
@Override
+ @SuppressWarnings({ "rawtypes", "unchecked" })
public List findJobInstancesByName(String jobName, final int start, final int count) {
- @SuppressWarnings("rawtypes")
ResultSetExtractor extractor = new ResultSetExtractor() {
private final List list = new ArrayList<>();
@@ -393,11 +391,8 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
jobName = jobName.replaceAll("\\" + STAR_WILDCARD, SQL_WILDCARD);
}
- @SuppressWarnings("unchecked")
- List result = (List) getJdbcTemplate().query(getQuery(FIND_LAST_JOBS_LIKE_NAME),
- extractor, jobName);
+ return (List) getJdbcTemplate().query(getQuery(FIND_LAST_JOBS_LIKE_NAME), extractor, jobName);
- return result;
}
}
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBean.java
index 83e18b1f4..a90290e84 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBean.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBean.java
@@ -230,9 +230,7 @@ public class JobRepositoryFactoryBean extends AbstractJobRepositoryFactoryBean i
}
if (serializer == null) {
- DefaultExecutionContextSerializer defaultSerializer = new DefaultExecutionContextSerializer();
-
- serializer = defaultSerializer;
+ serializer = new DefaultExecutionContextSerializer();
}
Assert.state(incrementerFactory.isSupportedIncrementerType(databaseType),
@@ -315,7 +313,7 @@ public class JobRepositoryFactoryBean extends AbstractJobRepositoryFactoryBean i
return dao;
}
- private int determineClobTypeToUse(String databaseType) throws Exception {
+ private int determineClobTypeToUse(String databaseType) {
if (clobType != null) {
return clobType;
}
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java
index 20eaacafe..cabece4e0 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java
@@ -341,9 +341,7 @@ public class SimpleJobRepository implements JobRepository {
Assert.notNull(jobName, "A job name is required to create a JobInstance");
Assert.notNull(jobParameters, "Job parameters are required to create a JobInstance");
- JobInstance jobInstance = jobInstanceDao.createJobInstance(jobName, jobParameters);
-
- return jobInstance;
+ return jobInstanceDao.createJobInstance(jobName, jobParameters);
}
}
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/ChunkContext.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/ChunkContext.java
index 23ca8f5e2..5a263ae3b 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/ChunkContext.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/ChunkContext.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.
@@ -26,9 +26,9 @@ import org.springframework.core.AttributeAccessorSupport;
* chunk is retried the same context will be associated with it.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class ChunkContext extends AttributeAccessorSupport {
private final StepContext stepContext;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/FatalStepExecutionException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/FatalStepExecutionException.java
index 1b5358bbc..2b40a9bde 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/FatalStepExecutionException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/FatalStepExecutionException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2010 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.
@@ -19,9 +19,9 @@ import org.springframework.batch.core.UnexpectedJobExecutionException;
/**
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class FatalStepExecutionException extends UnexpectedJobExecutionException {
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/NoSuchStepException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/NoSuchStepException.java
index ae972d1d3..6b6996156 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/NoSuchStepException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/NoSuchStepException.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.
@@ -19,9 +19,9 @@ package org.springframework.batch.core.step;
* Exception to signal that a step was requested that is unknown or does not exist.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
-@SuppressWarnings("serial")
public class NoSuchStepException extends RuntimeException {
/**
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 8ab4fb2a1..95de16d93 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
@@ -276,8 +276,7 @@ public abstract class AbstractTaskletStepBuilder extends SimpleStepBuilder {
}
- @SuppressWarnings("serial")
private TransactionAttribute getTransactionAttribute(TransactionAttribute attribute) {
final Classifier classifier = getRollbackClassifier();
@@ -738,7 +737,6 @@ public class FaultTolerantStepBuilder extends SimpleStepBuilder {
return chunkListener.hashCode();
}
- @SuppressWarnings("unchecked")
@Override
public boolean equals(Object obj) {
if (obj instanceof FaultTolerantStepBuilder.TerminateOnExceptionChunkListenerDelegate) {
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/StepBuilderException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/StepBuilderException.java
index 34896178c..540c8970a 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/StepBuilderException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/StepBuilderException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2011 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.
@@ -19,9 +19,9 @@ package org.springframework.batch.core.step.builder;
* Utility exception thrown by builders when they encounter unexpected checked exceptions.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
* @since 2.2
*/
-@SuppressWarnings("serial")
public class StepBuilderException extends RuntimeException {
public StepBuilderException(Exception e) {
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/factory/SimpleStepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/factory/SimpleStepFactoryBean.java
index a91546229..c2afcf40e 100755
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/factory/SimpleStepFactoryBean.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/factory/SimpleStepFactoryBean.java
@@ -294,7 +294,6 @@ public class SimpleStepFactoryBean implements FactoryBean, BeanNameA
* Getter for the {@link TransactionAttribute} for subclasses only.
* @return the transactionAttribute
*/
- @SuppressWarnings("serial")
protected TransactionAttribute getTransactionAttribute() {
DefaultTransactionAttribute attribute = new DefaultTransactionAttribute();
@@ -326,8 +325,7 @@ public class SimpleStepFactoryBean implements FactoryBean, BeanNameA
public final Step getObject() throws Exception {
SimpleStepBuilder builder = createBuilder(getName());
applyConfiguration(builder);
- TaskletStep step = builder.build();
- return step;
+ return builder.build();
}
protected SimpleStepBuilder createBuilder(String name) {
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/BatchRetryTemplate.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/BatchRetryTemplate.java
index 10a73504c..4d16fbf66 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/BatchRetryTemplate.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/BatchRetryTemplate.java
@@ -68,7 +68,6 @@ public class BatchRetryTemplate implements RetryOperations {
}
- @SuppressWarnings("serial")
private static class BatchRetryContext extends RetryContextSupport {
private final Collection contexts;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/DefaultItemFailureHandler.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/DefaultItemFailureHandler.java
index 9f1515214..e51403aeb 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/DefaultItemFailureHandler.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/DefaultItemFailureHandler.java
@@ -41,7 +41,7 @@ public class DefaultItemFailureHandler extends ItemListenerSupport
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
public class SingleItemPeekableItemReader implements ItemStreamReader, PeekableItemReader {
@@ -67,11 +68,10 @@ public class SingleItemPeekableItemReader implements ItemStreamReader, Pee
*/
@Nullable
@Override
- public T read() throws Exception, UnexpectedInputException, ParseException {
+ public T read() throws Exception {
if (next != null) {
T item = next;
next = null;
- // executionContext = new ExecutionContext();
return item;
}
return delegate.read();
@@ -86,7 +86,7 @@ public class SingleItemPeekableItemReader implements ItemStreamReader, Pee
*/
@Nullable
@Override
- public T peek() throws Exception, UnexpectedInputException, ParseException {
+ public T peek() throws Exception {
if (next == null) {
updateDelegate(executionContext);
next = delegate.read();
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/SynchronizedItemStreamReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/SynchronizedItemStreamReader.java
index 61de9f70b..1b33e9d3c 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/SynchronizedItemStreamReader.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/SynchronizedItemStreamReader.java
@@ -50,8 +50,7 @@ public class SynchronizedItemStreamReader implements ItemStreamReader, Ini
* This delegates to the read method of the delegate
*/
@Nullable
- public synchronized T read()
- throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {
+ public synchronized T read() throws Exception {
return this.delegate.read();
}
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 ccb9f05b5..2faf65f68 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
@@ -39,9 +39,10 @@ public class BeanValidatingItemProcessor extends ValidatingItemProcessor {
* configuration.
*/
public BeanValidatingItemProcessor() {
- LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
- localValidatorFactoryBean.afterPropertiesSet();
- this.validator = localValidatorFactoryBean.getValidator();
+ try (LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean()) {
+ localValidatorFactoryBean.afterPropertiesSet();
+ this.validator = localValidatorFactoryBean.getValidator();
+ }
}
/**
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/validator/ValidationException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/validator/ValidationException.java
index 1e0d19387..c7467c612 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/validator/ValidationException.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/validator/ValidationException.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,8 +22,8 @@ import org.springframework.batch.item.ItemReaderException;
* This exception should be thrown when there are validation errors.
*
* @author Ben Hale
+ * @author Mahmoud Ben Hassine
*/
-@SuppressWarnings("serial")
public class ValidationException extends ItemReaderException {
/**
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemReader.java
index 2a70c39d4..13f245498 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemReader.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemReader.java
@@ -259,7 +259,7 @@ public class StaxEventItemReader extends AbstractItemCountingItemStreamItemRe
T item = null;
- boolean success = false;
+ boolean success;
try {
success = moveCursorToNextFragment(fragmentReader);
}
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemWriter.java
index 86df8cf35..fef239f80 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemWriter.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemWriter.java
@@ -445,8 +445,8 @@ public class StaxEventItemWriter extends AbstractItemStreamItemWriter
private void open(long position) {
File file;
- FileOutputStream os = null;
- FileChannel fileChannel = null;
+ FileOutputStream os;
+ FileChannel fileChannel;
try {
file = resource.getFile();
@@ -479,9 +479,9 @@ public class StaxEventItemWriter extends AbstractItemStreamItemWriter
}
try {
- final FileChannel channel = fileChannel;
if (transactional) {
- TransactionAwareBufferedWriter writer = new TransactionAwareBufferedWriter(channel, this::closeStream);
+ TransactionAwareBufferedWriter writer = new TransactionAwareBufferedWriter(fileChannel,
+ this::closeStream);
writer.setEncoding(encoding);
writer.setForceSync(forceSync);
@@ -496,7 +496,7 @@ public class StaxEventItemWriter extends AbstractItemStreamItemWriter
if (!restarted) {
startDocument(delegateEventWriter);
if (forceSync) {
- channel.force(false);
+ fileChannel.force(false);
}
}
}
@@ -539,8 +539,7 @@ public class StaxEventItemWriter extends AbstractItemStreamItemWriter
* loaded.
*/
protected XMLEventFactory createXmlEventFactory() throws FactoryConfigurationError {
- XMLEventFactory factory = XMLEventFactory.newInstance();
- return factory;
+ return XMLEventFactory.newInstance();
}
/**
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/stax/DefaultFragmentEventReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/stax/DefaultFragmentEventReader.java
index d7c75784b..e13475941 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/stax/DefaultFragmentEventReader.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/stax/DefaultFragmentEventReader.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.
@@ -34,6 +34,7 @@ import org.springframework.batch.item.ItemStreamException;
* Default implementation of {@link FragmentEventReader}
*
* @author Robert Kasanicky
+ * @author Mahmoud Ben Hassine
*/
public class DefaultFragmentEventReader extends AbstractEventReaderWrapper implements FragmentEventReader {
@@ -49,9 +50,9 @@ public class DefaultFragmentEventReader extends AbstractEventReaderWrapper imple
// true when reader should behave like the cursor was at the end of document
private boolean fakeDocumentEnd = false;
- private StartDocument startDocumentEvent = null;
+ private final StartDocument startDocumentEvent;
- private EndDocument endDocumentEvent = null;
+ private final EndDocument endDocumentEvent;
// fragment root name is remembered so that the matching closing element can
// be identified
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/poller/DirectPoller.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/poller/DirectPoller.java
index bd214a22b..ace3a2476 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/poller/DirectPoller.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/poller/DirectPoller.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2010 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,6 +28,7 @@ import java.util.concurrent.TimeoutException;
* background thread to do the polling).
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
* @param the type of the result
*/
public class DirectPoller implements Poller {
@@ -93,7 +94,7 @@ public class DirectPoller implements Poller {
throw new ExecutionException(e);
}
- Long nextExecutionTime = startTime + interval;
+ long nextExecutionTime = startTime + interval;
long currentTimeMillis = System.currentTimeMillis();
long timeoutMillis = TimeUnit.MILLISECONDS.convert(timeout, unit);
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/RepeatException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/RepeatException.java
index 6fc4a564d..a586d03dc 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/RepeatException.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/RepeatException.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.
@@ -18,7 +18,6 @@ package org.springframework.batch.repeat;
import org.springframework.core.NestedRuntimeException;
-@SuppressWarnings("serial")
public class RepeatException extends NestedRuntimeException {
public RepeatException(String msg) {
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/RepeatOperationsInterceptor.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/RepeatOperationsInterceptor.java
index 805e7555c..b390e7b3f 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/RepeatOperationsInterceptor.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/RepeatOperationsInterceptor.java
@@ -132,7 +132,6 @@ public class RepeatOperationsInterceptor implements MethodInterceptor {
* @author Dave Syer
*
*/
- @SuppressWarnings("serial")
private static class RepeatOperationsInterceptorException extends RepeatException {
public RepeatOperationsInterceptorException(String message, Throwable e) {
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/DefaultPropertyEditorRegistrar.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/DefaultPropertyEditorRegistrar.java
index 40fb2a92e..68e6d7f6f 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/DefaultPropertyEditorRegistrar.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/DefaultPropertyEditorRegistrar.java
@@ -64,7 +64,7 @@ public class DefaultPropertyEditorRegistrar implements PropertyEditorRegistrar {
this.customEditors = new HashMap<>();
for (Entry, ? extends PropertyEditor> entry : customEditors.entrySet()) {
Object key = entry.getKey();
- Class> requiredType = null;
+ Class> requiredType;
if (key instanceof Class>) {
requiredType = (Class>) key;
}
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/MethodInvokerUtils.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/MethodInvokerUtils.java
index dc45b17e5..3d26d717b 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/MethodInvokerUtils.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/MethodInvokerUtils.java
@@ -33,6 +33,7 @@ import org.springframework.util.ReflectionUtils;
* Utility methods for create MethodInvoker instances.
*
* @author Lucas Ward
+ * @author Mahmoud Ben Hassine
* @since 2.0
*/
public class MethodInvokerUtils {
@@ -179,11 +180,9 @@ public class MethodInvokerUtils {
/**
* Create a {@link MethodInvoker} for the delegate from a single public method.
* @param target an object to search for an appropriate method.
- * @param the class.
- * @param the type.
* @return a {@link MethodInvoker} that calls a method on the delegate.
*/
- public static MethodInvoker getMethodInvokerForSingleArgument(Object target) {
+ public static MethodInvoker getMethodInvokerForSingleArgument(Object target) {
final AtomicReference methodHolder = new AtomicReference<>();
ReflectionUtils.doWithMethods(target.getClass(), method -> {
if (method.getParameterTypes() == null || method.getParameterTypes().length != 1) {
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/FlushFailedException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/FlushFailedException.java
index 6ad68df1e..8352ec410 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/FlushFailedException.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/FlushFailedException.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.
@@ -21,8 +21,8 @@ package org.springframework.batch.support.transaction;
*
* @author Lucas Ward
* @author Ben Hale
+ * @author Mahmoud Ben Hassine
*/
-@SuppressWarnings("serial")
public class FlushFailedException extends RuntimeException {
/**
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/ResourcelessTransactionManager.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/ResourcelessTransactionManager.java
index d3516eb94..9675f54a3 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/ResourcelessTransactionManager.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/ResourcelessTransactionManager.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,7 +25,6 @@ import org.springframework.transaction.support.AbstractPlatformTransactionManage
import org.springframework.transaction.support.DefaultTransactionStatus;
import org.springframework.transaction.support.TransactionSynchronizationManager;
-@SuppressWarnings("serial")
public class ResourcelessTransactionManager extends AbstractPlatformTransactionManager {
@Override
diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/async/AsyncItemProcessor.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/async/AsyncItemProcessor.java
index 1c30ab3b9..4c737c637 100644
--- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/async/AsyncItemProcessor.java
+++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/async/AsyncItemProcessor.java
@@ -115,8 +115,7 @@ public class AsyncItemProcessor implements ItemProcessor>, In
if (context == null) {
return null;
}
- StepExecution stepExecution = context.getStepExecution();
- return stepExecution;
+ return context.getStepExecution();
}
}
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 6fca83388..249fb8636 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
@@ -70,11 +70,10 @@ public class JobScopeTestExecutionListener implements TestExecutionListener {
/**
* Set up a {@link JobExecution} as a test context attribute.
* @param testContext the current test context
- * @throws Exception if there is a problem
* @see TestExecutionListener#prepareTestInstance(TestContext)
*/
@Override
- public void prepareTestInstance(TestContext testContext) throws Exception {
+ public void prepareTestInstance(TestContext testContext) {
JobExecution jobExecution = getJobExecution(testContext);
if (jobExecution != null) {
testContext.setAttribute(JOB_EXECUTION, jobExecution);
@@ -83,11 +82,10 @@ public class JobScopeTestExecutionListener implements TestExecutionListener {
/**
* @param testContext the current test context
- * @throws Exception if there is a problem
* @see TestExecutionListener#beforeTestMethod(TestContext)
*/
@Override
- public void beforeTestMethod(org.springframework.test.context.TestContext testContext) throws Exception {
+ public void beforeTestMethod(org.springframework.test.context.TestContext testContext) {
if (testContext.hasAttribute(JOB_EXECUTION)) {
JobExecution jobExecution = (JobExecution) testContext.getAttribute(JOB_EXECUTION);
JobSynchronizationManager.register(jobExecution);
@@ -97,11 +95,10 @@ public class JobScopeTestExecutionListener implements TestExecutionListener {
/**
* @param testContext the current test context
- * @throws Exception if there is a problem
* @see TestExecutionListener#afterTestMethod(TestContext)
*/
@Override
- public void afterTestMethod(TestContext testContext) throws Exception {
+ public void afterTestMethod(TestContext testContext) {
if (testContext.hasAttribute(JOB_EXECUTION)) {
JobSynchronizationManager.close();
}
@@ -159,7 +156,7 @@ public class JobScopeTestExecutionListener implements TestExecutionListener {
}
@Override
- public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
+ public void doWith(Method method) throws IllegalArgumentException {
Class> type = method.getReturnType();
if (preferredType.isAssignableFrom(type)) {
if (result == null || method.getName().equals(preferredName)) {
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 865864761..1deea865b 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
@@ -71,11 +71,10 @@ public class StepScopeTestExecutionListener implements TestExecutionListener {
/**
* Set up a {@link StepExecution} as a test context attribute.
* @param testContext the current test context
- * @throws Exception if there is a problem
* @see TestExecutionListener#prepareTestInstance(TestContext)
*/
@Override
- public void prepareTestInstance(TestContext testContext) throws Exception {
+ public void prepareTestInstance(TestContext testContext) {
StepExecution stepExecution = getStepExecution(testContext);
if (stepExecution != null) {
@@ -85,11 +84,10 @@ public class StepScopeTestExecutionListener implements TestExecutionListener {
/**
* @param testContext the current test context
- * @throws Exception if there is a problem
* @see TestExecutionListener#beforeTestMethod(TestContext)
*/
@Override
- public void beforeTestMethod(TestContext testContext) throws Exception {
+ public void beforeTestMethod(TestContext testContext) {
if (testContext.hasAttribute(STEP_EXECUTION)) {
StepExecution stepExecution = (StepExecution) testContext.getAttribute(STEP_EXECUTION);
@@ -100,11 +98,10 @@ public class StepScopeTestExecutionListener implements TestExecutionListener {
/**
* @param testContext the current test context
- * @throws Exception if there is a problem
* @see TestExecutionListener#afterTestMethod(TestContext)
*/
@Override
- public void afterTestMethod(TestContext testContext) throws Exception {
+ public void afterTestMethod(TestContext testContext) {
if (testContext.hasAttribute(STEP_EXECUTION)) {
StepSynchronizationManager.close();
@@ -162,7 +159,7 @@ public class StepScopeTestExecutionListener implements TestExecutionListener {
}
@Override
- public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
+ public void doWith(Method method) throws IllegalArgumentException {
Class> type = method.getReturnType();
if (preferredType.isAssignableFrom(type)) {
if (result == null || method.getName().equals(preferredName)) {