[jira] [Commented] (NIFI-3142) ExtractHL7Attributes processor does not route to REL_FAILURE for an exception other than an HL7Exception

2017-03-28 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on NIFI-3142:
--

Github user klinvill commented on the issue:

https://github.com/apache/nifi/pull/1290
  
@jfrazee Apologies for the delayed response. I was running it against NiFi 
1.0.0. The client I was working for at the time was using a few non-standard 
HL7 messages that were resulting in exceptions. The exceptions weren't really 
the problem (the failed messages just require specialized processing). The real 
problem was that the exceptions thrown were not HL7Exceptions so the NiFi 
processor didn't know where to route the message and the flowfile stayed in the 
queue to be processed at a later time. We were handling a large volume of these 
messages so the processor quickly got overloaded with the flowfile backlog. We 
ended up fixing this locally by simply routing all exceptions to failure so 
that the flowfiles would be moved out of the queue. I understand @mattyb149's 
point about how catching all exceptions could lead to data loss. Unfortunately 
I no longer have access to the messages or workflows that are failing so I'll 
go ahead and close this request. Thank you all for the help, if I run into this 
situation again I'll add in additional business logic and submit it back as a 
pull request.


> ExtractHL7Attributes processor does not route to REL_FAILURE for an exception 
> other than an HL7Exception
> 
>
> Key: NIFI-3142
> URL: https://issues.apache.org/jira/browse/NIFI-3142
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.0.0
>Reporter: Kirby Linvill
>Priority: Minor
>  Labels: easyfix
>
> The ExtractHL7Attribute processor will not route a flowfile to REL_FAILURE if 
> processing the flow file throws an exception that is not an HL7Exception. 
> This bug is a result of the try catch block in the onTrigger method. It is 
> easily fixed by changing the catch block to catch a throwable object. Change
> {noformat} 
> try {
> ...
> } catch (final HL7Exception e) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, e}, e);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 
> to 
> {noformat} 
> try {
> ...
> } catch (final Throwable t) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, t}, t);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (NIFI-3142) ExtractHL7Attributes processor does not route to REL_FAILURE for an exception other than an HL7Exception

2017-03-28 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on NIFI-3142:
--

Github user klinvill closed the pull request at:

https://github.com/apache/nifi/pull/1290


> ExtractHL7Attributes processor does not route to REL_FAILURE for an exception 
> other than an HL7Exception
> 
>
> Key: NIFI-3142
> URL: https://issues.apache.org/jira/browse/NIFI-3142
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.0.0
>Reporter: Kirby Linvill
>Priority: Minor
>  Labels: easyfix
>
> The ExtractHL7Attribute processor will not route a flowfile to REL_FAILURE if 
> processing the flow file throws an exception that is not an HL7Exception. 
> This bug is a result of the try catch block in the onTrigger method. It is 
> easily fixed by changing the catch block to catch a throwable object. Change
> {noformat} 
> try {
> ...
> } catch (final HL7Exception e) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, e}, e);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 
> to 
> {noformat} 
> try {
> ...
> } catch (final Throwable t) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, t}, t);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (NIFI-3142) ExtractHL7Attributes processor does not route to REL_FAILURE for an exception other than an HL7Exception

2017-03-09 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on NIFI-3142:
--

Github user jfrazee commented on the issue:

https://github.com/apache/nifi/pull/1290
  
