-
Notifications
You must be signed in to change notification settings - Fork 827
[SCB-737]Avoid null point exception #936
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
Conversation
| // aop后,新的实例的父类可能是原class,也可能只是个proxy,父类不是原class | ||
| // 所以,需要先取出原class,再取标注 | ||
| Class<?> beanCls = BeanUtils.getImplClassFromBean(bean); | ||
| if(beanCls == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when will this happened?
if happened, just ignore it Silently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
org.springframework.aop.TargetClassAware.getTargetClass(),this method return the target Class, or null if not known. more detail, reference https://issues.apache.org/jira/browse/SCB-737?filter=-1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if got null, maybe will cause to lost schema definition
so need to print a warn log at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a example or test case showing how this will happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@liubao68 ,you can reference this blog http://3ms.huawei.com/km/groups/3618383/blogs/details/5589591
To resolve this problem, I just need to add a warn log will be ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, fine. When users defined bean using EnableBatchProcessing, they will not set bean implementation class. So beans annotated with @RestSchema should not do this. In this situation, I think we do not need add a log just like we do not add a log for others beans not annotated with @RestSchema
Follow this checklist to help us incorporate your contribution quickly and easily:
[SCB-XXX] Fixes bug in ApproximateQuantiles, where you replaceSCB-XXXwith the appropriate JIRA issue.mvn clean installto make sure basic checks pass. A more thorough check will be performed on your pull request automatically.