NIFI-7258 - fix overflow in PutAzureEventHub when not configured correctly

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #4146.
This commit is contained in:
Pierre Villard 2020-03-16 18:58:55 +01:00
parent 3feb85a030
commit 71bf12976f
No known key found for this signature in database
GPG Key ID: BEE1599F0726E9CD
1 changed files with 7 additions and 2 deletions

View File

@ -179,7 +179,12 @@ public class PutAzureEventHub extends AbstractProcessor {
@Override
public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
populateSenderQueue(context);
try {
populateSenderQueue(context);
} catch (ProcessException e) {
context.yield();
throw e;
}
final StopWatch stopWatch = new StopWatch(true);
@ -343,7 +348,7 @@ public class PutAzureEventHub extends AbstractProcessor {
EventHubClientImpl.USER_AGENT = "ApacheNiFi-azureeventhub/2.3.2";
return EventHubClient.createSync(getConnectionString(namespace, eventHubName, policyName, policyKey), executor);
} catch (IOException | EventHubException | IllegalConnectionStringFormatException e) {
getLogger().error("Failed to create EventHubClient due to {}", e);
getLogger().error("Failed to create EventHubClient due to {}", new Object[]{e.getMessage()}, e);
throw new ProcessException(e);
}
}