You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2021/03/26 07:40:13 UTC

[tomee-patch-plugin] 01/02: Verify each patch source directory exists

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

dblevins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee-patch-plugin.git

commit 9a84ebe1a702a055577338b9a383e76d4aeb3eac
Author: David Blevins <da...@gmail.com>
AuthorDate: Thu Mar 25 22:49:36 2021 -0700

    Verify each patch source directory exists
---
 .../main/java/org/apache/tomee/patch/plugin/PatchMojo.java   | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java b/tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java
index 663805b..8cceff3 100644
--- a/tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java
+++ b/tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java
@@ -305,6 +305,18 @@ public class PatchMojo extends AbstractMojo {
         }
 
         Files.mkdir(patchSourceDirectory);
+        for (final File patchSource : patchSources) {
+            if (!patchSource.exists()) {
+                final String message = "Patch source directory does not exist: " + patchSource.getAbsolutePath();
+                getLog().error(message);
+                throw new MojoExecutionException(message);
+            }
+            if (!patchSource.isDirectory()) {
+                final String message = "Patch source directory is not a directory: " + patchSource.getAbsolutePath();
+                getLog().error(message);
+                throw new MojoExecutionException(message);
+            }
+        }
         patchSources.forEach(file -> copy(file, file, patchSourceDirectory));