fix build warnings
This commit is contained in:
@@ -51,7 +51,7 @@ public class DefaultBatchConfigurer implements BatchConfigurer {
|
||||
* values are passed are ignored (to prevent {@code}@Autowired{@code} from overwriting
|
||||
* the value).
|
||||
*
|
||||
* @param dataSource
|
||||
* @param dataSource The data source to use
|
||||
*/
|
||||
@Autowired(required = false)
|
||||
public void setDataSource(DataSource dataSource) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,7 +30,6 @@ import org.springframework.batch.core.repository.dao.JdbcStepExecutionDao;
|
||||
import org.springframework.batch.core.repository.dao.JobExecutionDao;
|
||||
import org.springframework.batch.core.repository.dao.JobInstanceDao;
|
||||
import org.springframework.batch.core.repository.dao.StepExecutionDao;
|
||||
import org.springframework.batch.core.repository.dao.XStreamExecutionContextStringSerializer;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
@@ -47,6 +46,7 @@ import org.springframework.util.Assert;
|
||||
* to describe what kind of database they are using.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 2.0
|
||||
*/
|
||||
public class JobExplorerFactoryBean extends AbstractJobExplorerFactoryBean
|
||||
@@ -71,7 +71,7 @@ implements InitializingBean {
|
||||
|
||||
/**
|
||||
* A custom implementation of the {@link ExecutionContextSerializer}.
|
||||
* The default, if not injected, is the {@link XStreamExecutionContextStringSerializer}.
|
||||
* The default, if not injected, is the {@link Jackson2ExecutionContextStringSerializer}.
|
||||
*
|
||||
* @param serializer used to serialize/deserialize an {@link org.springframework.batch.item.ExecutionContext}
|
||||
* @see ExecutionContextSerializer
|
||||
@@ -124,7 +124,7 @@ implements InitializingBean {
|
||||
Assert.notNull(dataSource, "DataSource must not be null.");
|
||||
|
||||
if (jdbcOperations == null) {
|
||||
jdbcOperations = new JdbcTemplate(dataSource);
|
||||
jdbcOperations = new JdbcTemplate(dataSource);
|
||||
}
|
||||
|
||||
if(serializer == null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
* Copyright 2013-2018 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.
|
||||
@@ -248,10 +248,10 @@ class SpringAutowiredAnnotationBeanPostProcessor extends InstantiationAwareBeanP
|
||||
if (requiredConstructor == null && defaultConstructor != null) {
|
||||
candidates.add(defaultConstructor);
|
||||
}
|
||||
candidateConstructors = candidates.toArray(new Constructor[candidates.size()]);
|
||||
candidateConstructors = candidates.toArray(new Constructor<?>[candidates.size()]);
|
||||
}
|
||||
else {
|
||||
candidateConstructors = new Constructor[0];
|
||||
candidateConstructors = new Constructor<?>[0];
|
||||
}
|
||||
this.candidateConstructorsCache.put(beanClass, candidateConstructors);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class RunIdIncrementer implements JobParametersIncrementer {
|
||||
|
||||
JobParameters params = (parameters == null) ? new JobParameters() : parameters;
|
||||
|
||||
long id = params.getLong(key, 0L) + 1;
|
||||
long id = params.getLong(key, new Long(0)) + 1;
|
||||
return new JobParametersBuilder(params).addLong(key, id).toJobParameters();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.partition.PartitionHandler;
|
||||
import org.springframework.batch.core.step.StepHolder;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Required;
|
||||
import org.springframework.core.task.SyncTaskExecutor;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.core.task.TaskRejectedException;
|
||||
@@ -55,6 +54,7 @@ public class TaskExecutorPartitionHandler extends AbstractPartitionHandler imple
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.state(step != null, "A Step must be provided.");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,7 +74,6 @@ public class TaskExecutorPartitionHandler extends AbstractPartitionHandler imple
|
||||
*
|
||||
* @param step the {@link Step} instance to use to execute business logic
|
||||
*/
|
||||
@Required
|
||||
public void setStep(Step step) {
|
||||
this.step = step;
|
||||
}
|
||||
|
||||
@@ -85,6 +85,8 @@ public class Jackson2ExecutionContextStringSerializer implements ExecutionContex
|
||||
*/
|
||||
private class JobParametersModule extends SimpleModule {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JobParametersModule() {
|
||||
super("Job parameters module");
|
||||
setMixInAnnotation(JobParameters.class, JobParametersMixIn.class);
|
||||
@@ -98,6 +100,7 @@ public class Jackson2ExecutionContextStringSerializer implements ExecutionContex
|
||||
|
||||
private class JobParameterDeserializer extends StdDeserializer<JobParameter> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String IDENTIFYING_KEY_NAME = "identifying";
|
||||
private static final String TYPE_KEY_NAME = "type";
|
||||
private static final String VALUE_KEY_NAME = "value";
|
||||
|
||||
@@ -76,6 +76,20 @@ public class TaskExecutorPartitionHandlerTests {
|
||||
handler.afterPropertiesSet();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfiguration() throws Exception {
|
||||
handler = new TaskExecutorPartitionHandler();
|
||||
try {
|
||||
handler.afterPropertiesSet();
|
||||
fail("Expected IllegalStateException when no step is set");
|
||||
}
|
||||
catch (IllegalStateException e) {
|
||||
// expected
|
||||
String message = e.getMessage();
|
||||
assertEquals("Wrong message: " + message, "A Step must be provided.", message);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullStep() throws Exception {
|
||||
handler = new TaskExecutorPartitionHandler();
|
||||
|
||||
@@ -28,6 +28,7 @@ public class XStreamExecutionContextStringSerializerTests extends AbstractExecut
|
||||
|
||||
@Before
|
||||
public void onSetUp() throws Exception {
|
||||
@SuppressWarnings("deprecation")
|
||||
XStreamExecutionContextStringSerializer serializerDeserializer = new XStreamExecutionContextStringSerializer();
|
||||
(serializerDeserializer).afterPropertiesSet();
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public class StepBuilderTests {
|
||||
StepExecution execution = jobRepository.createJobExecution("foo", new JobParameters()).createStepExecution("step");
|
||||
jobRepository.add(execution);
|
||||
PlatformTransactionManager transactionManager = new ResourcelessTransactionManager();
|
||||
SimpleStepBuilder builder = new StepBuilder("step")
|
||||
SimpleStepBuilder<Object, Object> builder = new StepBuilder("step")
|
||||
.repository(jobRepository)
|
||||
.transactionManager(transactionManager)
|
||||
.chunk(5)
|
||||
@@ -137,7 +137,7 @@ public class StepBuilderTests {
|
||||
StepExecution execution = jobRepository.createJobExecution("foo", new JobParameters()).createStepExecution("step");
|
||||
jobRepository.add(execution);
|
||||
PlatformTransactionManager transactionManager = new ResourcelessTransactionManager();
|
||||
SimpleStepBuilder builder = new StepBuilder("step")
|
||||
SimpleStepBuilder<Object, Object> builder = new StepBuilder("step")
|
||||
.repository(jobRepository)
|
||||
.transactionManager(transactionManager)
|
||||
.chunk(5)
|
||||
|
||||
Reference in New Issue
Block a user