diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/resource/StepExecutionResourceProxy.java b/spring-batch-core/src/main/java/org/springframework/batch/core/resource/StepExecutionResourceProxy.java index e56a86537..8c3340438 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/resource/StepExecutionResourceProxy.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/resource/StepExecutionResourceProxy.java @@ -287,4 +287,13 @@ public class StepExecutionResourceProxy extends StepExecutionListenerSupport imp delegate = resourceLoader.getResource(createFileName(jobName, stepName, properties)); } + /** + * Delegates to the proxied Resource. + */ + public String toString() { + return delegate.toString(); + } + + + } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/resource/StepExecutionResourceProxyTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/resource/StepExecutionResourceProxyTests.java index cace3d635..2535ee974 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/resource/StepExecutionResourceProxyTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/resource/StepExecutionResourceProxyTests.java @@ -32,6 +32,7 @@ import org.springframework.batch.core.resource.StepExecutionResourceProxy; import org.springframework.batch.core.step.StepSupport; import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.DefaultResourceLoader; +import org.springframework.core.io.DescriptiveResource; import org.springframework.core.io.Resource; /** @@ -114,6 +115,24 @@ public class StepExecutionResourceProxyTests extends TestCase { resource.beforeStep(stepExecution); assertTrue(resource.exists()); } + + /** + * toString delegates to the proxied resource. + */ + public void testToString() { + resource = new StepExecutionResourceProxy(); + resource.setResourceLoader(new DefaultResourceLoader() { + public Resource getResource(String location) { + return new DescriptiveResource("toStringTestResource") { + public String toString() { + return "to-string-test-resource"; + } + }; + } + }); + resource.beforeStep(stepExecution); + assertEquals("to-string-test-resource", resource.toString()); + } private void doTestPathName(String filename, String path) throws Exception, IOException { String returnedPath = resource.getFile().getAbsolutePath();