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

util/FieldInfo.java 里 getInheritGenericType() 可疑的空指针解引用 #1614

Closed
viennadd opened this issue Nov 27, 2017 · 2 comments
Closed
Labels
Milestone

Comments

@viennadd
Copy link

viennadd commented Nov 27, 2017

Hi,

我们的代码检查器 Pinpoint 报告了一处可疑的空指针解引用,

if (gd instanceof Class) {
class_gd = (Class<?>) tv.getGenericDeclaration();
}
Type[] arguments = null;
if (class_gd == clazz) {
if (type instanceof ParameterizedType) {
ParameterizedType ptype = (ParameterizedType) type;
arguments = ptype.getActualTypeArguments();
}
} else {
for (Class<?> c = clazz; c != null && c != Object.class && c != class_gd; c = c.getSuperclass()) {
Type superType = c.getGenericSuperclass();
if (superType instanceof ParameterizedType) {
ParameterizedType p_superType = (ParameterizedType) superType;
Type[] p_superType_args = p_superType.getActualTypeArguments();
getArgument(p_superType_args, c.getTypeParameters(), arguments);
arguments = p_superType_args;
}
}
}
if (arguments == null) {
return null;
}
Type actualType = null;
TypeVariable<?>[] typeVariables = class_gd.getTypeParameters();
for (int j = 0; j < typeVariables.length; ++j) {

349 行是否可能返回 false,导致 377 行使用 class_gd 时触发空指针解引用?

祝好,
Sourcebrella Inc.

@wenshao
Copy link
Member

wenshao commented Dec 1, 2017

问题确实存在,已经修复,将会在下一个版本中带上,谢谢反馈!

@wenshao wenshao added this to the 1.2.42 milestone Dec 1, 2017
@wenshao wenshao added the bug label Dec 1, 2017
wenshao added a commit that referenced this issue Dec 1, 2017
@wenshao
Copy link
Member

wenshao commented Dec 14, 2017

https://github.com/alibaba/fastjson/releases/tag/1.2.42
新版已发布,请使用新版本。

@wenshao wenshao closed this as completed Dec 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants