Fix some issues from last commit

This commit is contained in:
dsyer
2010-01-14 13:05:43 +00:00
parent 5c8f527443
commit 56dafae8f1
6 changed files with 9 additions and 4 deletions

View File

@@ -207,8 +207,8 @@ public class SimpleJobLauncherTests {
run(ExitStatus.FAILED);
fail("Expected Error");
}
catch (RuntimeException e) {
assertEquals("foo", e.getCause().getMessage());
catch (Error e) {
assertEquals("foo", e.getMessage());
}
}

View File

@@ -207,7 +207,7 @@ public abstract class AbstractMethodInvokingDelegator<T> implements Initializing
* is assumed correct values will be supplied at runtime.
*/
public void setArguments(Object[] arguments) {
this.arguments = Arrays.asList(arguments).toArray();
this.arguments = arguments == null ? null : Arrays.asList(arguments).toArray();
}
/**

View File

@@ -204,6 +204,7 @@ public class MultiResourceItemReader<T> implements ItemReader<T>, ItemStream {
* @param resources input resources
*/
public void setResources(Resource[] resources) {
Assert.notNull(resources, "The resources must not be null");
this.resources = Arrays.asList(resources).toArray(new Resource[resources.length]);
}

View File

@@ -79,7 +79,7 @@ public abstract class AbstractLineTokenizer implements LineTokenizer {
* @param names
*/
public void setNames(String[] names) {
this.names = Arrays.asList(names).toArray(new String[names.length]);
this.names = names==null ? null : Arrays.asList(names).toArray(new String[names.length]);
}
/**

View File

@@ -41,6 +41,7 @@ public class BeanWrapperFieldExtractor<T> implements FieldExtractor<T>, Initiali
* @param names field names to be extracted by the {@link #extract(Object)} method.
*/
public void setNames(String[] names) {
Assert.notNull(names, "Names must be non-null");
this.names = Arrays.asList(names).toArray(new String[names.length]);
}

View File

@@ -19,6 +19,7 @@ import org.springframework.core.io.AbstractResource;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.test.util.ReflectionTestUtils;
/**
* Tests for {@link MultiResourceItemReader}.
@@ -237,6 +238,8 @@ public class MultiResourceItemReaderIntegrationTests {
tested.setComparator(comp);
tested.setResources(resources);
tested.open(ctx);
resources = (Resource[]) ReflectionTestUtils.getField(tested, "resources");
assertSame(r3, resources[0]);
assertSame(r1, resources[1]);