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

Fix NullPointerException in Compaction.totalFileSize #100

wants to merge 1 commit into
base: master


None yet
2 participants
Copy link

dain commented Feb 3, 2019

List of files can be null for root level

Fixes #99

Fix NullPointerException in Compaction.totalFileSize
List of files can be null for root level

Fixes #99
@@ -126,8 +126,10 @@ public boolean isTrivialMove()
public static long totalFileSize(List<FileMetaData> files)
long sum = 0;
for (FileMetaData file : files) {
sum += file.getFileSize();
if (files != null) {

This comment has been minimized.


martint Feb 3, 2019


Shouldn’t this be guarded in the caller? It should be an error for this method to be called with a null argument

This comment has been minimized.


dain Feb 3, 2019

Author Owner

The code is not designed well, so I figured it was safer to do here. This should really be Optional<List<Files>>, but I'd prefer to keep the changes minimal.


This comment has been minimized.

Copy link
Owner Author

dain commented Feb 19, 2019

Fixed by #101

@dain dain closed this Feb 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment