diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/util/SimpleMethodInvoker.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/util/SimpleMethodInvoker.java index 8086278cd..7c873d315 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/util/SimpleMethodInvoker.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/util/SimpleMethodInvoker.java @@ -32,6 +32,7 @@ package org.springframework.batch.core.configuration.util; import java.lang.reflect.Method; +import java.util.Arrays; import org.apache.commons.lang.builder.HashCodeBuilder; import org.springframework.util.Assert; @@ -67,7 +68,7 @@ public class SimpleMethodInvoker implements MethodInvoker { } if(this.method == null){ throw new IllegalArgumentException("No methods found for name: [" + methodName + "] in class: [" + - object.getClass() + "] with arguments of type: [" + paramTypes + "]"); + object.getClass() + "] with arguments of type: [" + Arrays.toString(paramTypes) + "]"); } } @@ -94,7 +95,7 @@ public class SimpleMethodInvoker implements MethodInvoker { return method.invoke(object, invokeArgs); } catch (Exception e) { throw new IllegalArgumentException("Unable to invoke method: [" + method + "] on object: [" + - object + "] with arguments: [" + args + "]"); + object + "] with arguments: [" + Arrays.toString(args) + "]"); } } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/converter/DefaultJobParametersConverter.java b/spring-batch-core/src/main/java/org/springframework/batch/core/converter/DefaultJobParametersConverter.java index cc75bd907..9b1cb6094 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/converter/DefaultJobParametersConverter.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/converter/DefaultJobParametersConverter.java @@ -121,7 +121,7 @@ public class DefaultJobParametersConverter implements JobParametersConverter { propertiesBuilder.addString(StringUtils.replace(key, STRING_TYPE, ""), value); } else { - propertiesBuilder.addString(key, value.toString()); + propertiesBuilder.addString(key, value); } } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunner.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunner.java index cc466a38a..35e8897fe 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunner.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunner.java @@ -118,7 +118,7 @@ public class JobRegistryBackgroundJobRunner { for (int j = 0; j < resources.length; j++) { Resource path = resources[j]; - logger.info("Registering Job definitions from " + resources); + logger.info("Registering Job definitions from " + Arrays.toString(resources)); ConfigurableListableBeanFactory beanFactory = new XmlBeanFactory(path, parentContext .getAutowireCapableBeanFactory()); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/SimpleStepExecutionSplitter.java b/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/SimpleStepExecutionSplitter.java index 7afafa9eb..25492a205 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/SimpleStepExecutionSplitter.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/SimpleStepExecutionSplitter.java @@ -3,6 +3,7 @@ package org.springframework.batch.core.partition.support; import java.util.HashSet; import java.util.Map; import java.util.Set; +import java.util.Map.Entry; import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.JobExecution; @@ -80,14 +81,14 @@ public class SimpleStepExecutionSplitter implements StepExecutionSplitter { Map contexts = partitioner.partition(splitSize); Set set = new HashSet(contexts.size()); - for (String key : contexts.keySet()) { + for (Entry context : contexts.entrySet()) { // Make the step execution name unique and repeatable - String stepName = this.stepName + STEP_NAME_SEPARATOR + key; + String stepName = this.stepName + STEP_NAME_SEPARATOR + context.getKey(); StepExecution currentStepExecution = jobExecution.createStepExecution(stepName); - boolean startable = getStartable(currentStepExecution, contexts.get(key)); + boolean startable = getStartable(currentStepExecution, context.getValue()); if (startable) { jobRepository.add(currentStepExecution); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/resource/StepExecutionSimpleCompletionPolicy.java b/spring-batch-core/src/main/java/org/springframework/batch/core/resource/StepExecutionSimpleCompletionPolicy.java index f05c9c69a..af1a0a508 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/resource/StepExecutionSimpleCompletionPolicy.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/resource/StepExecutionSimpleCompletionPolicy.java @@ -66,7 +66,7 @@ public class StepExecutionSimpleCompletionPolicy extends StepExecutionListenerSu JobParameters jobParameters = stepExecution.getJobParameters(); Assert.state(jobParameters.getParameters().containsKey(keyName), "JobParameters do not contain Long parameter with key=[" + keyName + "]"); - delegate = new SimpleCompletionPolicy(new Long(jobParameters.getLong(keyName)).intValue()); + delegate = new SimpleCompletionPolicy((int) jobParameters.getLong(keyName)); } /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/StepContext.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/StepContext.java index 539c24102..609a3be51 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/StepContext.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/StepContext.java @@ -135,8 +135,8 @@ public class StepContext extends SynchronizedAttributeAccessor { Map> copy = Collections.unmodifiableMap(callbacks); - for (String key : copy.keySet()) { - Set set = copy.get(key); + for(Entry> entry : copy.entrySet()) { + Set set = entry.getValue(); for (Runnable callback : set) { if (callback != null) { /* @@ -158,7 +158,7 @@ public class StepContext extends SynchronizedAttributeAccessor { return; } - Exception error = (Exception) errors.get(0); + Exception error = errors.get(0); if (error instanceof RuntimeException) { throw (RuntimeException) error; } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/CommandLineJobRunnerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/CommandLineJobRunnerTests.java index ff995e59f..0db4684c1 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/CommandLineJobRunnerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/CommandLineJobRunnerTests.java @@ -107,7 +107,7 @@ public class CommandLineJobRunnerTests { public static class StubSystemExiter implements SystemExiter { - public static int status; + private static int status; public void exit(int status) { StubSystemExiter.status = status; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestAdvice.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestAdvice.java index 3e9547881..e434c363b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestAdvice.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/TestAdvice.java @@ -9,7 +9,7 @@ import org.aspectj.lang.annotation.Aspect; @Aspect public class TestAdvice { - public static List names = new ArrayList(); + public static final List names = new ArrayList(); @AfterReturning(pointcut="execution(String org.springframework.batch.core.scope.Collaborator+.getName(..))", returning="name") public void registerCollaborator(String name) {