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
This commit is contained in:
@@ -30,7 +30,6 @@ import org.springframework.util.ClassUtils;
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class Entity implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
@@ -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<ExitStatus> {
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,7 +41,6 @@ import org.springframework.lang.Nullable;
|
||||
* @author Taeik Lim
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class JobExecution extends Entity {
|
||||
|
||||
private final JobParameters jobParameters;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,7 +37,6 @@ import org.springframework.util.Assert;
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class JobInstance extends Entity {
|
||||
|
||||
private final String jobName;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<String, JobParameter<?>> 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.io.Serializable;
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class StepContribution implements Serializable {
|
||||
|
||||
private volatile long readCount = 0;
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.springframework.util.Assert;
|
||||
* @author Taeik Lim
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class StepExecution extends Entity {
|
||||
|
||||
private final JobExecution jobExecution;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -149,7 +149,6 @@ public class DefaultJobLoader implements JobLoader, InitializingBean {
|
||||
return doLoad(factory, false);
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
private Collection<Job> doLoad(ApplicationContextFactory factory, boolean unregister) throws DuplicateJobException {
|
||||
|
||||
Collection<String> jobNamesBefore = jobRegistry.getJobNames();
|
||||
|
||||
@@ -465,7 +465,6 @@ public class StepParserStepFactoryBean<I, O> implements FactoryBean<Step>, BeanN
|
||||
* established for the factory bean.
|
||||
* @param builder The {@link AbstractTaskletStepBuilder} to be modified.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
protected void enhanceTaskletStepBuilder(AbstractTaskletStepBuilder<?> builder) {
|
||||
|
||||
enhanceCommonStep(builder);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -192,8 +192,7 @@ public class CommandLineJobRunner {
|
||||
|
||||
private JobRepository jobRepository;
|
||||
|
||||
private final static List<String> VALID_OPTS = Arrays
|
||||
.asList(new String[] { "-restart", "-next", "-stop", "-abandon" });
|
||||
private final static List<String> 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<String> opts) {
|
||||
|
||||
ConfigurableApplicationContext context = null;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -350,7 +350,7 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem
|
||||
}
|
||||
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
String results = "";
|
||||
String results;
|
||||
|
||||
try {
|
||||
serializer.serialize(m, out);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -253,9 +253,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
|
||||
|
||||
};
|
||||
|
||||
List<JobInstance> 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<JobInstance> findJobInstancesByName(String jobName, final int start, final int count) {
|
||||
@SuppressWarnings("rawtypes")
|
||||
ResultSetExtractor extractor = new ResultSetExtractor() {
|
||||
private final List<JobInstance> list = new ArrayList<>();
|
||||
|
||||
@@ -393,11 +391,8 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
|
||||
jobName = jobName.replaceAll("\\" + STAR_WILDCARD, SQL_WILDCARD);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<JobInstance> result = (List<JobInstance>) getJdbcTemplate().query(getQuery(FIND_LAST_JOBS_LIKE_NAME),
|
||||
extractor, jobName);
|
||||
return (List<JobInstance>) getJdbcTemplate().query(getQuery(FIND_LAST_JOBS_LIKE_NAME), extractor, jobName);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -276,8 +276,7 @@ public abstract class AbstractTaskletStepBuilder<B extends AbstractTaskletStepBu
|
||||
* @return true if the tasklet is going to be run in multiple threads
|
||||
*/
|
||||
protected boolean concurrent() {
|
||||
boolean concurrent = taskExecutor != null && !(taskExecutor instanceof SyncTaskExecutor);
|
||||
return concurrent;
|
||||
return taskExecutor != null && !(taskExecutor instanceof SyncTaskExecutor);
|
||||
}
|
||||
|
||||
protected TaskExecutor getTaskExecutor() {
|
||||
|
||||
@@ -535,7 +535,6 @@ public class FaultTolerantStepBuilder<I, O> extends SimpleStepBuilder<I, O> {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private TransactionAttribute getTransactionAttribute(TransactionAttribute attribute) {
|
||||
|
||||
final Classifier<Throwable, Boolean> classifier = getRollbackClassifier();
|
||||
@@ -738,7 +737,6 @@ public class FaultTolerantStepBuilder<I, O> extends SimpleStepBuilder<I, O> {
|
||||
return chunkListener.hashCode();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof FaultTolerantStepBuilder.TerminateOnExceptionChunkListenerDelegate) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -294,7 +294,6 @@ public class SimpleStepFactoryBean<T, S> implements FactoryBean<Step>, 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<T, S> implements FactoryBean<Step>, BeanNameA
|
||||
public final Step getObject() throws Exception {
|
||||
SimpleStepBuilder<T, S> builder = createBuilder(getName());
|
||||
applyConfiguration(builder);
|
||||
TaskletStep step = builder.build();
|
||||
return step;
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
protected SimpleStepBuilder<T, S> createBuilder(String name) {
|
||||
|
||||
@@ -68,7 +68,6 @@ public class BatchRetryTemplate implements RetryOperations {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class BatchRetryContext extends RetryContextSupport {
|
||||
|
||||
private final Collection<RetryContext> contexts;
|
||||
|
||||
@@ -41,7 +41,7 @@ public class DefaultItemFailureHandler extends ItemListenerSupport<Object, Objec
|
||||
logger.error("Error encountered while reading", ex);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
logger.error("Invalid type for logging: [" + exception.toString() + "]");
|
||||
logger.error("Invalid type for logging: [" + exception + "]");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class DefaultItemFailureHandler extends ItemListenerSupport<Object, Objec
|
||||
logger.error("Error encountered while writing item: [ " + item + "]", ex);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
logger.error("Invalid type for logging: [" + exception.toString() + "]");
|
||||
logger.error("Invalid type for logging: [" + exception + "]");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 @@ package org.springframework.batch.core.step.item;
|
||||
* an exception that otherwise would not cause a rollback.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ForceRollbackForWriteSkipException extends RuntimeException {
|
||||
|
||||
public ForceRollbackForWriteSkipException(String msg, Throwable cause) {
|
||||
|
||||
@@ -125,7 +125,7 @@ public class SimpleChunkProvider<I> implements ChunkProvider<I> {
|
||||
|
||||
final Chunk<I> inputs = new Chunk<>();
|
||||
repeatOperations.iterate(context -> {
|
||||
I item = null;
|
||||
I item;
|
||||
Timer.Sample sample = Timer.start(Metrics.globalRegistry);
|
||||
String status = BatchMetrics.STATUS_SUCCESS;
|
||||
try {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2009 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 @@ import org.springframework.batch.core.step.skip.SkipException;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class SkipOverflowException extends SkipException {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -49,9 +49,7 @@ public class ExceptionClassifierSkipPolicy implements SkipPolicy {
|
||||
* a {@link Classifier} to locate a policy.
|
||||
*/
|
||||
public void setPolicyMap(Map<Class<? extends Throwable>, SkipPolicy> policyMap) {
|
||||
SubclassClassifier<Throwable, SkipPolicy> subclassClassifier = new SubclassClassifier<>(policyMap,
|
||||
new NeverSkipItemSkipPolicy());
|
||||
this.classifier = subclassClassifier;
|
||||
this.classifier = new SubclassClassifier<>(policyMap, new NeverSkipItemSkipPolicy());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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,9 +20,9 @@ package org.springframework.batch.core.step.skip;
|
||||
* Fatal exception to be thrown when a process operation could not be skipped.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class NonSkippableProcessException extends SkipException {
|
||||
|
||||
public NonSkippableProcessException(String msg, Throwable cause) {
|
||||
|
||||
@@ -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,9 +20,9 @@ package org.springframework.batch.core.step.skip;
|
||||
* Fatal exception to be thrown when a read operation could not be skipped.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class NonSkippableReadException extends SkipException {
|
||||
|
||||
public NonSkippableReadException(String msg, Throwable cause) {
|
||||
|
||||
@@ -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,9 +20,9 @@ package org.springframework.batch.core.step.skip;
|
||||
* Fatal exception to be thrown when a process operation could not be skipped.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class NonSkippableWriteException extends SkipException {
|
||||
|
||||
public NonSkippableWriteException(String msg, Throwable cause) {
|
||||
|
||||
@@ -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,8 +21,8 @@ import org.springframework.batch.core.UnexpectedJobExecutionException;
|
||||
* Base exception indicating that the skip has failed or caused a failure.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public abstract class SkipException extends UnexpectedJobExecutionException {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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,7 +24,6 @@ package org.springframework.batch.core.step.skip;
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class SkipLimitExceededException extends SkipException {
|
||||
|
||||
private final long skipLimit;
|
||||
|
||||
@@ -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.UnexpectedJobExecutionException;
|
||||
* treatment in the framework in case a skip sends itself into an infinite loop.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class SkipListenerFailedException extends UnexpectedJobExecutionException {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.UnexpectedJobExecutionException;
|
||||
* in the framework in case a skip sends itself into an infinite loop.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class SkipPolicyFailedException extends UnexpectedJobExecutionException {
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,7 +72,6 @@ import java.util.concurrent.Semaphore;
|
||||
* @author Will Schipp
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class TaskletStep extends AbstractStep {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(TaskletStep.class);
|
||||
|
||||
@@ -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.
|
||||
@@ -20,9 +20,9 @@ package org.springframework.batch.core.step.tasklet;
|
||||
* extracted afterwards.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class UncheckedTransactionException extends RuntimeException {
|
||||
|
||||
public UncheckedTransactionException(Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user