You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "loyi (Jira)" <ji...@apache.org> on 2021/04/28 10:44:00 UTC
[jira] [Updated] (KAFKA-12723) Potential NPE in
SnapshottableHashTable.java
[ https://issues.apache.org/jira/browse/KAFKA-12723?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
loyi updated KAFKA-12723:
-------------------------
Description:
The method mergeFrom of {color:#de350b}HashTier{color} maybe has potential NPE , the attribute deltaTable in {color:#de350b}other{color} variable may be null. Maybe we should add a check.
The following is the method:
public void mergeFrom(long epoch, Delta source)
{
HashTier<T> other = (HashTier<T>) source;
List<T> list = new ArrayList<>();
Object[] otherElements = other.deltaTable.baseElements(); // Add a null check
......
}
After fix:
public void mergeFrom(long epoch, Delta source) {
HashTier<T> other = (HashTier<T>) source;
List<T> list = new ArrayList<>();
BaseHashTable<T> otherDeltaTable = other.deltaTable;
if (otherDeltaTable != null){
......
}
}
was:
The method mergeFrom of {color:#de350b}HashTier{color} maybe has potential NPE , the attribute deltaTable in {color:#de350b}other{color} variable may be null. Maybe we should add a check.
The following is the method:
public void mergeFrom(long epoch, Delta source) {
HashTier<T> other = (HashTier<T>) source;
List<T> list = new ArrayList<>();
Object[] otherElements = other.deltaTable.baseElements(); // Add a null check
......
}
After fix:
public void mergeFrom(long epoch, Delta source) {
HashTier<T> other = (HashTier<T>) source;
List<T> list = new ArrayList<>();
BaseHashTable<T> otherDeltaTable = other.deltaTable;
if (otherDeltaTable != null) {
......
}
}
> Potential NPE in SnapshottableHashTable.java
> --------------------------------------------
>
> Key: KAFKA-12723
> URL: https://issues.apache.org/jira/browse/KAFKA-12723
> Project: Kafka
> Issue Type: Bug
> Affects Versions: 2.8.0
> Reporter: loyi
> Priority: Minor
>
> The method mergeFrom of {color:#de350b}HashTier{color} maybe has potential NPE , the attribute deltaTable in {color:#de350b}other{color} variable may be null. Maybe we should add a check.
>
> The following is the method:
> public void mergeFrom(long epoch, Delta source)
> {
> HashTier<T> other = (HashTier<T>) source;
> List<T> list = new ArrayList<>();
> Object[] otherElements = other.deltaTable.baseElements(); // Add a null check
> ......
> }
>
> After fix:
> public void mergeFrom(long epoch, Delta source) {
> HashTier<T> other = (HashTier<T>) source;
> List<T> list = new ArrayList<>();
> BaseHashTable<T> otherDeltaTable = other.deltaTable;
> if (otherDeltaTable != null){
> ......
> }
> }
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)