@klinvill Do you know what version of NiFi you were running against? The 
NumberFormatException error was fixed in 1.1.0 by 
[NIFI-2887](https://issues.apache.org/jira/browse/NIFI-2887) and a relevant 
segment added to the unit tests. 
[NIFI-3142](https://issues.apache.org/jira/browse/NIFI-3142) suggests you ran 
into this against 1.0.0, and given the time you reported it at NiFi 1.1.0 had 
only been out for a short time so I wouldn't be surprised if you hadn't 
upgraded yet. Is this right? As for the NPE, I'll see if I can reproduce it but 
I don't know if I exactly follow the scenario. Is it an unrecognized segment 
name as in it's just bad HL7 or a segment that's unsupported for a particular 
version?


> ExtractHL7Attributes processor does not route to REL_FAILURE for an exception 
> other than an HL7Exception
> 
>
> Key: NIFI-3142
> URL: https://issues.apache.org/jira/browse/NIFI-3142
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.0.0
>Reporter: Kirby Linvill
>Priority: Minor
>  Labels: easyfix
>
> The ExtractHL7Attribute processor will not route a flowfile to REL_FAILURE if 
> processing the flow file throws an exception that is not an HL7Exception. 
> This bug is a result of the try catch block in the onTrigger method. It is 
> easily fixed by changing the catch block to catch a throwable object. Change
> {noformat} 
> try {
> ...
> } catch (final HL7Exception e) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, e}, e);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 
> to 
> {noformat} 
> try {
> ...
> } catch (final Throwable t) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, t}, t);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (NIFI-3142) ExtractHL7Attributes processor does not route to REL_FAILURE for an exception other than an HL7Exception

2017-02-16 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on NIFI-3142:
--

Github user trixpan commented on the issue:

https://github.com/apache/nifi/pull/1290
  
@klinvill 

Is this PR still needed or was it identified as a data quality issue?


> ExtractHL7Attributes processor does not route to REL_FAILURE for an exception 
> other than an HL7Exception
> 
>
> Key: NIFI-3142
> URL: https://issues.apache.org/jira/browse/NIFI-3142
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.0.0
>Reporter: Kirby Linvill
>Priority: Minor
>  Labels: easyfix
>
> The ExtractHL7Attribute processor will not route a flowfile to REL_FAILURE if 
> processing the flow file throws an exception that is not an HL7Exception. 
> This bug is a result of the try catch block in the onTrigger method. It is 
> easily fixed by changing the catch block to catch a throwable object. Change
> {noformat} 
> try {
> ...
> } catch (final HL7Exception e) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, e}, e);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 
> to 
> {noformat} 
> try {
> ...
> } catch (final Throwable t) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, t}, t);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (NIFI-3142) ExtractHL7Attributes processor does not route to REL_FAILURE for an exception other than an HL7Exception

2016-12-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on NIFI-3142:
--

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

https://github.com/apache/nifi/pull/1290#discussion_r91182574
  
--- Diff: 
nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/src/main/java/org/apache/nifi/processors/hl7/ExtractHL7Attributes.java
 ---
@@ -196,8 +196,8 @@ public void process(final InputStream in) throws 
IOException {
 final Map attributes = getAttributes(message, 
useSegmentNames, parseSegmentFields);
 flowFile = session.putAllAttributes(flowFile, attributes);
 getLogger().debug("Added the following attributes for {}: {}", 
new Object[]{flowFile, attributes});
-} catch (final HL7Exception e) {
-getLogger().error("Failed to extract attributes from {} due to 
{}", new Object[]{flowFile, e});
+} catch (final Throwable t) {
--- End diff --

Along the lines of what @mattyb149 has stated, catching "throwable" just 
feels like a band-aid/blind-fold to cover up shortcomings in other validation 
or improper logic. I'd prefer to fix the 
processor and framework.

The NPEs should never be thrown and we should definitely track them down, 
can you elaborate more? The NumberFormatExceptions, were these a problem with 
malformed data or logic errors in the processor?


> ExtractHL7Attributes processor does not route to REL_FAILURE for an exception 
> other than an HL7Exception
> 
>
> Key: NIFI-3142
> URL: https://issues.apache.org/jira/browse/NIFI-3142
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.0.0
>Reporter: Kirby Linvill
>Priority: Minor
>  Labels: easyfix
>
> The ExtractHL7Attribute processor will not route a flowfile to REL_FAILURE if 
> processing the flow file throws an exception that is not an HL7Exception. 
> This bug is a result of the try catch block in the onTrigger method. It is 
> easily fixed by changing the catch block to catch a throwable object. Change
> {noformat} 
> try {
> ...
> } catch (final HL7Exception e) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, e}, e);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 
> to 
> {noformat} 
> try {
> ...
> } catch (final Throwable t) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, t}, t);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 



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


