mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
8062 fix container summary NPE
This commit is contained in:
parent
cc51e9d095
commit
572bfd44f7
@ -22,10 +22,8 @@ import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.datamodel.SleuthkitCaseProvider.SleuthkitCaseProviderException;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
import org.sleuthkit.datamodel.DataSource;
|
||||
@ -218,7 +216,7 @@ public class ContainerSummary {
|
||||
*/
|
||||
public static class ImageDetails {
|
||||
|
||||
private final long unallocatedSize;
|
||||
private final Long unallocatedSize;
|
||||
private final long size;
|
||||
private final long sectorSize;
|
||||
|
||||
@ -233,7 +231,8 @@ public class ContainerSummary {
|
||||
/**
|
||||
* Main constructor.
|
||||
*
|
||||
* @param unallocatedSize Size in bytes of unallocated space.
|
||||
* @param unallocatedSize Size in bytes of unallocated space or null if
|
||||
* no unallocated space could be determined.
|
||||
* @param size Total size in bytes.
|
||||
* @param sectorSize Sector size in bytes.
|
||||
* @param timeZone The time zone.
|
||||
@ -243,7 +242,7 @@ public class ContainerSummary {
|
||||
* @param sha1Hash The sha1 hash or null.
|
||||
* @param sha256Hash The sha256 hash or null.
|
||||
*/
|
||||
ImageDetails(long unallocatedSize, long size, long sectorSize,
|
||||
ImageDetails(Long unallocatedSize, long size, long sectorSize,
|
||||
String timeZone, String imageType, List<String> paths, String md5Hash,
|
||||
String sha1Hash, String sha256Hash) {
|
||||
this.unallocatedSize = unallocatedSize;
|
||||
@ -258,9 +257,10 @@ public class ContainerSummary {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Size in bytes of unallocated space.
|
||||
* @return Size in bytes of unallocated space or null if no unallocated
|
||||
* space could be determined.
|
||||
*/
|
||||
public long getUnallocatedSize() {
|
||||
public Long getUnallocatedSize() {
|
||||
return unallocatedSize;
|
||||
}
|
||||
|
||||
@ -426,8 +426,8 @@ public class ContainerSummary {
|
||||
|
||||
Long unallocSize = getSizeOfUnallocatedFiles(image);
|
||||
String imageType = image.getType().getName();
|
||||
Long size = image.getSize();
|
||||
Long sectorSize = image.getSsize();
|
||||
long size = image.getSize();
|
||||
long sectorSize = image.getSsize();
|
||||
String timeZone = image.getTimeZone();
|
||||
List<String> paths = image.getPaths() == null ? Collections.emptyList() : Arrays.asList(image.getPaths());
|
||||
String md5 = image.getMd5();
|
||||
|
@ -174,7 +174,13 @@ class ContainerPanel extends BaseDataSourceSummaryPanel {
|
||||
* @param viewModel The image view model data.
|
||||
*/
|
||||
private void setFieldsForImage(ImageDetails viewModel) {
|
||||
unallocatedSizeValue.setText(SizeRepresentationUtil.getSizeString(viewModel.getUnallocatedSize()));
|
||||
Long unallocatedSize = viewModel.getUnallocatedSize();
|
||||
if (unallocatedSize == null) {
|
||||
unallocatedSizeValue.setText(Bundle.ContainerPanel_setFieldsForNonImageDataSource_na());
|
||||
} else {
|
||||
unallocatedSizeValue.setText(SizeRepresentationUtil.getSizeString(unallocatedSize));
|
||||
}
|
||||
|
||||
imageTypeValue.setText(viewModel.getImageType());
|
||||
sizeValue.setText(SizeRepresentationUtil.getSizeString(viewModel.getSize()));
|
||||
sectorSizeValue.setText(SizeRepresentationUtil.getSizeString(viewModel.getSectorSize()));
|
||||
|
@ -55,6 +55,7 @@ class ExportContainerInfo {
|
||||
* separate cells in an excel export.
|
||||
*
|
||||
* @param acquisitionDetails The acquisition details.
|
||||
*
|
||||
* @return The list of key value pairs that can be incorporated into the
|
||||
* excel export.
|
||||
*/
|
||||
@ -105,7 +106,19 @@ class ExportContainerInfo {
|
||||
DefaultCellModel<?> md5 = hasImage ? new DefaultCellModel<>(imageDetails.getMd5Hash()) : NACell;
|
||||
DefaultCellModel<?> sha1 = hasImage ? new DefaultCellModel<>(imageDetails.getSha1Hash()) : NACell;
|
||||
DefaultCellModel<?> sha256 = hasImage ? new DefaultCellModel<>(imageDetails.getSha256Hash()) : NACell;
|
||||
DefaultCellModel<?> unallocatedSize = hasImage ? SizeRepresentationUtil.getBytesCell(imageDetails.getUnallocatedSize()) : NACell;
|
||||
|
||||
DefaultCellModel<?> unallocatedSize;
|
||||
if (hasImage) {
|
||||
Long unallocatedSizeVal = imageDetails.getUnallocatedSize();
|
||||
if (unallocatedSizeVal != null) {
|
||||
unallocatedSize = SizeRepresentationUtil.getBytesCell(unallocatedSizeVal);
|
||||
} else {
|
||||
unallocatedSize = NACell;
|
||||
}
|
||||
} else {
|
||||
unallocatedSize = NACell;
|
||||
}
|
||||
|
||||
List<String> paths = containerDetails.getImageDetails() == null ? Collections.singletonList(NA) : containerDetails.getImageDetails().getPaths();
|
||||
List<SingleCellExportable> cellPaths = paths.stream()
|
||||
.map(SingleCellExportable::new)
|
||||
|
Loading…
x
Reference in New Issue
Block a user