Skip to content

[2962] Mismatch between mechanism to check if nullChannel bean exists and mechanism to fetch that bean #2963

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 2 commits into from
Jun 13, 2019

Conversation

michaelwiles
Copy link
Contributor

…2962

Pull request to resolve #2962

I did it very defensively so with lots of type checking etc as I can't be sure of the parent factories. I think this is all necessary as we're having to fetch the bean definition from the outside.

Also apologies if the formatting is not correct. I did try to use the eclipse formatter spec but the section of code I changed may not be formatted correctly.

Also see some of my inline comments.

@pivotal-issuemaster
Copy link

@michaelwiles Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@michaelwiles michaelwiles changed the title fix for https://github.com/spring-projects/spring-integration/issues/… [2962] Mismatch between mechanism to check if nullChannel bean exists and mechanism to fetch that bean Jun 11, 2019
@pivotal-issuemaster
Copy link

@michaelwiles Thank you for signing the Contributor License Agreement!

@michaelwiles michaelwiles force-pushed the master branch 2 times, most recently from 1061b61 to 3e162a7 Compare June 12, 2019 08:00
@michaelwiles
Copy link
Contributor Author

Added a test

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

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

Here is some my review.

Thanks

}
}
// don't think it will hurt to always find the parent
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure that we really are going to accept so internal thoughts as comments.
Why can't we really live without these comments at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed and no problem

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 guess I was just explaining my thinking

beanFactory = ((HierarchicalBeanFactory) beanFactory).getParentBeanFactory();
}
// will definitely be found as containsBean returned true - but also want to be defensive in case of NPE
} while (nullChannelDefinition == null && beanFactory != null); // not sure if beanFactroy not null is necessary
Copy link
Member

Choose a reason for hiding this comment

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

The while must be on a new line.
I think we indeed don't need to check for beanFactory != null, since you are right that containsBean(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME) does the trick for us do not fail with the infinite loop.
Although if Checkstyle or Sonar Qube will require it I would just live with an extra check in this condition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I'll ensure that the coding style is adhered to. Finding meeting coding guidelines quite challenging

Copy link
Contributor Author

Choose a reason for hiding this comment

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

comments and null check on bean factory removed.

@michaelwiles michaelwiles force-pushed the master branch 2 times, most recently from 851b230 to 6879a14 Compare June 12, 2019 21:36
Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

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

Please, add your name to @author list for all affected classes.

That's all - otherwise LGTM

@michaelwiles
Copy link
Contributor Author

should I rebase into 1 commit?

@artembilan
Copy link
Member

No, we do that on merge.
Thanks

@artembilan artembilan merged commit 360c740 into spring-projects:master Jun 13, 2019
@artembilan
Copy link
Member

... and cherry-picked to 5.1.x as 3668d9f after fixing conflicts in the test in regards of missed yet AssertJ support.

@michaelwiles ,

Thank you very much for the contribution; looking forward for more!

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.

Mismatch between mechanism to check if nullChannel bean exists and mechanism to fetch that bean
3 participants