From 7759789323a797a2ea0798caf043fde2c889e0ac Mon Sep 17 00:00:00 2001 From: Scott Andrews Date: Mon, 15 Dec 2008 18:25:53 +0000 Subject: [PATCH] SWF-992 Flow Id not properly calculated when using "classpath*:" style resources in base-path --- .../webflow/config/FlowDefinitionResourceFactory.java | 4 ++++ .../webflow/config/FlowDefinitionResourceFactoryTests.java | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowDefinitionResourceFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowDefinitionResourceFactory.java index aef65c82..71cc0764 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowDefinitionResourceFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowDefinitionResourceFactory.java @@ -40,6 +40,8 @@ public class FlowDefinitionResourceFactory { private static final String CLASSPATH_SCHEME = "classpath:"; + private static final String CLASSPATH_STAR_SCHEME = "classpath*:"; + private static final String SLASH = "/"; private ResourceLoader resourceLoader; @@ -250,6 +252,8 @@ public class FlowDefinitionResourceFactory { private String removeClasspathScheme(String basePath) { if (basePath.startsWith(CLASSPATH_SCHEME)) { return basePath.substring(CLASSPATH_SCHEME.length()); + } else if (basePath.startsWith(CLASSPATH_STAR_SCHEME)) { + return basePath.substring(CLASSPATH_STAR_SCHEME.length()); } else { return basePath; } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/config/FlowDefinitionResourceFactoryTests.java b/spring-webflow/src/test/java/org/springframework/webflow/config/FlowDefinitionResourceFactoryTests.java index 2274f7c9..2640bbd8 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/config/FlowDefinitionResourceFactoryTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/config/FlowDefinitionResourceFactoryTests.java @@ -88,6 +88,12 @@ public class FlowDefinitionResourceFactoryTests extends TestCase { assertEquals("sample", factory.getFlowId(resource)); } + public void testGetFlowIdClassPathStarResource() { + Resource resource = new ClassPathResource("org/springframework/webflow/sample/sample-flow.xml"); + factory.setBasePath("classpath*:org/springframework/webflow/"); + assertEquals("sample", factory.getFlowId(resource)); + } + public void testGetFlowIdFileSystemResource() { Resource resource = new FileSystemResource( "/the/path/on/the/file/system/org/springframework/webflow/sample/sample-flow.xml");