findbugs fixes

This commit is contained in:
robokaso
2008-11-24 10:49:47 +00:00
parent 77c8719a26
commit dcbd5e4b3e
8 changed files with 15 additions and 13 deletions

View File

@@ -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) + "]");
}
}

View File

@@ -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);
}
}

View File

@@ -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());

View File

@@ -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<String, ExecutionContext> contexts = partitioner.partition(splitSize);
Set<StepExecution> set = new HashSet<StepExecution>(contexts.size());
for (String key : contexts.keySet()) {
for (Entry<String, ExecutionContext> 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);

View File

@@ -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));
}
/**

View File

@@ -135,8 +135,8 @@ public class StepContext extends SynchronizedAttributeAccessor {
Map<String, Set<Runnable>> copy = Collections.unmodifiableMap(callbacks);
for (String key : copy.keySet()) {
Set<Runnable> set = copy.get(key);
for(Entry<String, Set<Runnable>> entry : copy.entrySet()) {
Set<Runnable> 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;
}

View File

@@ -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;

View File

@@ -9,7 +9,7 @@ import org.aspectj.lang.annotation.Aspect;
@Aspect
public class TestAdvice {
public static List<String> names = new ArrayList<String>();
public static final List<String> names = new ArrayList<String>();
@AfterReturning(pointcut="execution(String org.springframework.batch.core.scope.Collaborator+.getName(..))", returning="name")
public void registerCollaborator(String name) {