Skip to content
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

fixes setting paramName only when it is not null #6332

Merged
merged 1 commit into from
Jan 10, 2019

Conversation

ankurpathak
Copy link
Contributor

@ankurpathak ankurpathak commented Dec 24, 2018

Fixes: gh-6223

Copy link
Member

@rwinch rwinch left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @ankurpathak! I have provided feedback inline.


@Override
public void setVariable(String name, @Nullable Object value) {
if (name == null)
Copy link
Member

Choose a reason for hiding this comment

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

Please add { to follow Spring Security's code conventions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added { to if part.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we need to add it for else part as well??

Copy link
Member

Choose a reason for hiding this comment

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

Yes. We do not use implied { for one line statements

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added for else part as well.

@@ -112,7 +112,9 @@ private void addArgumentsAsVariables() {
}

for (int i = 0; i < args.length; i++) {
super.setVariable(paramNames[i], args[i]);
if (paramNames[i] != null) {
super.setVariable(paramNames[i], args[i]);
Copy link
Member

Choose a reason for hiding this comment

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

For the test below to work, you need to remove super.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed super.

private AuthenticationTrustResolver trustResolver;

@Test
public void setVariableTest() {
Copy link
Member

Choose a reason for hiding this comment

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

please rename to lookupVariableWhenParameterNameNullThenNotSet

Copy link
Contributor Author

Choose a reason for hiding this comment

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

renamed test to lookupVariableWhenParameterNameNullThenNotSet

@ankurpathak ankurpathak force-pushed the gh-17565-npe branch 3 times, most recently from e6a0212 to dad649d Compare January 9, 2019 02:27
Copy link
Member

@rwinch rwinch left a comment

Choose a reason for hiding this comment

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

I just noticed that the commit references an invalid ticket. Can you update it to be Fixes: gh-6223?

@ankurpathak
Copy link
Contributor Author

changed commit message to reflect Fixes: gh-6223.

@rwinch rwinch self-assigned this Jan 10, 2019
@rwinch rwinch added type: bug A general bug in: core An issue in spring-security-core status: duplicate A duplicate of another issue labels Jan 10, 2019
@rwinch rwinch added this to the 5.2.0.M1 milestone Jan 10, 2019
@rwinch rwinch merged commit 4ff5149 into spring-projects:master Jan 10, 2019
@rwinch
Copy link
Member

rwinch commented Jan 10, 2019

Thanks @ankurpathak! This is now merged into master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core An issue in spring-security-core status: duplicate A duplicate of another issue type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants