You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2022/04/20 13:02:39 UTC
[camel] branch main updated: CAMEL-17894: read all file data at once to avoid costlier buffer building in Roster class
This is an automated email from the ASF dual-hosted git repository.
orpiske 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 ed091007e1f CAMEL-17894: read all file data at once to avoid costlier buffer building in Roster class
ed091007e1f is described below
commit ed091007e1f5cbda31c4a2877ba07819ead22bb9
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Wed Apr 20 13:31:39 2022 +0200
CAMEL-17894: read all file data at once to avoid costlier buffer building in Roster class
---
.../java/org/apache/camel/maven/packaging/SchemaGeneratorMojo.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SchemaGeneratorMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SchemaGeneratorMojo.java
index 26842e9dd2c..8707c55bf34 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SchemaGeneratorMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SchemaGeneratorMojo.java
@@ -23,6 +23,7 @@ import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.net.URI;
import java.net.URL;
+import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Comparator;
@@ -1224,7 +1225,10 @@ public class SchemaGeneratorMojo extends AbstractGeneratorMojo {
try {
Path srcDir = project.getBasedir().toPath().resolve("src/main/java");
Path file = srcDir.resolve(className.replace('.', '/') + ".java");
- return (JavaClassSource) Roaster.parse(file.toFile());
+
+ String fileContent = new String(Files.readAllBytes(file));
+
+ return (JavaClassSource) Roaster.parse(fileContent);
} catch (IOException e) {
throw new RuntimeException("Unable to parse java class " + className, e);
}