Skip to content

Conversation

@Athorcis
Copy link
Contributor

@Athorcis Athorcis commented Nov 25, 2025

we always should return a result or else cordova is leaking callbacks on the js side
it become visible with numerous calls to addBreadcrumb

we always should return a result or else cordova is leaking callbacks on the js side
try (FileOutputStream out = new FileOutputStream(installation)) {
out.write(bytes);
logger.info("Successfully captured envelope.");
callbackContext.success();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not move it to line 156 so it will always invoke callbackContext.success(); for all the cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just to be sure, you want me to also replace all success plugin results (not in a try block, to avoid double call in case of catched errors) with the invokation at line 156 ?

callbackContext.success();
} catch (Exception e) {
logger.info("Error writing envelope.");
callbackContext.error("Error writing envelope.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

might also be a good idea to return false here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure, because as I understand it, the execute method is only supposed to return false if the requested action is not found.
(because when returning false cordova is sending its own plugin result)

@lucas-zimerman
Copy link
Collaborator

Thank you @Athorcis for spotting this issue! I left a small suggestion on the java code but other than that it looks good!
Thank you again for the PR!

@Athorcis
Copy link
Contributor Author

@lucas-zimerman I have questions about the suggestions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants