nicolaferraro closed pull request #64: kamel run runtime/examples/Sample.java 
fails with java.lang.NoClassDefFoundError
URL: https://github.com/apache/camel-k/pull/64
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/runtime/jvm/src/main/java/org/apache/camel/k/jvm/RoutesLoaders.java 
b/runtime/jvm/src/main/java/org/apache/camel/k/jvm/RoutesLoaders.java
index ab1bc5c..8f9409e 100644
--- a/runtime/jvm/src/main/java/org/apache/camel/k/jvm/RoutesLoaders.java
+++ b/runtime/jvm/src/main/java/org/apache/camel/k/jvm/RoutesLoaders.java
@@ -19,6 +19,7 @@
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.List;
 import java.util.function.Function;
@@ -85,9 +86,12 @@ public RouteBuilder load(String resource) throws Exception {
             try (InputStream is = Routes.loadResourceAsInputStream(resource)) {
                 String name = StringUtils.substringAfter(resource, ":");
                 name = StringUtils.removeEnd(name, ".java");
-                name = StringUtils.removeStart(name, "/");
 
-                return Reflect.compile(name.replace("/", "."), 
IOUtils.toString(is)).create().get();
+                if (name.contains("/")) {
+                    name = StringUtils.substringAfterLast(name, "/");
+                }
+                
+                return Reflect.compile(name, IOUtils.toString(is, 
StandardCharsets.UTF_8)).create().get();
             }
         }
     },


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to