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

potential NPE issues in LinkedHashTreeMap.java #1674

Closed
HermioneSW opened this issue Apr 9, 2020 · 3 comments
Closed

potential NPE issues in LinkedHashTreeMap.java #1674

HermioneSW opened this issue Apr 9, 2020 · 3 comments

Comments

@HermioneSW
Copy link

Hi,
We are developing a new static analysis tool for catching bugs in Java code. Upon scanning your codebase we find the following:

In LinkedHashTreeMap.java (gson/src/main/java/com/google/gson/internal/LinkedHashTreeMap.java) rebalance function at line 338, we guess right can be a null since it is checked inint rightHeight = right != null ? right.height : 0; at line 343, If it is indeed the case, then Node<K, V> rightLeft = right.left; and Node<K, V> rightRight = right.right; may throw a NPE at line 347 and 348.

Would you please take a look and confirm this is indeed a bug? Thanks a million!!!

@HermioneSW
Copy link
Author

Hi, can anyone please take a look and confirm this is a bug? Thanks so much!

@Marcono1234
Copy link
Collaborator

If this was an NPE issue, then it would also apply to the local variable left because the usage pattern is the same there.

However, it looks like an NPE cannot occur because:

@Marcono1234
Copy link
Collaborator

Probably obsolete because this class was removed by #1992.

@eamonnmcmanus eamonnmcmanus closed this as not planned Won't fix, can't repro, duplicate, stale Jul 29, 2022
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

No branches or pull requests

3 participants