[ 
https://issues.apache.org/jira/browse/NIFI-2611?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15430991#comment-15430991
 ] 

ASF GitHub Bot commented on NIFI-2611:
--------------------------------------

Github user mosermw commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/905#discussion_r75698608
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UnpackContent.java
 ---
    @@ -182,15 +182,18 @@ public void onStopped() {
         public void onScheduled(ProcessContext context) throws 
ProcessException {
             if (fileFilter == null) {
                 fileFilter = 
Pattern.compile(context.getProperty(FILE_FILTER).getValue());
    -            tarUnpacker = new TarUnpacker(fileFilter);
    -            zipUnpacker = new ZipUnpacker(fileFilter);
    -            flowFileStreamV3Unpacker = new FlowFileStreamUnpacker(new 
FlowFileUnpackagerV3());
    -            flowFileStreamV2Unpacker = new FlowFileStreamUnpacker(new 
FlowFileUnpackagerV2());
    -            flowFileTarUnpacker = new FlowFileStreamUnpacker(new 
FlowFileUnpackagerV1());
             }
    +    }
    +
    +    private void initPackagers(ProcessContext context) {
    +        tarUnpacker = new TarUnpacker(fileFilter);
    +        zipUnpacker = new ZipUnpacker(fileFilter);
    +        flowFileStreamV3Unpacker = new FlowFileStreamUnpacker(new 
FlowFileUnpackagerV3());
    +        flowFileStreamV2Unpacker = new FlowFileStreamUnpacker(new 
FlowFileUnpackagerV2());
    +        flowFileTarUnpacker = new FlowFileStreamUnpacker(new 
FlowFileUnpackagerV1());
    --- End diff --
    
    With this, we will create 5 unpacker objects on each onTrigger().  It works 
but it's inefficient and I think there's a better way.
    
    What do you think of avoiding construction of flowFileTarUnpacker or 
flowFileStreamV2Unpacker or flowFileStreamV3Unpacker in the onScheduled() 
method, but instead construct the appropriate one in the initUnpacker() method? 
 Inside initUnpacker() the tarUnpacker and zipUnpacker can be reused but 
FlowFileStreamUnpacker can be constructed anew.


> UnpackContent cannot unpack any type of flowfile
> ------------------------------------------------
>
>                 Key: NIFI-2611
>                 URL: https://issues.apache.org/jira/browse/NIFI-2611
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 0.7.0
>            Reporter: Joseph Gresock
>            Assignee: Joseph Gresock
>
> Two possibly separate problems:
> *Flowfile-stream-v2 and v3*
> This may be a problem with either MergeContent's production of 
> flowfile-stream v2 and v3, or with UnpackContent's inability to unpack them, 
> not sure which.  Here is a screen shot with how to reproduce it: 
> https://ibin.co/2sCwqbFbAs3a.png
> Essentially, when you pack a flow file as flowfile-stream v2 or v3, a 
> subsequent UnpackContent set to the respective type fails with the error 
> "Cannot unpack {} because it does not appear to have any entries".
> *Flowfile-tar-v1*
> When selecting flowfile-tar-v1 from UnpackContent, you immediately get 
> @OnScheduled error failure as soon as you start the processor, which prevents 
> it from processing any incoming flow files.  Here is a screenshot: 
> https://ibin.co/2sCxI4iDm88t.png



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to