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

pvillard31 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 75be662046e NIFI-16186 Deprecated FlowFile Package Versions 1 and 2 
for Removal (#11532)
75be662046e is described below

commit 75be662046edbcf19d6d435b619a8b1691fb5f65
Author: David Handermann <[email protected]>
AuthorDate: Wed Aug 12 03:33:07 2026 -0500

    NIFI-16186 Deprecated FlowFile Package Versions 1 and 2 for Removal (#11532)
---
 .../org/apache/nifi/util/FlowFilePackagerV1.java   |  1 +
 .../org/apache/nifi/util/FlowFilePackagerV2.java   |  1 +
 .../org/apache/nifi/util/FlowFileUnpackagerV1.java |  1 +
 .../org/apache/nifi/util/FlowFileUnpackagerV2.java |  1 +
 .../apache/nifi/util/TestPackageUnpackageV1.java   | 77 ----------------------
 .../nifi-standard-processors/pom.xml               |  6 ++
 .../nifi/processors/standard/MergeContent.java     |  1 +
 .../nifi/processors/standard/UnpackContent.java    | 18 +++--
 .../standard/servlets/ListenHTTPServlet.java       |  1 +
 9 files changed, 26 insertions(+), 81 deletions(-)

diff --git 
a/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV1.java
 
b/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV1.java
index d992b57bcb6..0c980f630e0 100644
--- 
a/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV1.java
+++ 
b/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV1.java
@@ -26,6 +26,7 @@ import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
 import java.util.Map;
 
+@Deprecated(since = "2.12.0", forRemoval = true)
 public class FlowFilePackagerV1 implements FlowFilePackager {
 
     public static final String FILENAME_ATTRIBUTES = "flowfile.attributes";
diff --git 
a/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV2.java
 
b/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV2.java
index fb15fa82b32..4b2790e5a30 100644
--- 
a/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV2.java
+++ 
b/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV2.java
@@ -83,6 +83,7 @@ import java.util.Map;
  * 64 21
  * </pre>
  */
+@Deprecated(since = "2.12.0", forRemoval = true)
 public class FlowFilePackagerV2 implements FlowFilePackager {
 
     private static final int MAX_VALUE_2_BYTES = 65535;
diff --git 
a/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFileUnpackagerV1.java
 
b/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFileUnpackagerV1.java
index 7629d6b3292..48c146a9a2b 100644
--- 
a/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFileUnpackagerV1.java
+++ 
b/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFileUnpackagerV1.java
@@ -26,6 +26,7 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.stream.Collectors;
 
+@Deprecated(since = "2.12.0", forRemoval = true)
 public class FlowFileUnpackagerV1 implements FlowFileUnpackager {
 
     private int flowFilesRead = 0;
diff --git 
a/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFileUnpackagerV2.java
 
b/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFileUnpackagerV2.java
index 086381df57d..4fe0c20dc5f 100644
--- 
a/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFileUnpackagerV2.java
+++ 
b/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFileUnpackagerV2.java
@@ -25,6 +25,7 @@ import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Map;
 
+@Deprecated(since = "2.12.0", forRemoval = true)
 public class FlowFileUnpackagerV2 implements FlowFileUnpackager {
 
     private final byte[] readBuffer = new byte[8192];
diff --git 
a/nifi-commons/nifi-flowfile-packager/src/test/java/org/apache/nifi/util/TestPackageUnpackageV1.java
 
b/nifi-commons/nifi-flowfile-packager/src/test/java/org/apache/nifi/util/TestPackageUnpackageV1.java
deleted file mode 100644
index 2f6e1b9c198..00000000000
--- 
a/nifi-commons/nifi-flowfile-packager/src/test/java/org/apache/nifi/util/TestPackageUnpackageV1.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.util;
-
-import org.junit.jupiter.api.Test;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.nio.charset.StandardCharsets;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.junit.jupiter.api.Assertions.assertArrayEquals;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
-public class TestPackageUnpackageV1 {
-    @Test
-    @SuppressWarnings("unchecked")
-    void testPackageWithNonStringAttributes() {
-        final FlowFilePackager packager = new FlowFilePackagerV1();
-        final byte[] data = "Hello, World!".getBytes(StandardCharsets.UTF_8);
-        final Map<Object, Object> map = new HashMap<>();
-        map.put(12, 34);
-        map.put(56, 78);
-        map.put(9, 10);
-
-        final Map<String, String> cast = (Map) map;
-
-        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        final ByteArrayInputStream in = new ByteArrayInputStream(data);
-
-        assertThrows(ClassCastException.class, () -> 
packager.packageFlowFile(in, baos, cast, data.length));
-    }
-
-    @Test
-    void testPackageAndUnpackage() throws Exception {
-        final FlowFilePackager packager = new FlowFilePackagerV1();
-        final FlowFileUnpackager unpackager = new FlowFileUnpackagerV1();
-
-        final byte[] data = "Hello, World!".getBytes(StandardCharsets.UTF_8);
-        final Map<String, String> map = new HashMap<>();
-        map.put("abc", "cba");
-        map.put("123", null);
-
-        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        final ByteArrayInputStream in = new ByteArrayInputStream(data);
-        packager.packageFlowFile(in, baos, map, data.length);
-
-        final byte[] encoded = baos.toByteArray();
-        final ByteArrayInputStream encodedIn = new 
ByteArrayInputStream(encoded);
-        final ByteArrayOutputStream decodedOut = new ByteArrayOutputStream();
-        final Map<String, String> unpackagedAttributes = 
unpackager.unpackageFlowFile(encodedIn, decodedOut);
-        final byte[] decoded = decodedOut.toByteArray();
-
-        /*Since the properties serialized as XML has the value null specified 
between the entry tags,
-          when loaded into a java.util.Properties it is read as string whose 
value is "null" hence for
-          verification must change to the expected value.*/
-        map.put("123", "null");
-        assertEquals(map, unpackagedAttributes);
-        assertArrayEquals(data, decoded);
-    }
-}
diff --git 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/pom.xml 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/pom.xml
index 17675cb153b..923eae50471 100644
--- 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/pom.xml
+++ 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/pom.xml
@@ -568,6 +568,12 @@
             <version>42.7.13</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-deprecation-log</artifactId>
+            <version>2.12.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
     <build>
         <plugins>
diff --git 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java
 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java
index 0d74bc8808d..4db21d46643 100644
--- 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java
+++ 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java
@@ -468,6 +468,7 @@ public class MergeContent extends BinFiles {
     protected BinProcessingResult processBin(final Bin bin, final 
ProcessContext context) throws ProcessException {
         final BinProcessingResult binProcessingResult = new 
BinProcessingResult(true);
 
+        @SuppressWarnings("removal")
         MergeBin merger = switch 
(context.getProperty(MERGE_FORMAT).asAllowableValue(MergeFormat.class)) {
             case TAR -> new TarMerge();
             case ZIP -> new 
ZipMerge(context.getProperty(COMPRESSION_LEVEL).asInteger());
diff --git 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UnpackContent.java
 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UnpackContent.java
index 63bc8273d83..f1a4c70dc38 100644
--- 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UnpackContent.java
+++ 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UnpackContent.java
@@ -40,6 +40,8 @@ import org.apache.nifi.annotation.lifecycle.OnScheduled;
 import org.apache.nifi.annotation.lifecycle.OnStopped;
 import org.apache.nifi.components.DescribedValue;
 import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.deprecation.log.DeprecationLogger;
+import org.apache.nifi.deprecation.log.DeprecationLoggerFactory;
 import org.apache.nifi.flowfile.FlowFile;
 import org.apache.nifi.flowfile.attributes.CoreAttributes;
 import org.apache.nifi.flowfile.attributes.FragmentAttributes;
@@ -227,6 +229,8 @@ public class UnpackContent extends AbstractProcessor {
             REL_ORIGINAL
     );
 
+    private static final DeprecationLogger deprecationLogger = 
DeprecationLoggerFactory.getLogger(UnpackContent.class);
+
     private Pattern fileFilter;
 
     private Unpacker tarUnpacker;
@@ -249,9 +253,14 @@ public class UnpackContent extends AbstractProcessor {
 
     @OnScheduled
     public void onScheduled(ProcessContext context) throws ProcessException {
-        if (fileFilter == null) {
-            final PackageFormat packageFormat = 
context.getProperty(PACKAGING_FORMAT).asAllowableValue(PackageFormat.class);
+        final PackageFormat packageFormat = 
context.getProperty(PACKAGING_FORMAT).asAllowableValue(PackageFormat.class);
+        if (PackageFormat.FLOWFILE_STREAM_FORMAT_V2 == packageFormat) {
+            deprecationLogger.warn("FlowFile Stream V2 is deprecated for 
removal");
+        } else if (PackageFormat.FLOWFILE_TAR_FORMAT == packageFormat) {
+            deprecationLogger.warn("FlowFile TAR V1 is deprecated for 
removal");
+        }
 
+        if (fileFilter == null) {
             fileFilter = 
Pattern.compile(context.getProperty(FILE_FILTER).getValue());
 
             tarUnpacker = switch (packageFormat) {
@@ -311,6 +320,7 @@ public class UnpackContent extends AbstractProcessor {
             }
         }
 
+        @SuppressWarnings("removal")
         final Unpacker unpacker = switch (packagingFormat) {
             case TAR_FORMAT -> tarUnpacker;
             case ZIP_FORMAT -> zipUnpacker;
@@ -743,8 +753,8 @@ public class UnpackContent extends AbstractProcessor {
         TAR_FORMAT(TAR_FORMAT_NAME, null, "application/x-tar"),
         ZIP_FORMAT(ZIP_FORMAT_NAME, null, "application/zip"),
         FLOWFILE_STREAM_FORMAT_V3(FLOWFILE_STREAM_FORMAT_V3_NAME, null, 
StandardFlowFileMediaType.VERSION_3.getMediaType()),
-        FLOWFILE_STREAM_FORMAT_V2(FLOWFILE_STREAM_FORMAT_V2_NAME, null, 
StandardFlowFileMediaType.VERSION_2.getMediaType()),
-        FLOWFILE_TAR_FORMAT(FLOWFILE_TAR_FORMAT_NAME, null, 
StandardFlowFileMediaType.VERSION_1.getMediaType());
+        FLOWFILE_STREAM_FORMAT_V2(FLOWFILE_STREAM_FORMAT_V2_NAME, "FlowFile 
Stream V2 is deprecated", StandardFlowFileMediaType.VERSION_2.getMediaType()),
+        FLOWFILE_TAR_FORMAT(FLOWFILE_TAR_FORMAT_NAME, "FlowFile TAR V1 is 
deprecated", StandardFlowFileMediaType.VERSION_1.getMediaType());
 
         private final String value;
         private final String description;
diff --git 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ListenHTTPServlet.java
 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ListenHTTPServlet.java
index 5c850d2649b..94c6d2f31d2 100644
--- 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ListenHTTPServlet.java
+++ 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ListenHTTPServlet.java
@@ -449,6 +449,7 @@ public class ListenHTTPServlet extends HttpServlet {
         }
     }
 
+    @SuppressWarnings("removal")
     private FlowFileUnpackager getFlowFileUnpackager(String contentType) {
         final FlowFileUnpackager unpackager;
         if 
(StandardFlowFileMediaType.VERSION_3.getMediaType().equals(contentType)) {

Reply via email to