You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/02/06 16:47:43 UTC
[camel] 02/04: Fix java routes loader compute name to deal with
location having scheme
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit d8659efd1d4b4f6b5ad79a2c6fa782363cbdb3c9
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Feb 6 17:07:35 2021 +0100
Fix java routes loader compute name to deal with location having scheme
---
.../org/apache/camel/language/joor/JoorRoutesBuilderLoader.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/components/camel-joor/src/main/java/org/apache/camel/language/joor/JoorRoutesBuilderLoader.java b/components/camel-joor/src/main/java/org/apache/camel/language/joor/JoorRoutesBuilderLoader.java
index 131000f..3b824c0 100644
--- a/components/camel-joor/src/main/java/org/apache/camel/language/joor/JoorRoutesBuilderLoader.java
+++ b/components/camel-joor/src/main/java/org/apache/camel/language/joor/JoorRoutesBuilderLoader.java
@@ -27,6 +27,7 @@ import org.apache.camel.RoutesBuilder;
import org.apache.camel.spi.Resource;
import org.apache.camel.spi.RoutesBuilderLoader;
import org.apache.camel.spi.annotations.JdkService;
+import org.apache.camel.support.ResourceHelper;
import org.apache.camel.util.FileUtil;
import org.apache.camel.util.IOHelper;
import org.joor.Reflect;
@@ -68,7 +69,13 @@ public class JoorRoutesBuilderLoader implements RoutesBuilderLoader, CamelContex
}
private String determineName(Resource resource, String content) {
- final String name = FileUtil.onlyName(resource.getLocation(), true);
+ String loc = resource.getLocation();
+ // strip scheme to compute the name
+ String scheme = ResourceHelper.getScheme(loc);
+ if (scheme != null) {
+ loc = loc.substring(scheme.length());
+ }
+ final String name = FileUtil.onlyName(loc, true);
final Matcher matcher = PACKAGE_PATTERN.matcher(content);
return matcher.find()