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 294e42f290c (chores) camel-any23: removed duplicated code (#8413)
294e42f290c is described below
commit 294e42f290c5efd14898913a732aa1e3d1107b01
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Fri Sep 23 06:26:27 2022 +0200
(chores) camel-any23: removed duplicated code (#8413)
---
.../apache/camel/dataformat/any23/Any23TestSupport.java | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git
a/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23TestSupport.java
b/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23TestSupport.java
index 4229b73b1c3..4ec5a484486 100644
---
a/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23TestSupport.java
+++
b/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23TestSupport.java
@@ -16,9 +16,8 @@
*/
package org.apache.camel.dataformat.any23;
-import java.io.BufferedReader;
import java.io.File;
-import java.io.FileReader;
+import java.io.FileInputStream;
import org.apache.camel.util.IOHelper;
@@ -29,17 +28,8 @@ public final class Any23TestSupport {
}
public static String loadFileAsString(File file) throws Exception {
- StringBuilder fileContent = new StringBuilder();
- BufferedReader input = IOHelper.buffered(new FileReader(file));
- try {
- String line = null;
- while ((line = input.readLine()) != null) {
- fileContent.append(line);
- fileContent.append(System.lineSeparator());
- }
- } finally {
- input.close();
+ try (FileInputStream inputStream = new FileInputStream(file)) {
+ return IOHelper.loadText(inputStream);
}
- return fileContent.toString();
}
}