You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2020/05/27 17:35:04 UTC

[camel-k-runtime] branch master updated (36ae8b4 -> 5b4071e)

This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git.


    from 36ae8b4  groovy-loader: add error handler support to the dsl
     new c6325a7  js-loader: add error handler support to the dsl
     new 5b4071e  js-loader: use Java's SDK method to read bytes from InputStream

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/camel/k/loader/js/JavaScriptSourceLoader.java    | 4 ++--
 .../org/apache/camel/k/loader/js/dsl/IntegrationConfiguration.java   | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)


[camel-k-runtime] 02/02: js-loader: use Java's SDK method to read bytes from InputStream

Posted by lb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git

commit 5b4071ef468e7218482407672dc79a8f097cc4f2
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Wed May 27 18:43:40 2020 +0200

    js-loader: use Java's SDK method to read bytes from InputStream
---
 .../java/org/apache/camel/k/loader/js/JavaScriptSourceLoader.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/camel-k-loader-js/src/main/java/org/apache/camel/k/loader/js/JavaScriptSourceLoader.java b/camel-k-loader-js/src/main/java/org/apache/camel/k/loader/js/JavaScriptSourceLoader.java
index 6eaca06..f32ea0e 100644
--- a/camel-k-loader-js/src/main/java/org/apache/camel/k/loader/js/JavaScriptSourceLoader.java
+++ b/camel-k-loader-js/src/main/java/org/apache/camel/k/loader/js/JavaScriptSourceLoader.java
@@ -17,6 +17,7 @@
 package org.apache.camel.k.loader.js;
 
 import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.List;
 
@@ -29,7 +30,6 @@ import org.apache.camel.k.SourceLoader;
 import org.apache.camel.k.annotation.Loader;
 import org.apache.camel.k.loader.js.dsl.IntegrationConfiguration;
 import org.apache.camel.support.LifecycleStrategySupport;
-import org.apache.camel.util.IOHelper;
 import org.graalvm.polyglot.Context;
 import org.graalvm.polyglot.Value;
 
@@ -55,7 +55,7 @@ public class JavaScriptSourceLoader implements SourceLoader {
                     // configure bindings
                     bindings.putMember("__dsl", new IntegrationConfiguration(this));
 
-                    final String script = IOHelper.loadText(is);
+                    final String script = new String(is.readAllBytes(), StandardCharsets.UTF_8);
                     final String wrappedScript = "with (__dsl) { " + script + " }";
 
                     context.eval(LANGUAGE_ID, wrappedScript);


[camel-k-runtime] 01/02: js-loader: add error handler support to the dsl

Posted by lb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git

commit c6325a75f7ad7524a92ec714228b3d51430145ce
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Wed May 27 18:43:08 2020 +0200

    js-loader: add error handler support to the dsl
---
 .../org/apache/camel/k/loader/js/dsl/IntegrationConfiguration.java   | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/camel-k-loader-js/src/main/java/org/apache/camel/k/loader/js/dsl/IntegrationConfiguration.java b/camel-k-loader-js/src/main/java/org/apache/camel/k/loader/js/dsl/IntegrationConfiguration.java
index 9029efd..c962671 100644
--- a/camel-k-loader-js/src/main/java/org/apache/camel/k/loader/js/dsl/IntegrationConfiguration.java
+++ b/camel-k-loader-js/src/main/java/org/apache/camel/k/loader/js/dsl/IntegrationConfiguration.java
@@ -19,6 +19,7 @@ package org.apache.camel.k.loader.js.dsl;
 import org.apache.camel.CamelContext;
 import org.apache.camel.builder.BuilderSupport;
 import org.apache.camel.builder.EndpointConsumerBuilder;
+import org.apache.camel.builder.ErrorHandlerBuilder;
 import org.apache.camel.builder.endpoint.EndpointBuilderFactory;
 import org.apache.camel.builder.endpoint.EndpointRouteBuilder;
 import org.apache.camel.model.InterceptDefinition;
@@ -85,4 +86,8 @@ public class IntegrationConfiguration extends BuilderSupport implements Endpoint
     public InterceptSendToEndpointDefinition interceptSendToEndpoint(String uri) {
         return builder.interceptSendToEndpoint(uri);
     }
+
+    public void errorHandler(ErrorHandlerBuilder handler) {
+        builder.errorHandler(handler);
+    }
 }