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 2022/11/29 07:56:28 UTC
[camel] branch main updated: camel-jbang - run from clipbard, fix if java has package name
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 04805f108c5 camel-jbang - run from clipbard, fix if java has package name
04805f108c5 is described below
commit 04805f108c599296baad30dcbd65d6d8403b8590
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Nov 29 08:54:56 2022 +0100
camel-jbang - run from clipbard, fix if java has package name
---
.../main/java/org/apache/camel/dsl/jbang/core/commands/Run.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
index 4a4a09dbf09..efc5b3879d5 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
@@ -616,7 +616,12 @@ class Run extends CamelCommand {
throw new IllegalArgumentException(
"Cannot determine the Java class name from the source in the clipboard");
}
- fn = fqn + ".java";
+ // drop package in file name
+ String cn = fqn;
+ if (fqn.contains(".")) {
+ cn = cn.substring(cn.lastIndexOf('.') + 1);
+ }
+ fn = cn + ".java";
}
Files.write(Paths.get(fn), t.toString().getBytes(StandardCharsets.UTF_8));
file = "file:" + fn;