[GitHub] nicolaferraro closed pull request #64: kamel run runtime/examples/Sample.java fails with java.lang.NoClassDefFoundError

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] nicolaferraro closed pull request #64: kamel run runtime/examples/Sample.java fails with java.lang.NoClassDefFoundError

GitBox
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:
[hidden email]


With regards,
Apache Git Services