[jira] [Commented] (NIFI-3142) ExtractHL7Attributes processor does not route to REL_FAILURE for an exception other than an HL7Exception

2016-12-05 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on NIFI-3142:
--

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

https://github.com/apache/nifi/pull/1290#discussion_r90924068
  
--- Diff: 
nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/src/main/java/org/apache/nifi/processors/hl7/ExtractHL7Attributes.java
 ---
@@ -196,8 +196,8 @@ public void process(final InputStream in) throws 
IOException {
 final Map attributes = getAttributes(message, 
useSegmentNames, parseSegmentFields);
 flowFile = session.putAllAttributes(flowFile, attributes);
 getLogger().debug("Added the following attributes for {}: {}", 
new Object[]{flowFile, attributes});
-} catch (final HL7Exception e) {
-getLogger().error("Failed to extract attributes from {} due to 
{}", new Object[]{flowFile, e});
+} catch (final Throwable t) {
--- End diff --

Where in the code do the NPE and NFE happen? If they are in NiFi code we 
should be catching both (possibly throwing a new exception we can 
expect/handle).

I see what you're saying about avoiding backups of flow files that could be 
processed successfully, but if they can be processed successfully then the 
processor should be able to know what is going on in order to make a smart 
decision about how to handle the flow files. Catching Throwable means you would 
try to handle a flow file as "failed" when it is perfectly fine as input but 
something else is going on under the hood. This could keep the flow running 
even though something bad is going on having nothing to do with flow files, and 
could lead to data loss or non-delivery (which is why the session is being 
rolled back on these exceptions, to preserve the data/flow).

I think we should capture non-happy-paths at the business logic level where 
possible (such as the NPE and NFE you mention). If you can demonstrate 
additional errors that could occur based on the business logic (HL7 library or 
NiFi itself), we should catch those too (all could be handled in the same 
block). I realize if we miss one then we'll have yet another Jira to fix it, 
but I think it's good to try to avoid the catch-everything block.

Probably good to get some more opinions, I'll tag @markap14 and @JPercivall 
for additional input here :)



> ExtractHL7Attributes processor does not route to REL_FAILURE for an exception 
> other than an HL7Exception
> 
>
> Key: NIFI-3142
> URL: https://issues.apache.org/jira/browse/NIFI-3142
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.0.0
>Reporter: Kirby Linvill
>Priority: Minor
>  Labels: easyfix
>
> The ExtractHL7Attribute processor will not route a flowfile to REL_FAILURE if 
> processing the flow file throws an exception that is not an HL7Exception. 
> This bug is a result of the try catch block in the onTrigger method. It is 
> easily fixed by changing the catch block to catch a throwable object. Change
> {noformat} 
> try {
> ...
> } catch (final HL7Exception e) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, e}, e);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 
> to 
> {noformat} 
> try {
> ...
> } catch (final Throwable t) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, t}, t);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 



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


[jira] [Commented] (NIFI-3142) ExtractHL7Attributes processor does not route to REL_FAILURE for an exception other than an HL7Exception

2016-12-05 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on NIFI-3142:
--

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

https://github.com/apache/nifi/pull/1290#discussion_r90904513
  
--- Diff: 
nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/src/main/java/org/apache/nifi/processors/hl7/ExtractHL7Attributes.java
 ---
