Merge "Fix NullPointerException happens in dumpCheckin"

This commit is contained in:
Aaron Huang
2022-04-19 11:43:21 +00:00
committed by Gerrit Code Review
4 changed files with 69 additions and 1 deletions

View File

@@ -206,6 +206,7 @@ public class NetworkIdentitySet extends HashSet<NetworkIdentity> {
public static int compare(@NonNull NetworkIdentitySet left, @NonNull NetworkIdentitySet right) {
Objects.requireNonNull(left);
Objects.requireNonNull(right);
if (left.isEmpty() && right.isEmpty()) return 0;
if (left.isEmpty()) return -1;
if (right.isEmpty()) return 1;

View File

@@ -776,7 +776,7 @@ public class NetworkStatsCollection implements FileRotator.Reader, FileRotator.W
if (!templateMatches(groupTemplate, key.ident)) continue;
if (key.set >= NetworkStats.SET_DEBUG_START) continue;
final Key groupKey = new Key(null, key.uid, key.set, key.tag);
final Key groupKey = new Key(new NetworkIdentitySet(), key.uid, key.set, key.tag);
NetworkStatsHistory groupHistory = grouped.get(groupKey);
if (groupHistory == null) {
groupHistory = new NetworkStatsHistory(value.getBucketDuration());