Skip to content

Conversation

@AymanDF
Copy link
Contributor

@AymanDF AymanDF commented Mar 16, 2016

This pull request is focused on resolving occurrences of Sonar rule squid:S1854 - “ Dead stores should be removed ”. You can find more information about the issue here:
https://dev.eclipse.org/sonar/rules/show/squid:S1854
Please let me know if you have any questions.
Ayman Abdelghany.

@deruelle
Copy link
Member

I don't think this code change is relevant with the sonar information. What you're doing is removing null but those variable are still used.
What sonar says is "A dead store happens when a local variable is assigned a value, including null that is not read by any subsequent instruction" but in our case the variable is still read

@AymanDF
Copy link
Contributor Author

AymanDF commented Mar 21, 2016

The initialization with null here is considered redundant and useless as the variable is assigned with a different value anyway, that's why it's marked by sonar as dead store.

@deruelle
Copy link
Member

Not really, it may happen in the first case. By example d3531b7#diff-e0434b28ff185e45580262866cd2f59eR372, that some exception happens in the code where the exception is not rethrown in the catch block but just stored for later processing. This would leave the req attribute uninitialized.

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