Merge branch 'collaborative' of https://github.com/sleuthkit/autopsy into collaborative

This commit is contained in:
Richard Cordovano 2015-06-19 14:29:16 -04:00
commit d27a9cd44e
8 changed files with 149 additions and 51 deletions

View File

@ -192,6 +192,7 @@
<package>org.sleuthkit.autopsy.coreutils</package> <package>org.sleuthkit.autopsy.coreutils</package>
<package>org.sleuthkit.autopsy.datamodel</package> <package>org.sleuthkit.autopsy.datamodel</package>
<package>org.sleuthkit.autopsy.directorytree</package> <package>org.sleuthkit.autopsy.directorytree</package>
<package>org.sleuthkit.autopsy.events</package>
<package>org.sleuthkit.autopsy.externalresults</package> <package>org.sleuthkit.autopsy.externalresults</package>
<package>org.sleuthkit.autopsy.filesearch</package> <package>org.sleuthkit.autopsy.filesearch</package>
<package>org.sleuthkit.autopsy.ingest</package> <package>org.sleuthkit.autopsy.ingest</package>

View File

@ -189,6 +189,7 @@ MissingImageDialog.allDesc.text=All Supported Types
MissingImageDialog.display.title=Search for Missing Image MissingImageDialog.display.title=Search for Missing Image
MissingImageDialog.confDlg.noFileSel.msg=No image file has been selected, are you sure you\nwould like to exit without finding the image. MissingImageDialog.confDlg.noFileSel.msg=No image file has been selected, are you sure you\nwould like to exit without finding the image.
MissingImageDialog.confDlg.noFileSel.title=Missing Image MissingImageDialog.confDlg.noFileSel.title=Missing Image
MissingImageDialog.ErrorSettingImage=Error setting image path. Please try again.
NewCaseVisualPanel1.getName.text=Case Info NewCaseVisualPanel1.getName.text=Case Info
NewCaseVisualPanel1.caseDirBrowse.selectButton.text=Select NewCaseVisualPanel1.caseDirBrowse.selectButton.text=Select
NewCaseVisualPanel1.badCredentials.text=Bad multi-user settings. See Tools, Options, Multi-user. NewCaseVisualPanel1.badCredentials.text=Bad multi-user settings. See Tools, Options, Multi-user.
@ -249,3 +250,5 @@ CollaborationMonitor.restoredService.notify.title=Collaboration Service Restored
CollaborationMonitor.restoredDbService.notify.msg=Connection to database server restored CollaborationMonitor.restoredDbService.notify.msg=Connection to database server restored
CollaborationMonitor.restoredSolrService.notify.msg=Connection to keyword search server restored CollaborationMonitor.restoredSolrService.notify.msg=Connection to keyword search server restored
CollaborationMonitor.restoredMessageService.notify.msg=Connection to messaging server restored CollaborationMonitor.restoredMessageService.notify.msg=Connection to messaging server restored
MissingImageDialog.lbWarning.text=
MissingImageDialog.lbWarning.toolTipText=

View File

@ -79,6 +79,7 @@ public class Case {
private static final String EVENT_CHANNEL_NAME = "%s-Case-Events"; private static final String EVENT_CHANNEL_NAME = "%s-Case-Events";
private static String appName = null; private static String appName = null;
private static IntervalErrorReportData tskErrorReporter = null; private static IntervalErrorReportData tskErrorReporter = null;
private static final int MAX_SANITIZED_NAME_LENGTH=47;
/** /**
* Name for the property that determines whether to show the dialog at * Name for the property that determines whether to show the dialog at
@ -363,15 +364,15 @@ public class Case {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss");
Date date = new Date(); Date date = new Date();
String indexName = caseName + "_" + dateFormat.format(date); String santizedCaseName = sanitizeCaseName(caseName);
String indexName = santizedCaseName + "_" + dateFormat.format(date);
String dbName = null; String dbName = null;
// figure out the database name and index name for text extraction // figure out the database name and index name for text extraction
if (caseType == CaseType.SINGLE_USER_CASE) { if (caseType == CaseType.SINGLE_USER_CASE) {
dbName = caseDir + File.separator + "autopsy.db"; //NON-NLS dbName = caseDir + File.separator + "autopsy.db"; //NON-NLS
} else if (caseType == CaseType.MULTI_USER_CASE) { } else if (caseType == CaseType.MULTI_USER_CASE) {
dbName = caseName + "_" + dateFormat.format(date); dbName = indexName;
} }
xmlcm.create(caseDir, caseName, examiner, caseNumber, caseType, dbName, indexName); // create a new XML config file xmlcm.create(caseDir, caseName, examiner, caseNumber, caseType, dbName, indexName); // create a new XML config file
@ -398,6 +399,65 @@ public class Case {
changeCase(newCase); changeCase(newCase);
} }
/**
* Sanitize the case name for PostgreSQL database, Solr cores, and ActiveMQ
* topics. Makes it plain-vanilla enough that each item should be able to
* use it.
*
* Sanitize the PostgreSQL/Solr core, and ActiveMQ name by excluding:
* Control characters
* Non-ASCII characters
* Various others shown below
*
* Solr: http://stackoverflow.com/questions/29977519/what-makes-an-invalid-core-name
* may not be / \ :
*
* ActiveMQ: http://activemq.2283324.n4.nabble.com/What-are-limitations-restrictions-on-destination-name-td4664141.html
* may not be ?
*
* PostgreSQL: http://www.postgresql.org/docs/9.4/static/sql-syntax-lexical.html
* 63 chars max, must start with a-z or _ following chars can be
* letters _ or digits
*
* SQLite: Uses autopsy.db for the database name
* follows Windows naming convention
*
* @param caseName The name of the case as typed in by the user
* @return the sanitized case name to use for Database, Solr, and ActiveMQ
*/
private static String sanitizeCaseName(String caseName) {
String result;
// Remove all non-ASCII characters
result = caseName.replaceAll("[^\\p{ASCII}]", "_");
// Remove all control characters
result = result.replaceAll("[\\p{Cntrl}]", "_");
// Remove / \ : ? space ' "
result = result.replaceAll("[ /?:'\"\\\\]", "_");
// Make it all lowercase
result = result.toLowerCase();
// Must start with letter or underscore for PostgreSQL. If not, prepend an underscore.
if (result.length() > 0 && !(Character.isLetter(result.codePointAt(0))) && !(result.codePointAt(0) == '_')) {
result = "_" + result;
}
// Chop to 63-16=47 left (63 max for PostgreSQL, taking 16 for the date _20151225_123456)
if (result.length() > MAX_SANITIZED_NAME_LENGTH) {
result = result.substring(0, MAX_SANITIZED_NAME_LENGTH);
}
if (result.isEmpty()) {
result = "case";
}
return result;
}
/** /**
* Opens the existing case (open the XML config file) * Opens the existing case (open the XML config file)
* *
@ -494,11 +554,11 @@ public class Case {
String path = entry.getValue(); String path = entry.getValue();
boolean fileExists = (pathExists(path) boolean fileExists = (pathExists(path)
|| driveExists(path)); || driveExists(path));
if (!fileExists) { if (!fileExists && IngestManager.getInstance().isRunningInteractively() == true) {
int ret = JOptionPane.showConfirmDialog(null, int ret = JOptionPane.showConfirmDialog(null,
NbBundle.getMessage(Case.class, NbBundle.getMessage(Case.class,
"Case.checkImgExist.confDlg.doesntExist.msg", "Case.checkImgExist.confDlg.doesntExist.msg",
appName, path), getAppName(), path),
NbBundle.getMessage(Case.class, NbBundle.getMessage(Case.class,
"Case.checkImgExist.confDlg.doesntExist.title"), "Case.checkImgExist.confDlg.doesntExist.title"),
JOptionPane.YES_NO_OPTION); JOptionPane.YES_NO_OPTION);

View File

@ -112,12 +112,17 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lbWarning" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="pathNameTextField" min="-2" pref="285" max="-2" attributes="0"/> <Component id="pathNameTextField" min="-2" pref="285" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="browseButton" min="-2" max="-2" attributes="0"/> <Component id="browseButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="83" max="32767" attributes="0"/> <EmptySpace pref="83" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</Group>
</Group>
</DimensionLayout> </DimensionLayout>
<DimensionLayout dim="1"> <DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
@ -127,7 +132,9 @@
<Component id="pathNameTextField" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="pathNameTextField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="browseButton" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="browseButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace pref="62" max="32767" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="lbWarning" pref="19" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -153,6 +160,22 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseButtonActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseButtonActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JLabel" name="lbWarning">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="12" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="f4" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="MissingImageDialog.lbWarning.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="MissingImageDialog.lbWarning.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents> </SubComponents>
</Container> </Container>
<Component class="javax.swing.JLabel" name="titleLabel"> <Component class="javax.swing.JLabel" name="titleLabel">

View File

@ -65,7 +65,6 @@ class MissingImageDialog extends javax.swing.JDialog {
fc.addChoosableFileFilter(encaseFilter); fc.addChoosableFileFilter(encaseFilter);
fc.setFileFilter(allFilter); fc.setFileFilter(allFilter);
customInit(); customInit();
} }
@ -138,6 +137,7 @@ class MissingImageDialog extends javax.swing.JDialog {
containerPanel = new javax.swing.JPanel(); containerPanel = new javax.swing.JPanel();
pathNameTextField = new javax.swing.JTextField(); pathNameTextField = new javax.swing.JTextField();
browseButton = new javax.swing.JButton(); browseButton = new javax.swing.JButton();
lbWarning = new javax.swing.JLabel();
titleLabel = new javax.swing.JLabel(); titleLabel = new javax.swing.JLabel();
titleSeparator = new javax.swing.JSeparator(); titleSeparator = new javax.swing.JSeparator();
@ -192,16 +192,24 @@ class MissingImageDialog extends javax.swing.JDialog {
} }
}); });
lbWarning.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
lbWarning.setForeground(new java.awt.Color(244, 0, 0));
org.openide.awt.Mnemonics.setLocalizedText(lbWarning, org.openide.util.NbBundle.getMessage(MissingImageDialog.class, "MissingImageDialog.lbWarning.text")); // NOI18N
lbWarning.setToolTipText(org.openide.util.NbBundle.getMessage(MissingImageDialog.class, "MissingImageDialog.lbWarning.toolTipText")); // NOI18N
javax.swing.GroupLayout containerPanelLayout = new javax.swing.GroupLayout(containerPanel); javax.swing.GroupLayout containerPanelLayout = new javax.swing.GroupLayout(containerPanel);
containerPanel.setLayout(containerPanelLayout); containerPanel.setLayout(containerPanelLayout);
containerPanelLayout.setHorizontalGroup( containerPanelLayout.setHorizontalGroup(
containerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) containerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(containerPanelLayout.createSequentialGroup() .addGroup(containerPanelLayout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(containerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lbWarning, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(containerPanelLayout.createSequentialGroup()
.addComponent(pathNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 285, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pathNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 285, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(browseButton) .addComponent(browseButton)
.addContainerGap(83, Short.MAX_VALUE)) .addContainerGap(83, Short.MAX_VALUE))))
); );
containerPanelLayout.setVerticalGroup( containerPanelLayout.setVerticalGroup(
containerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) containerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -210,12 +218,13 @@ class MissingImageDialog extends javax.swing.JDialog {
.addGroup(containerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(containerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(pathNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pathNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(browseButton)) .addComponent(browseButton))
.addContainerGap(62, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(lbWarning, javax.swing.GroupLayout.DEFAULT_SIZE, 19, Short.MAX_VALUE)
.addGap(18, 18, 18))
); );
titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD, 12)); titleLabel.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(titleLabel, org.openide.util.NbBundle org.openide.awt.Mnemonics.setLocalizedText(titleLabel, org.openide.util.NbBundle.getMessage(MissingImageDialog.class, "MissingImageDialog.titleLabel.text")); // NOI18N
.getMessage(MissingImageDialog.class, "MissingImageDialog.titleLabel.text")); // NOI18N
titleSeparator.setForeground(new java.awt.Color(102, 102, 102)); titleSeparator.setForeground(new java.awt.Color(102, 102, 102));
@ -255,10 +264,11 @@ class MissingImageDialog extends javax.swing.JDialog {
String newPath = pathNameTextField.getText(); String newPath = pathNameTextField.getText();
//TODO handle local files //TODO handle local files
db.setImagePaths(obj_id, Arrays.asList(new String[]{newPath})); db.setImagePaths(obj_id, Arrays.asList(new String[]{newPath}));
this.dispose();
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
lbWarning.setText(NbBundle.getMessage(this.getClass(), "MissingImageDialog.ErrorSettingImage"));
logger.log(Level.WARNING, "Error setting image paths", ex); //NON-NLS logger.log(Level.WARNING, "Error setting image paths", ex); //NON-NLS
} }
this.dispose();
}//GEN-LAST:event_selectButtonActionPerformed }//GEN-LAST:event_selectButtonActionPerformed
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
@ -274,7 +284,7 @@ class MissingImageDialog extends javax.swing.JDialog {
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
String oldText = pathNameTextField.getText(); String oldText = pathNameTextField.getText();
lbWarning.setText("");
// set the current directory of the FileChooser if the ImagePath Field is valid // set the current directory of the FileChooser if the ImagePath Field is valid
File currentDir = new File(oldText); File currentDir = new File(oldText);
if (currentDir.exists()) { if (currentDir.exists()) {
@ -295,6 +305,7 @@ class MissingImageDialog extends javax.swing.JDialog {
private javax.swing.JPanel buttonPanel; private javax.swing.JPanel buttonPanel;
private javax.swing.JButton cancelButton; private javax.swing.JButton cancelButton;
private javax.swing.JPanel containerPanel; private javax.swing.JPanel containerPanel;
private javax.swing.JLabel lbWarning;
private javax.swing.JTextField pathNameTextField; private javax.swing.JTextField pathNameTextField;
private javax.swing.JButton selectButton; private javax.swing.JButton selectButton;
private javax.swing.JLabel titleLabel; private javax.swing.JLabel titleLabel;

View File

@ -52,16 +52,16 @@
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="cbEnableMultiUser" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="cbEnableMultiUser" alignment="3" max="32767" attributes="0"/>
<Component id="lbOops" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="lbOops" alignment="3" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace max="32767" attributes="0"/> <EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
<Component id="pnDatabaseSettings" min="-2" max="-2" attributes="0"/> <Component id="pnDatabaseSettings" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="pnSolrSettings" min="-2" max="-2" attributes="0"/> <Component id="pnSolrSettings" min="-2" pref="106" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="pnMessagingSettings" min="-2" max="-2" attributes="0"/> <Component id="pnMessagingSettings" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>

View File

@ -322,15 +322,15 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnOverallPanelLayout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnOverallPanelLayout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(pnOverallPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(pnOverallPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cbEnableMultiUser) .addComponent(cbEnableMultiUser, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lbOops)) .addComponent(lbOops, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(16, 16, 16)
.addComponent(pnDatabaseSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pnDatabaseSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pnSolrSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pnSolrSettings, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pnMessagingSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pnMessagingSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap()) .addGap(35, 35, 35))
); );
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
@ -378,22 +378,22 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
void load() { void load() {
CaseDbConnectionInfo dbInfo = UserPreferences.getDatabaseConnectionInfo(); CaseDbConnectionInfo dbInfo = UserPreferences.getDatabaseConnectionInfo();
tbHostnameOrIp.setText(dbInfo.getHost()); tbHostnameOrIp.setText(dbInfo.getHost().trim());
tbPortNumber.setText(dbInfo.getPort()); tbPortNumber.setText(dbInfo.getPort().trim());
tbUsername.setText(dbInfo.getUserName()); tbUsername.setText(dbInfo.getUserName().trim());
tbPassword.setText(dbInfo.getPassword()); tbPassword.setText(dbInfo.getPassword());
MessageServiceConnectionInfo msgServiceInfo = UserPreferences.getMessageServiceConnectionInfo(); MessageServiceConnectionInfo msgServiceInfo = UserPreferences.getMessageServiceConnectionInfo();
msgHostTextField.setText(msgServiceInfo.getHost()); msgHostTextField.setText(msgServiceInfo.getHost().trim());
msgPortTextField.setText(msgServiceInfo.getPort()); msgPortTextField.setText(msgServiceInfo.getPort().trim());
msgUserNameTextField.setText(msgServiceInfo.getUserName()); msgUserNameTextField.setText(msgServiceInfo.getUserName().trim());
msgPasswordField.setText(msgServiceInfo.getPassword()); msgPasswordField.setText(msgServiceInfo.getPassword());
String indexingServerHost = UserPreferences.getIndexingServerHost(); String indexingServerHost = UserPreferences.getIndexingServerHost().trim();
if (!indexingServerHost.isEmpty()) { if (!indexingServerHost.isEmpty()) {
tbIndexingServerHost.setText(indexingServerHost); tbIndexingServerHost.setText(indexingServerHost);
} }
String indexingServerPort = UserPreferences.getIndexingServerPort(); String indexingServerPort = UserPreferences.getIndexingServerPort().trim();
if (portNumberIsValid(indexingServerPort)) { if (portNumberIsValid(indexingServerPort)) {
tbIndexingServerPort.setText(indexingServerPort); tbIndexingServerPort.setText(indexingServerPort);
} }
@ -427,23 +427,23 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
} }
CaseDbConnectionInfo info = new CaseDbConnectionInfo( CaseDbConnectionInfo info = new CaseDbConnectionInfo(
tbHostnameOrIp.getText(), tbHostnameOrIp.getText().trim(),
tbPortNumber.getText(), tbPortNumber.getText().trim(),
tbUsername.getText(), tbUsername.getText().trim(),
new String(tbPassword.getPassword()), new String(tbPassword.getPassword()),
dbType); dbType);
UserPreferences.setDatabaseConnectionInfo(info); UserPreferences.setDatabaseConnectionInfo(info);
MessageServiceConnectionInfo msgServiceInfo = new MessageServiceConnectionInfo( MessageServiceConnectionInfo msgServiceInfo = new MessageServiceConnectionInfo(
msgUserNameTextField.getText(), msgUserNameTextField.getText().trim(),
new String(msgPasswordField.getPassword()), new String(msgPasswordField.getPassword()),
msgHostTextField.getText(), msgHostTextField.getText().trim(),
msgPortTextField.getText()); msgPortTextField.getText().trim());
UserPreferences.setMessageServiceConnectionInfo(msgServiceInfo); UserPreferences.setMessageServiceConnectionInfo(msgServiceInfo);
UserPreferences.setIndexingServerHost(tbIndexingServerHost.getText()); UserPreferences.setIndexingServerHost(tbIndexingServerHost.getText().trim());
UserPreferences.setIndexingServerPort(Integer.parseInt(tbIndexingServerPort.getText())); UserPreferences.setIndexingServerPort(Integer.parseInt(tbIndexingServerPort.getText().trim()));
} }

View File

@ -837,7 +837,7 @@ public final class ImageGalleryController {
for (FileSystem fs : image.getFileSystems()) { for (FileSystem fs : image.getFileSystems()) {
fsObjIds.add(fs.getId()); fsObjIds.add(fs.getId());
} }
fsQuery = "(fs_obj_id = " + StringUtils.join(fsObjIds, " or fs_obj_id = ") + ") "; fsQuery = "(fs_obj_id = " + StringUtils.join(fsObjIds, " OR fs_obj_id = ") + ") ";
} // NOTE: Logical files currently (Apr '15) have a null value for fs_obj_id in DB. } // NOTE: Logical files currently (Apr '15) have a null value for fs_obj_id in DB.
// for them, we will not specify a fs_obj_id, which means we will grab files // for them, we will not specify a fs_obj_id, which means we will grab files
// from another data source, but the drawable DB is smart enough to de-dupe them. // from another data source, but the drawable DB is smart enough to de-dupe them.
@ -845,7 +845,7 @@ public final class ImageGalleryController {
fsQuery = "(fs_obj_id IS NULL) "; fsQuery = "(fs_obj_id IS NULL) ";
} }
files = getSleuthKitCase().findAllFilesWhere(fsQuery + " and " + DRAWABLE_QUERY); files = getSleuthKitCase().findAllFilesWhere(fsQuery + " AND " + DRAWABLE_QUERY);
progressHandle.switchToDeterminate(files.size()); progressHandle.switchToDeterminate(files.size());
//do in transaction //do in transaction