gnodet-bot commented on code in PR #29878:
URL: https://github.com/apache/camel/pull/29878#discussion_r4567117723


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/ActionBaseCommand.java:
##########
@@ -64,18 +64,19 @@ protected static JsonObject getJsonObject(Path outputFile, 
long timeout) {
         while (watch.taken() < timeout) {
             File f = outputFile.toFile();
             try {
-                // give time for response to be ready
-                Thread.sleep(100);
-
                 if (Files.exists(outputFile) && f.length() > 0) {
                     String text = Files.readString(outputFile);
                     return (JsonObject) Jsoner.deserialize(text);
                 }
+            } catch (Exception e) {
+                // not all written yet
+            }

Review Comment:
   The new catch block silently swallows `IOException` (file not readable), 
`JsonException` (invalid JSON mid-write), and other unexpected errors. While 
the intent is clear (`// not all written yet`), swallowing a broad `Exception` 
with no logging makes it impossible to distinguish a transient partial-write 
from a persistent deserialization bug.
   
   Consider adding at least a TRACE log:
   ```suggestion
               } catch (Exception e) {
                   // not all written yet, or not valid JSON yet — retry after 
a delay
                   LOG.trace("Action output not ready yet: {}", e.getMessage());
               }
   ```
   (Where `LOG` is the existing logger for this class.)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to