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 2020/06/13 23:23:59 UTC

[tomee-patch-plugin] 09/11: Do not modify certain files

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 b6450f5ab615c5b11850acb9b0588d0f12b34bbc
Author: David Blevins <da...@gmail.com>
AuthorDate: Sat Jun 13 11:27:49 2020 -0700

    Do not modify certain files
---
 .../main/java/org/apache/tomee/patch/core/Transformation.java    | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tomee-patch-core/src/main/java/org/apache/tomee/patch/core/Transformation.java b/tomee-patch-core/src/main/java/org/apache/tomee/patch/core/Transformation.java
index 1aa761f..ec3c47d 100644
--- a/tomee-patch-core/src/main/java/org/apache/tomee/patch/core/Transformation.java
+++ b/tomee-patch-core/src/main/java/org/apache/tomee/patch/core/Transformation.java
@@ -102,6 +102,8 @@ public class Transformation {
                         scanClass(zipInputStream, zipOutputStream);
                     } else if (isZip(path)) {
                         scanJar(path, zipInputStream, zipOutputStream);
+                    } else if (copyUnmodified(path)){
+                        IO.copy(zipInputStream, zipOutputStream);
                     } else {
                         scanResource(zipInputStream, zipOutputStream);
                     }
@@ -134,6 +136,13 @@ public class Transformation {
         }
     }
 
+    private boolean copyUnmodified(final String path) {
+        if (path.endsWith("META-INF/DEPENDENCIES")) return true;
+        if (path.endsWith("META-INF/dependencies.xml")) return true;
+        if (path.endsWith("pom.xml")) return true;
+        return false;
+    }
+
     private void scanResource(InputStream inputStream, final OutputStream outputStream) throws IOException {
         inputStream = StreamBuilder.create(inputStream)
                 .replace("javax.activation", "jakarta.activation")