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/21 08:47:31 UTC

[camel] 04/06: CAMEL-17894: avoid creating a string unnecessarily

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

commit 51632dab5dc2662e84cd9e97981e15f7a1580cd7
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Wed Apr 20 16:56:11 2022 +0200

    CAMEL-17894: avoid creating a string unnecessarily
---
 .../org/apache/camel/maven/packaging/AbstractGeneratorMojo.java  | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/AbstractGeneratorMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/AbstractGeneratorMojo.java
index aeb36f8189a..d36f807f923 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/AbstractGeneratorMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/AbstractGeneratorMojo.java
@@ -161,12 +161,15 @@ public abstract class AbstractGeneratorMojo extends AbstractMojo {
             if (file.isAbsolute()) {
                 file = new File(r.getDirectory().substring(baseDir.length() + 1));
             }
-            String path = file.getPath() + "/" + suffix;
+
             if (log.isDebugEnabled()) {
+                String path = file.getPath() + "/" + suffix;
                 log.debug("Checking  if " + path + " (" + r.getDirectory() + "/" + suffix + ") has changed.");
             }
-            if (buildContext.hasDelta(path)) {
-                log.debug("Indeed " + suffix + " has changed.");
+            if (buildContext.hasDelta(new File(file, suffix))) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Indeed " + suffix + " has changed.");
+                }
                 return true;
             }
         }