You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2025/11/19 14:49:29 UTC
(camel) branch main updated: chore(components): enhance file stream closure
This is an automated email from the ASF dual-hosted git repository.
pcongiusti 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 f0c64d73d8be chore(components): enhance file stream closure
f0c64d73d8be is described below
commit f0c64d73d8be521db7c2e8bf8fd8b0b2d9b49674
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Wed Nov 19 13:03:58 2025 +0100
chore(components): enhance file stream closure
---
.../java/org/apache/camel/language/joor/JavaJoorClassLoader.java | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/components/camel-joor/src/main/java/org/apache/camel/language/joor/JavaJoorClassLoader.java b/components/camel-joor/src/main/java/org/apache/camel/language/joor/JavaJoorClassLoader.java
index ab9dae26f78b..889b9a0fca38 100644
--- a/components/camel-joor/src/main/java/org/apache/camel/language/joor/JavaJoorClassLoader.java
+++ b/components/camel-joor/src/main/java/org/apache/camel/language/joor/JavaJoorClassLoader.java
@@ -22,7 +22,6 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.camel.util.FileUtil;
-import org.apache.camel.util.IOHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -97,11 +96,9 @@ public class JavaJoorClassLoader extends ClassLoader {
// create work-dir if needed
String dir = FileUtil.onlyPath(fname);
new File(dir).mkdirs();
- try {
- FileOutputStream fos = new FileOutputStream(target);
+ try (FileOutputStream fos = new FileOutputStream(target)) {
LOG.debug("Writing compiled class: {} as bytecode to file: {}", name, target);
fos.write(byteCode);
- IOHelper.close(fos);
} catch (Exception e) {
LOG.warn("Error writing compiled class: {} as bytecode to file: {} due to {}. This exception is ignored.",
name, target, e.getMessage());