From 1d92a70664375c39ae471d782ec75886a4bb3574 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Mon, 12 Mar 2018 13:59:05 -0400 Subject: [PATCH 1/2] Fix compile error for NoCurrentCaseException in VideoFile.java --- .../imagegallery/datamodel/VideoFile.java | 43 ++++++++----------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/VideoFile.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/VideoFile.java index 8959113abc..ea783160e4 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/VideoFile.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/VideoFile.java @@ -29,7 +29,6 @@ import javafx.scene.image.Image; import javafx.scene.media.Media; import javafx.scene.media.MediaException; import org.netbeans.api.progress.ProgressHandle; -import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.ImageUtils; @@ -47,9 +46,9 @@ public class VideoFile extends DrawableFile { /** * Instantiate a VideoFile object. - * + * * @param file The file on which to base the object. - * @param analyzed + * @param analyzed */ VideoFile(AbstractFile file, Boolean analyzed) { super(file, analyzed); @@ -57,15 +56,13 @@ public class VideoFile extends DrawableFile { /** * Get the genereric video thumbnail. - * + * * @return The thumbnail. */ public static Image getGenericVideoThumbnail() { return videoIcon; } - - @Override String getMessageTemplate(final Exception exception) { return "Failed to get image preview for video {0}: " + exception.toString(); //NON-NLS @@ -80,11 +77,11 @@ public class VideoFile extends DrawableFile { /** * Get the media associated with the VideoFile. - * + * * @return The media. - * + * * @throws IOException - * @throws MediaException + * @throws MediaException */ @NbBundle.Messages({"VideoFile.getMedia.progress=writing temporary file to disk"}) public Media getMedia() throws IOException, MediaException, NoCurrentCaseException { @@ -106,24 +103,23 @@ public class VideoFile extends DrawableFile { media = new Media(Paths.get(cacheFile.getAbsolutePath()).toUri().toString()); mediaRef = new SoftReference<>(media); return media; - } @Override Double getWidth() { - double retValue = -1.0; - + double width = -1.0; try { - retValue = (double) getMedia().getWidth(); + width = getMedia().getWidth(); } catch (ReadContentInputStreamException ex) { - logger.log(Level.WARNING, "Error reading video file.", ex); //NON-NLS + logger.log(Level.WARNING, "Error reading video file", ex); //NON-NLS } catch (IOException ex) { - logger.log(Level.SEVERE, "Error writing video file to disk.", ex); //NON-NLS + logger.log(Level.SEVERE, "Error writing video file to disk", ex); //NON-NLS } catch (MediaException ex) { - logger.log(Level.SEVERE, "Error creating media from source file.", ex); //NON-NLS + logger.log(Level.SEVERE, "Error creating media from source file", ex); //NON-NLS } catch (NoCurrentCaseException ex) { - - return retValue; + logger.log(Level.SEVERE, "The current case has been closed", ex); //NON-NLS + } + return width; } @Override @@ -133,10 +129,9 @@ public class VideoFile extends DrawableFile { @Override Double getHeight() { - double retValue = -1.0; - + double height = -1.0; try { - retValue = (double) getMedia().getHeight(); + height = getMedia().getHeight(); } catch (ReadContentInputStreamException ex) { logger.log(Level.WARNING, "Error reading video file.", ex); //NON-NLS } catch (IOException ex) { @@ -144,8 +139,8 @@ public class VideoFile extends DrawableFile { } catch (MediaException ex) { logger.log(Level.SEVERE, "Error creating media from source file.", ex); //NON-NLS } catch (NoCurrentCaseException ex) { - logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS - - return retValue; + logger.log(Level.SEVERE, "The current case has been closed", ex); //NON-NLS + } + return height; } } From fb551f01bcfd5f09c460e8fcebebdfec079b7e44 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Mon, 12 Mar 2018 14:00:57 -0400 Subject: [PATCH 2/2] Fix compile error for NoCurrentCaseException in VideoFile.java --- .../org/sleuthkit/autopsy/imagegallery/datamodel/VideoFile.java | 1 + 1 file changed, 1 insertion(+) diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/VideoFile.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/VideoFile.java index ea783160e4..81fc907069 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/VideoFile.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/VideoFile.java @@ -82,6 +82,7 @@ public class VideoFile extends DrawableFile { * * @throws IOException * @throws MediaException + * @throws NoCurrentCaseException */ @NbBundle.Messages({"VideoFile.getMedia.progress=writing temporary file to disk"}) public Media getMedia() throws IOException, MediaException, NoCurrentCaseException {