mirror of https://github.com/apache/nifi.git
NIFI-1153: If no incoming FlowFile, don't try to transfer null
Reviewed by Bryan Bende (bbende@apache.org) Amended based on review (change to a log message) by Tony Kurc (tkurc@apache.org)
This commit is contained in:
parent
33ef59c5ba
commit
0900fb80c9
|
@ -168,8 +168,12 @@ public class ExecuteSQL extends AbstractProcessor {
|
||||||
session.getProvenanceReporter().modifyContent(outgoing, "Retrieved " + nrOfRows.get() + " rows", stopWatch.getElapsed(TimeUnit.MILLISECONDS));
|
session.getProvenanceReporter().modifyContent(outgoing, "Retrieved " + nrOfRows.get() + " rows", stopWatch.getElapsed(TimeUnit.MILLISECONDS));
|
||||||
session.transfer(outgoing, REL_SUCCESS);
|
session.transfer(outgoing, REL_SUCCESS);
|
||||||
} catch (final ProcessException | SQLException e) {
|
} catch (final ProcessException | SQLException e) {
|
||||||
logger.error("Unable to execute SQL select query {} for {} due to {}; routing to failure", new Object[] { selectQuery, incoming, e });
|
if (incoming == null) {
|
||||||
session.transfer(incoming, REL_FAILURE);
|
logger.error("Unable to execute SQL select query {} due to {}. No incoming flow file to route to failure", new Object[] {selectQuery, e});
|
||||||
|
} 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue