Merge pull request #3077 from millmanorama/2978-db-version-compatibility

2978 db version compatibility
This commit is contained in:
Richard Cordovano 2017-09-20 12:36:04 -04:00 committed by GitHub
commit e645d4bc14
3 changed files with 29 additions and 21 deletions

View File

@ -93,10 +93,8 @@ AddImageWizardIngestConfigVisual.getName.text=Configure Ingest Modules
AddImageWizardIterator.stepXofN=Step {0} of {1}
AddLocalFilesTask.localFileAdd.progress.text=Adding\: {0}/{1}
Case.getCurCase.exception.noneOpen=Cannot get the current case; there is no case open\!
Case.databaseConnectionInfo.error.msg=Error accessing database server connection info. See Tools, Options, Multi-user.
Case.open.msgDlg.updated.msg=Updated case database schema.\nA backup copy of the database with the following path has been made\:\n {0}
Case.open.msgDlg.updated.title=Case Database Schema Update
Case.open.exception.multiUserCaseNotEnabled=Cannot open a multi-user case if multi-user cases are not enabled. See Tools, Options, Multi-user.
Case.checkImgExist.confDlg.doesntExist.msg=One of the images associated with \n\
this case are missing. Would you like to search for them now?\n\
Previously, the image was located at\:\n\
@ -131,7 +129,6 @@ Close the folder and file and try again or you can delete the case manually.
CaseDeleteAction.msgDlg.fileInUse.title=Error\: Folder In Use
CaseDeleteAction.msgDlg.caseDelete.msg=Case {0} has been deleted.
CaseOpenAction.autFilter.title={0} Case File ( {1})
CaseOpenAction.msgDlg.cantOpenCase.title=Error Opening Case
CaseCreateAction.msgDlg.cantCreateCase.msg=Cannot create case
IntervalErrorReport.NewIssues=new issue(s)
IntervalErrorReport.TotalIssues=total issue(s)
@ -184,7 +181,6 @@ OpenRecentCasePanel.colName.caseName=Case Name
OpenRecentCasePanel.colName.path=Path
RecentCases.exception.caseIdxOutOfRange.msg=Recent case index {0} is out of range.
RecentCases.getName.text=Clear Recent Cases
RecentItems.openRecentCase.msgDlg.text=Case {0} no longer exists.
StartupWindow.title.text=Welcome
UpdateRecentCases.menuItem.clearRecentCases.text=Clear Recent Cases
UpdateRecentCases.menuItem.empty=-Empty-

View File

@ -65,6 +65,7 @@ import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.actions.OpenOutputFolderAction;
import org.sleuthkit.autopsy.appservices.AutopsyService;
import org.sleuthkit.autopsy.appservices.AutopsyService.CaseContext;
import static org.sleuthkit.autopsy.casemodule.Bundle.*;
import org.sleuthkit.autopsy.casemodule.CaseMetadata.CaseMetadataException;
import org.sleuthkit.autopsy.casemodule.events.AddingDataSourceEvent;
import org.sleuthkit.autopsy.casemodule.events.AddingDataSourceFailedEvent;
@ -110,6 +111,7 @@ import org.sleuthkit.datamodel.Image;
import org.sleuthkit.datamodel.Report;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskUnsupportedSchemaVersionException;
/**
* An Autopsy case. Currently, only one case at a time may be open.
@ -376,6 +378,7 @@ public class Case {
*
* @param eventNames The events the subscriber is interested in.
* @param subscriber The subscriber (PropertyChangeListener) to add.
*
* @deprecated Use addEventTypeSubscriber instead.
*/
@Deprecated
@ -400,6 +403,7 @@ public class Case {
*
* @param eventName The event the subscriber is interested in.
* @param subscriber The subscriber (PropertyChangeListener) to add.
*
* @deprecated Use addEventTypeSubscriber instead.
*/
@Deprecated
@ -1786,7 +1790,11 @@ public class Case {
*/
@Messages({
"Case.progressMessage.openingCaseDatabase=Opening case database...",
"Case.exceptionMessage.couldNotOpenCaseDatabase=Failed to open case database."
"Case.exceptionMessage.couldNotOpenCaseDatabase=Failed to open case database.",
"Case.unsupportedSchemaVersionMessage=Unsupported DB schema version - see log for details",
"Case.databaseConnectionInfo.error.msg=Error accessing database server connection info. See Tools, Options, Multi-User.",
"Case.open.exception.multiUserCaseNotEnabled=Cannot open a multi-user case if multi-user cases are not enabled. "
+ "See Tools, Options, Multi-user."
})
private void openCaseData(ProgressIndicator progressIndicator) throws CaseActionException {
try {
@ -1797,16 +1805,14 @@ public class Case {
} else if (UserPreferences.getIsMultiUserModeEnabled()) {
try {
caseDb = SleuthkitCase.openCase(databaseName, UserPreferences.getDatabaseConnectionInfo(), metadata.getCaseDirectory());
} catch (UserPreferencesException ex) {
throw new CaseActionException(NbBundle.getMessage(Case.class,
"Case.databaseConnectionInfo.error.msg"), ex);
throw new CaseActionException(Case_databaseConnectionInfo_error_msg(), ex);
}
} else {
throw new CaseActionException(NbBundle.getMessage(Case.class,
"Case.open.exception.multiUserCaseNotEnabled"));
throw new CaseActionException(Case_open_exception_multiUserCaseNotEnabled());
}
} catch (TskUnsupportedSchemaVersionException ex) {
throw new CaseActionException(Bundle.Case_unsupportedSchemaVersionMessage(), ex);
} catch (TskCoreException ex) {
throw new CaseActionException(Bundle.Case_exceptionMessage_couldNotOpenCaseDatabase(), ex);
}

View File

@ -28,7 +28,9 @@ import javax.swing.SwingUtilities;
import javax.swing.table.AbstractTableModel;
import org.openide.util.NbBundle;
import org.openide.windows.WindowManager;
import static org.sleuthkit.autopsy.casemodule.Bundle.*;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
/**
* Panel used by the the open recent case option of the start window.
@ -93,9 +95,13 @@ class OpenRecentCasePanel extends javax.swing.JPanel {
}
}
/*
/**
* Opens the selected case.
*/
@NbBundle.Messages({"# {0} - case name",
"RecentItems.openRecentCase.msgDlg.text=Case {0} no longer exists.",
"CaseOpenAction.msgDlg.cantOpenCase.title=Error Opening Case"})
@ThreadConfined(type = ThreadConfined.ThreadType.AWT)
private void openCase() {
if (casePaths.length < 1) {
return;
@ -110,17 +116,17 @@ class OpenRecentCasePanel extends javax.swing.JPanel {
logger.log(Level.SEVERE, "Error closing start up window", ex); //NON-NLS
}
/*
* Open the case.
*/
// try to open the case.
if (caseName.isEmpty() || caseMetadataFilePath.isEmpty() || (!new File(caseMetadataFilePath).exists())) {
//case doesn't exist
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
NbBundle.getMessage(this.getClass(), "RecentItems.openRecentCase.msgDlg.text", caseName),
NbBundle.getMessage(this.getClass(), "CaseOpenAction.msgDlg.cantOpenCase.title"),
RecentItems_openRecentCase_msgDlg_text(caseName),
CaseOpenAction_msgDlg_cantOpenCase_title(),
JOptionPane.ERROR_MESSAGE);
RecentCases.getInstance().removeRecentCase(caseName, caseMetadataFilePath); // remove the recent case if it doesn't exist anymore
StartupWindowProvider.getInstance().open();
} else {
//do actual opening on another thread
new Thread(() -> {
try {
Case.openAsCurrentCase(caseMetadataFilePath);
@ -128,10 +134,10 @@ class OpenRecentCasePanel extends javax.swing.JPanel {
SwingUtilities.invokeLater(() -> {
if (!(ex instanceof CaseActionCancelledException)) {
logger.log(Level.SEVERE, String.format("Error opening case with metadata file path %s", caseMetadataFilePath), ex); //NON-NLS
JOptionPane.showMessageDialog(
WindowManager.getDefault().getMainWindow(),
ex.getMessage(),
NbBundle.getMessage(OpenRecentCasePanel.this.getClass(), "CaseOpenAction.msgDlg.cantOpenCase.title"), //NON-NLS
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
ex.getLocalizedMessage(),
CaseOpenAction_msgDlg_cantOpenCase_title(), //NON-NLS
JOptionPane.ERROR_MESSAGE);
}
StartupWindowProvider.getInstance().open();