@@ -196,8 +196,8 @@ public void process(final InputStream in) throws 
IOException {
 final Map attributes = getAttributes(message, 
useSegmentNames, parseSegmentFields);
 flowFile = session.putAllAttributes(flowFile, attributes);
 getLogger().debug("Added the following attributes for {}: {}", 
new Object[]{flowFile, attributes});
-} catch (final HL7Exception e) {
-getLogger().error("Failed to extract attributes from {} due to 
{}", new Object[]{flowFile, e});
+} catch (final Throwable t) {
--- End diff --

Thanks for taking a look Matt. The two exceptions I was seeing were a 
java.lang.NullPointerException (when using a non-recognized segment name) and a 
java.lang.NumberFormatException (when the first field after the segment name 
had a code such as RE instead of a sequence number). Both of these exceptions 
were due to how the processor tries to process the HL7 segments and both were 
causing the processor to backup after enough messages failed to process and 
were not routed to failure (or anywhere for that matter). I could catch these 
two exceptions explicitly but I'd prefer that any error (even an error coming 
from nifi) cause the flowfile to be routed to failure so that it doesn't backup 
any of the flowfiles that could be processed successfully. I thought catching 
at the throwable level would work out well since it looks like that's how the 
PutHDFS processor checks for failure. Do you disagree?


> ExtractHL7Attributes processor does not route to REL_FAILURE for an exception 
> other than an HL7Exception
> 
>
> Key: NIFI-3142
> URL: https://issues.apache.org/jira/browse/NIFI-3142
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.0.0
>Reporter: Kirby Linvill
>Priority: Minor
>  Labels: easyfix
>
> The ExtractHL7Attribute processor will not route a flowfile to REL_FAILURE if 
> processing the flow file throws an exception that is not an HL7Exception. 
> This bug is a result of the try catch block in the onTrigger method. It is 
> easily fixed by changing the catch block to catch a throwable object. Change
> {noformat} 
> try {
> ...
> } catch (final HL7Exception e) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, e}, e);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 
> to 
> {noformat} 
> try {
> ...
> } catch (final Throwable t) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, t}, t);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 



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


[jira] [Commented] (NIFI-3142) ExtractHL7Attributes processor does not route to REL_FAILURE for an exception other than an HL7Exception

2016-12-05 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on NIFI-3142:
--

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

https://github.com/apache/nifi/pull/1290#discussion_r90893970
  
--- Diff: 
nifi-nar-bundles/nifi-hl7-bundle/nifi-hl7-processors/src/main/java/org/apache/nifi/processors/hl7/ExtractHL7Attributes.java
 ---
@@ -196,8 +196,8 @@ public void process(final InputStream in) throws 
IOException {
 final Map attributes = getAttributes(message, 
useSegmentNames, parseSegmentFields);
 flowFile = session.putAllAttributes(flowFile, attributes);
 getLogger().debug("Added the following attributes for {}: {}", 
new Object[]{flowFile, attributes});
-} catch (final HL7Exception e) {
-getLogger().error("Failed to extract attributes from {} due to 
{}", new Object[]{flowFile, e});
+} catch (final Throwable t) {
--- End diff --

Do you have an example / reproduction path of an exception that isn't an 
HL7Exception? I'm a bit wary of changing this to Throwable as the error might 
have come from the NiFi framework, and routing any possible error to a block 
that transfers a flow file might not be the best idea. If the callback passed 
to session.read() throws an IOException, then read() will throw a 
ProcessException with the IOException as the cause. You could check for that 
possibility, or (since you are just filling a buffer in the callback) you could 
retrieve the InputStream using 
[session.read(flowFile)](https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/processor/ProcessSession.java#L570)
 then call StreamUtils.fillBuffer() on that (although take care to perhaps wrap 
the InputStream in a BufferedInputStream, and you'll have to close it yourself, 
see the javadoc for more details).


> ExtractHL7Attributes processor does not route to REL_FAILURE for an exception 
> other than an HL7Exception
> 
>
> Key: NIFI-3142
> URL: https://issues.apache.org/jira/browse/NIFI-3142
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.0.0
>Reporter: Kirby Linvill
>Priority: Minor
>  Labels: easyfix
>
> The ExtractHL7Attribute processor will not route a flowfile to REL_FAILURE if 
> processing the flow file throws an exception that is not an HL7Exception. 
> This bug is a result of the try catch block in the onTrigger method. It is 
> easily fixed by changing the catch block to catch a throwable object. Change
> {noformat} 
> try {
> ...
> } catch (final HL7Exception e) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, e}, e);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 
> to 
> {noformat} 
> try {
> ...
> } catch (final Throwable t) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, t}, t);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 



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


