You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2021/03/10 08:36:23 UTC

[camel] branch master updated: Fix failing unit tests

This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 9e597d8  Fix failing unit tests
9e597d8 is described below

commit 9e597d88170fcfd6b2f21166da5b2c6ea82227b2
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Wed Mar 10 09:35:35 2021 +0100

    Fix failing unit tests
---
 .../org/apache/camel/maven/ApiComponentGeneratorMojo.java | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java
index 85adfc6..e7ffb2d 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java
@@ -363,11 +363,13 @@ public class ApiComponentGeneratorMojo extends AbstractApiMethodBaseMojo {
      * Store file hash cache.
      */
     private void writeCacheFile(List<String> cache) {
-        File cacheFile = new File(this.cachedir, CACHE_PROPERTIES_FILENAME);
-        try (OutputStream out = new FileOutputStream(cacheFile)) {
-            Files.write(cacheFile.toPath(), cache);
-        } catch (IOException e) {
-            getLog().warn("Cannot store file hash cache properties file", e);
+        if (this.cachedir != null) {
+            File cacheFile = new File(this.cachedir, CACHE_PROPERTIES_FILENAME);
+            try (OutputStream out = new FileOutputStream(cacheFile)) {
+                Files.write(cacheFile.toPath(), cache);
+            } catch (IOException e) {
+                getLog().warn("Cannot store file hash cache properties file", e);
+            }
         }
     }
 
@@ -376,6 +378,9 @@ public class ApiComponentGeneratorMojo extends AbstractApiMethodBaseMojo {
      */
     private List<String> readCacheFile() {
         Log log = getLog();
+        if (this.cachedir == null) {
+            return Collections.emptyList();
+        }
         if (!this.cachedir.exists()) {
             if (!this.cachedir.mkdirs()) {
                 log.warn("Unable to create cache directory '" + this.cachedir + "'.");