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 2023/09/28 19:42:00 UTC
[camel] branch main updated (d7dadbc436a -> b57a3fc42e9)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
from d7dadbc436a CAMEL-19862: align Apache parent with Camel. (#11604)
new ead6aa342f2 CAMEL-19929: Fix camel-jbang reload should skip dir event. Fix Java DSL to not need to compile if no files (would throw exception otherwise).
new b57a3fc42e9 Revert "CAMEL-19929: camel-main - Dev console for upload should support sub folders"
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:
.../component/platform/http/main/MainHttpServer.java | 15 +++++----------
.../camel/support/FileWatcherResourceReloadStrategy.java | 5 +++++
.../java/org/apache/camel/dsl/java/joor/MultiCompile.java | 5 +++++
3 files changed, 15 insertions(+), 10 deletions(-)
[camel] 01/02: CAMEL-19929: Fix camel-jbang reload should skip dir event. Fix Java DSL to not need to compile if no files (would throw exception otherwise).
Posted by da...@apache.org.
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
commit ead6aa342f24e3382d0bb75fa614fb504e89af23
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Sep 28 21:39:50 2023 +0200
CAMEL-19929: Fix camel-jbang reload should skip dir event. Fix Java DSL to not need to compile if no files (would throw exception otherwise).
---
.../org/apache/camel/support/FileWatcherResourceReloadStrategy.java | 5 +++++
.../src/main/java/org/apache/camel/dsl/java/joor/MultiCompile.java | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/FileWatcherResourceReloadStrategy.java b/core/camel-support/src/main/java/org/apache/camel/support/FileWatcherResourceReloadStrategy.java
index 93da2e0f734..5ff229032ee 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/FileWatcherResourceReloadStrategy.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/FileWatcherResourceReloadStrategy.java
@@ -292,6 +292,11 @@ public class FileWatcherResourceReloadStrategy extends ResourceReloadStrategySup
WatchEvent<Path> we = (WatchEvent<Path>) event;
Path path = we.context();
File file = pathToReload.resolve(path).toFile();
+ LOG.trace("File watch-event: {} on file: {}", we, file);
+ if (file.isDirectory()) {
+ continue;
+ }
+
String name = FileUtil.compactPath(file.getPath());
LOG.debug("Detected Modified/Created file: {}", name);
boolean accept = fileFilter == null || fileFilter.accept(file);
diff --git a/dsl/camel-java-joor-dsl/src/main/java/org/apache/camel/dsl/java/joor/MultiCompile.java b/dsl/camel-java-joor-dsl/src/main/java/org/apache/camel/dsl/java/joor/MultiCompile.java
index 5945599fe73..05a85739c67 100644
--- a/dsl/camel-java-joor-dsl/src/main/java/org/apache/camel/dsl/java/joor/MultiCompile.java
+++ b/dsl/camel-java-joor-dsl/src/main/java/org/apache/camel/dsl/java/joor/MultiCompile.java
@@ -99,6 +99,11 @@ public final class MultiCompile {
}
});
+ // only compile if there is any files to compile
+ if (files.isEmpty()) {
+ return result;
+ }
+
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
try {
[camel] 02/02: Revert "CAMEL-19929: camel-main - Dev console for upload should support sub folders"
Posted by da...@apache.org.
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
commit b57a3fc42e9f691c1fca491c654fa03d7740f979
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Sep 28 21:40:01 2023 +0200
Revert "CAMEL-19929: camel-main - Dev console for upload should support sub folders"
This reverts commit 26097e2f43677f7694f96eaede61922b6b4f14d3.
---
.../component/platform/http/main/MainHttpServer.java | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java
index 6199257a8d1..e80cf310cc3 100644
--- a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java
+++ b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java
@@ -532,7 +532,7 @@ public class MainHttpServer extends ServiceSupport implements CamelContextAware,
}
}
});
- if (!sb.isEmpty()) {
+ if (sb.length() > 0) {
String out = sb.toString();
if (html) {
ctx.response().putHeader("content-type", "text/html");
@@ -571,7 +571,7 @@ public class MainHttpServer extends ServiceSupport implements CamelContextAware,
}
}
});
- if (!sb.isEmpty()) {
+ if (sb.length() > 0) {
String out = sb.toString();
ctx.end(out);
} else if (!root.isEmpty()) {
@@ -592,20 +592,18 @@ public class MainHttpServer extends ServiceSupport implements CamelContextAware,
}
protected void setupUploadConsole(final String dir) {
- final Route upload = router.route("/q/upload/*")
+ final Route upload = router.route("/q/upload/:filename")
.method(HttpMethod.PUT)
// need body handler to handle file uploads
.handler(BodyHandler.create(true));
- final Route uploadDelete = router.route("/q/upload/*");
+ final Route uploadDelete = router.route("/q/upload/:filename");
uploadDelete.method(HttpMethod.DELETE);
Handler<RoutingContext> handler = new Handler<RoutingContext>() {
@Override
public void handle(RoutingContext ctx) {
- // grab filename which is after /q/upload/
- String name = ctx.request().path();
- name = StringHelper.after(name, "/q/upload/");
+ String name = ctx.pathParam("filename");
if (name == null) {
ctx.response().setStatusCode(400);
ctx.end();
@@ -644,9 +642,6 @@ public class MainHttpServer extends ServiceSupport implements CamelContextAware,
boolean exists = f.isFile() && f.exists();
LOG.info("{} file: {}/{}", exists ? "Updating" : "Creating", dir, name);
- // if it has sub folders, then make sure folders exists
- f.mkdirs();
-
File tmp = new File(dir, name + ".tmp");
FileOutputStream fos = null;
try {