[jira] [Commented] (NIFI-3142) ExtractHL7Attributes processor does not route to REL_FAILURE for an exception other than an HL7Exception

2016-12-02 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on NIFI-3142:
--

GitHub user klinvill opened a pull request:

https://github.com/apache/nifi/pull/1290

Fix NIFI-3142: ExtractHL7Attribute processor: Route a flowfile to 
REL_FAILURE if processing the flow…

Thank you for submitting a contribution to Apache NiFi.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

### For all changes:
- [x] Is there a JIRA ticket associated with this PR? Is it referenced 
 in the commit message?

- [x] Does your PR title start with NIFI- where  is the JIRA number 
you are trying to resolve? Pay particular attention to the hyphen "-" character.

- [x] Has your PR been rebased against the latest commit within the target 
branch (typically master)?

- [x] Is your initial contribution a single, squashed commit?

### For code changes:
- [x] Have you ensured that the full suite of tests is executed via mvn 
-Pcontrib-check clean install at the root nifi folder?
- [ ] Have you written or updated unit tests to verify your changes?
- [n/a] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)? 
- [n/a] If applicable, have you updated the LICENSE file, including the 
main LICENSE file under nifi-assembly?
- [n/a] If applicable, have you updated the NOTICE file, including the main 
NOTICE file found under nifi-assembly?
- [n/a] If adding new Properties, have you added .displayName in addition 
to .name (programmatic access) for each of the new properties?

### For documentation related changes:
- [n/a] Have you ensured that format looks appropriate for the output in 
which it is rendered?

### Note:
Please ensure that once the PR is submitted, you check travis-ci for build 
issues and submit an update to your PR as soon as possible.

… file throws an exception that is not an HL7Exception for the 
ExtractHL7Attribute processor.

Fixed by changing the catch block to catch a throwable object instead of an 
HL7Exception object in the onTrigger method.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/klinvill/nifi NIFI-3142

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/nifi/pull/1290.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1290


commit 2f4a12e083be6acb8e5d2958c572e3428dc87458
Author: Kirby Linvill 
Date:   2016-12-02T14:08:03Z

Fix NIFI-3142: Route a flowfile to REL_FAILURE if processing the flow file 
throws an exception that is not an HL7Exception for the ExtractHL7Attribute 
processor.

Fixed by changing the catch block to catch a throwable object instead of an 
HL7Exception object in the onTrigger method.




> ExtractHL7Attributes processor does not route to REL_FAILURE for an exception 
> other than an HL7Exception
> 
>
> Key: NIFI-3142
> URL: https://issues.apache.org/jira/browse/NIFI-3142
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.0.0
>Reporter: Kirby Linvill
>Priority: Minor
>  Labels: easyfix
>
> The ExtractHL7Attribute processor will not route a flowfile to REL_FAILURE if 
> processing the flow file throws an exception that is not an HL7Exception. 
> This bug is a result of the try catch block in the onTrigger method. It is 
> easily fixed by changing the catch block to catch a throwable object. Change
> {noformat} 
> try {
> ...
> } catch (final HL7Exception e) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, e}, e);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 
> to 
> {noformat} 
> try {
> ...
> } catch (final Throwable t) {
> getLogger().error("Failed to extract attributes from {} due to {}", new 
> Object[]{flowFile, t}, t);
> session.transfer(flowFile, REL_FAILURE);
> return;
> }
> {noformat} 



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