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

    https://github.com/apache/nifi/pull/178#discussion_r50213360
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteSQL.java
 ---
    @@ -164,17 +166,31 @@ public void process(final OutputStream out) throws 
IOException {
                 });
     
                 // set attribute how many rows were selected
    -            outgoing = session.putAttribute(outgoing, RESULT_ROW_COUNT, 
nrOfRows.get().toString());
    +            fileToProcess = session.putAttribute(fileToProcess, 
RESULT_ROW_COUNT, nrOfRows.get().toString());
     
    -            logger.info("{} contains {} Avro records; transferring to 
'success'", new Object[] {outgoing, nrOfRows.get()});
    -            session.getProvenanceReporter().modifyContent(outgoing, 
"Retrieved " + nrOfRows.get() + " rows", 
stopWatch.getElapsed(TimeUnit.MILLISECONDS));
    -            session.transfer(outgoing, REL_SUCCESS);
    +            logger.info("{} contains {} Avro records; transferring to 
'success'",
    +                    new Object[] {fileToProcess, nrOfRows.get()});
    +            session.getProvenanceReporter().modifyContent(fileToProcess, 
"Retrieved " + nrOfRows.get() + " rows",
    +                    stopWatch.getElapsed(TimeUnit.MILLISECONDS));
    +            session.transfer(fileToProcess, REL_SUCCESS);
             } catch (final ProcessException | SQLException e) {
    -            if (incoming == null) {
    -                logger.error("Unable to execute SQL select query {} due to 
{}. No incoming flow file to route to failure", new Object[] {selectQuery, e});
    +            if (fileToProcess == null) {
    +                // This can happen if any exceptions occur while setting 
up the connection, statement, etc.
    +                logger.error("Unable to execute SQL select query {} due to 
{}. No incoming flow file to route to failure",
    +                        new Object[] {selectQuery, e});
    +                context.yield();
                 } else {
    -                logger.error("Unable to execute SQL select query {} for {} 
due to {}; routing to failure", new Object[] {selectQuery, incoming, e});
    -                session.transfer(incoming, REL_FAILURE);
    +                if(context.hasIncomingConnection()) {
    +                    logger.error("Unable to execute SQL select query {} 
for {} due to {}; routing to failure",
    +                            new Object[] {selectQuery, fileToProcess, e});
    +                                  session.transfer(fileToProcess, 
REL_FAILURE);
    --- End diff --
    
    I think this snuck in there.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to