You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/02/10 18:01:49 UTC

[GitHub] [nifi] pgyori commented on a change in pull request #4815: NIFI-8200: Modifying PutAzureDataLakeStorage to delete temp file if e…

pgyori commented on a change in pull request #4815:
URL: https://github.com/apache/nifi/pull/4815#discussion_r573941975



##########
File path: nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/PutAzureDataLakeStorage.java
##########
@@ -126,6 +126,9 @@ public void onTrigger(final ProcessContext context, final ProcessSession session
                 if (length > 0) {
                     try (final InputStream rawIn = session.read(flowFile); final BufferedInputStream bufferedIn = new BufferedInputStream(rawIn)) {
                         uploadContent(fileClient, bufferedIn, length);
+                    } catch (Exception e) {
+                        fileClient.delete();
+                        throw e;

Review comment:
       Exception e is suppressed if fileClient.delete() also throws an exception. My recommendation is to put a try-catch-finally around delete(). In the catch only an error message needs to be logged, and in the finally the original exception 'e' can be thrown forward.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org