Skip to content

Drain entire download stream #830

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 18, 2024
Merged

Drain entire download stream #830

merged 9 commits into from
Mar 18, 2024

Conversation

tomas-sexenian
Copy link
Contributor

Issue: 107019

@genexusbot
Copy link
Collaborator

Cherry pick to beta success

@tomas-sexenian tomas-sexenian requested a review from ggallotti March 6, 2024 16:45
@genexusbot
Copy link
Collaborator

Cherry pick to beta success

}
}
} catch (FileNotFoundException ex) {
logger.error("Error while downloading file to the external provider", ex);
} catch (IOException ex) {
logger.error("Error while downloading file to the external provider", ex);
} finally {
try {objectData.close();} catch (IOException ioe) {logger.error("Error while draining the S3ObjectInputStream", ioe);}
Copy link
Member

@ggallotti ggallotti Mar 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will crash if objectData is null.

Ant the Finally should be in the LAST try.

} catch (IOException e) {
logger.error("Error while processing the input stream", e);
} finally {
objectData.close();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed? You are inside a Try resource code. Thw clous will be done automatically.

@genexusbot
Copy link
Collaborator

Cherry pick to beta success

@genexusbot
Copy link
Collaborator

Cherry pick to beta success

}
} catch (FileNotFoundException ex) {
logger.error("Error while downloading file to the external provider", ex);
} catch (IOException ex) {
logger.error("Error while downloading file to the external provider", ex);
} finally {
try {objectData.close();} catch (IOException ioe) {logger.error("Error while draining the S3ObjectInputStream", ioe);}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry! The location of the catch was ok!
The missing was the IF condition. Now it's ok, bute you need to restore the finally position to the original place.

@genexusbot
Copy link
Collaborator

Cherry pick to beta success

@tomas-sexenian tomas-sexenian merged commit b614c63 into master Mar 18, 2024
@tomas-sexenian tomas-sexenian deleted the DrainStream branch March 18, 2024 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants