7471 adjust messages and add pop up on start up if unable to open case

This commit is contained in:
William Schaefer 2021-04-12 18:58:21 -04:00
parent 63e3e1d372
commit bfd7701d11
4 changed files with 28 additions and 6 deletions

View File

@ -1,4 +1,4 @@
CTL_ResetWindowsAction=Reset Windows CTL_ResetWindowsAction=Reset Windows
ResetWindowAction.caseCloseFailure.text=Unable to close the current case, the software will restart and the windows locations will reset the next time the software is closed. ResetWindowAction.caseCloseFailure.text=Unable to close the current case, the software will restart and the windows locations will reset the next time the software is closed.
ResetWindowAction.caseSaveMetadata.text=Unable to save current case path, the software will restart and the windows locations will reset but the current case will not be opened upon restart. ResetWindowAction.caseSaveMetadata.text=Unable to save current case path, the software will restart and the windows locations will reset but the current case will not be opened upon restart.
ResetWindowAction.confirm.text=In order to perform the resetting of window locations the software will close and restart. If a case is currently open it will be closed. If ingest or a search is currently running it will be terminated. Are you sure you want to restart the software to reset all window locations? ResetWindowAction.confirm.text=In order to perform the resetting of window locations the software will close and restart. If a case is currently open, it will be closed. If ingest or a search is currently running, it will be terminated. Are you sure you want to restart the software to reset all window locations?

View File

@ -61,7 +61,7 @@ public final class ResetWindowsAction extends CallableSystemAction {
} }
@NbBundle.Messages({"ResetWindowAction.confirm.text=In order to perform the resetting of window locations the software will close and restart. " @NbBundle.Messages({"ResetWindowAction.confirm.text=In order to perform the resetting of window locations the software will close and restart. "
+ "If a case is currently open it will be closed. If ingest or a search is currently running it will be terminated. " + "If a case is currently open, it will be closed. If ingest or a search is currently running, it will be terminated. "
+ "Are you sure you want to restart the software to reset all window locations?", + "Are you sure you want to restart the software to reset all window locations?",
"ResetWindowAction.caseCloseFailure.text=Unable to close the current case, " "ResetWindowAction.caseCloseFailure.text=Unable to close the current case, "
+ "the software will restart and the windows locations will reset the next time the software is closed.", + "the software will restart and the windows locations will reset the next time the software is closed.",
@ -90,7 +90,7 @@ public final class ResetWindowsAction extends CallableSystemAction {
if (Case.isCaseOpen()) { if (Case.isCaseOpen()) {
String caseMetadataFilePath = Case.getCurrentCase().getMetadata().getFilePath().toString(); String caseMetadataFilePath = Case.getCurrentCase().getMetadata().getFilePath().toString();
File caseToOpenFile = new File(ResetWindowsAction.getCaseToReopenFilePath()); File caseToOpenFile = new File(ResetWindowsAction.getCaseToReopenFilePath());
Charset encoding = null; Charset encoding = null; //prevents writeStringToFile from having ambiguous arguments
FileUtils.writeStringToFile(caseToOpenFile, caseMetadataFilePath, encoding); FileUtils.writeStringToFile(caseToOpenFile, caseMetadataFilePath, encoding);
Case.closeCurrentCase(); Case.closeCurrentCase();
} }

View File

@ -346,6 +346,12 @@ RecentCases.getName.text=Clear Recent Cases
RecentItems.openRecentCase.msgDlg.text=Case {0} no longer exists. RecentItems.openRecentCase.msgDlg.text=Case {0} no longer exists.
SelectDataSourceProcessorPanel.name.text=Select Data Source Type SelectDataSourceProcessorPanel.name.text=Select Data Source Type
StartupWindow.title.text=Welcome StartupWindow.title.text=Welcome
# {0} - autFilePath
StartupWindowProvider.openCase.cantOpen=Unable to open previously open case with metadata file: {0}
# {0} - reOpenFilePath
StartupWindowProvider.openCase.deleteOpenFailure=Unable to open or delete file containing path {0} to previously open case. The previous case will not be opened.
# {0} - autFilePath
StartupWindowProvider.openCase.noFile=Unable to open previously open case because metadata file not found at: {0}
UnpackagePortableCaseDialog.title.text=Unpackage Portable Case UnpackagePortableCaseDialog.title.text=Unpackage Portable Case
UnpackagePortableCaseDialog.UnpackagePortableCaseDialog.extensions=Portable case package (.zip, .zip.001) UnpackagePortableCaseDialog.UnpackagePortableCaseDialog.extensions=Portable case package (.zip, .zip.001)
UnpackagePortableCaseDialog.validatePaths.badExtension=File extension must be .zip or .zip.001 UnpackagePortableCaseDialog.validatePaths.badExtension=File extension must be .zip or .zip.001

View File

@ -25,6 +25,7 @@ import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.logging.Level; import java.util.logging.Level;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.apputils.ResetWindowsAction; import org.sleuthkit.autopsy.apputils.ResetWindowsAction;
@ -65,6 +66,13 @@ public class StartupWindowProvider implements StartupWindowInterface {
return instance; return instance;
} }
@NbBundle.Messages({
"# {0} - autFilePath",
"StartupWindowProvider.openCase.noFile=Unable to open previously open case because metadata file not found at: {0}",
"# {0} - reOpenFilePath",
"StartupWindowProvider.openCase.deleteOpenFailure=Unable to open or delete file containing path {0} to previously open case. The previous case will not be opened.",
"# {0} - autFilePath",
"StartupWindowProvider.openCase.cantOpen=Unable to open previously open case with metadata file: {0}"})
private void init() { private void init() {
if (startupWindowToUse == null) { if (startupWindowToUse == null) {
// first check whether we are running from command line // first check whether we are running from command line
@ -90,7 +98,9 @@ public class StartupWindowProvider implements StartupWindowInterface {
File openPreviousCaseFile = new File(ResetWindowsAction.getCaseToReopenFilePath()); File openPreviousCaseFile = new File(ResetWindowsAction.getCaseToReopenFilePath());
String caseFilePath = ""; String caseFilePath = "";
if (openPreviousCaseFile.exists()) { if (openPreviousCaseFile.exists()) {
String unableToOpenMessage = null;
try { try {
Charset encoding = null; Charset encoding = null;
caseFilePath = FileUtils.readFileToString(openPreviousCaseFile, encoding); caseFilePath = FileUtils.readFileToString(openPreviousCaseFile, encoding);
@ -100,12 +110,18 @@ public class StartupWindowProvider implements StartupWindowInterface {
//the case is now open we do not want to display the start up windows //the case is now open we do not want to display the start up windows
return; return;
} else { } else {
logger.log(Level.WARNING, "Unable to open previously open case because metadata file not found at: {0}", caseFilePath); unableToOpenMessage = Bundle.StartupWindowProvider_openCase_noFile(caseFilePath);
logger.log(Level.WARNING, unableToOpenMessage);
} }
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.WARNING, "Unable to open or delete file containing path " + ResetWindowsAction.getCaseToReopenFilePath() + " to previously open case, will not open previous case.", ex); unableToOpenMessage = Bundle.StartupWindowProvider_openCase_deleteOpenFailure(ResetWindowsAction.getCaseToReopenFilePath());
logger.log(Level.WARNING, unableToOpenMessage, ex);
} catch (CaseActionException ex) { } catch (CaseActionException ex) {
logger.log(Level.WARNING, "Unable to open previously open case with metadata file: " + caseFilePath, ex); unableToOpenMessage = Bundle.StartupWindowProvider_openCase_cantOpen(caseFilePath);
logger.log(Level.WARNING, unableToOpenMessage, ex);
}
if (RuntimeProperties.runningWithGUI() && !StringUtils.isBlank(unableToOpenMessage)) {
MessageNotifyUtil.Message.warn(unableToOpenMessage);
} }
} }
//discover the registered windows //discover the registered windows