mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Merge pull request #5813 from sleuthkit/release-4.15.0
Merge in Release 4.15.0
This commit is contained in:
commit
0eafe1189d
@ -19,8 +19,10 @@
|
||||
package org.sleuthkit.autopsy.casemodule;
|
||||
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Dialog;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
|
||||
@ -516,7 +518,7 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel {
|
||||
}//GEN-LAST:event_comboBoxOrgNameActionPerformed
|
||||
|
||||
private void bnNewOrganizationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnNewOrganizationActionPerformed
|
||||
ManageOrganizationsDialog dialog = new ManageOrganizationsDialog();
|
||||
ManageOrganizationsDialog dialog = new ManageOrganizationsDialog((Dialog) SwingUtilities.getWindowAncestor(this));
|
||||
// update the combobox options and org data fields
|
||||
loadOrganizationData();
|
||||
if (dialog.isChanged()) {
|
||||
|
@ -19,6 +19,7 @@
|
||||
package org.sleuthkit.autopsy.centralrepository.optionspanel;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dialog;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
@ -51,12 +52,41 @@ public final class ManageOrganizationsDialog extends JDialog {
|
||||
|
||||
@Messages({"ManageOrganizationsDialog.title.text=Manage Organizations"})
|
||||
/**
|
||||
* Creates new form ManageOrganizationsPanel
|
||||
* Creates new form ManageOrganizationsPanel.
|
||||
* @param parent The dialog parent.
|
||||
*/
|
||||
public ManageOrganizationsDialog() {
|
||||
super((JFrame) WindowManager.getDefault().getMainWindow(),
|
||||
public ManageOrganizationsDialog(Dialog parent) {
|
||||
super(parent,
|
||||
Bundle.ManageOrganizationsDialog_title_text(),
|
||||
true); // NON-NLS
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates new form ManageOrganizationsPanel.
|
||||
* @param parent The JFrame parent.
|
||||
*/
|
||||
public ManageOrganizationsDialog(JFrame parent) {
|
||||
super(parent,
|
||||
Bundle.ManageOrganizationsDialog_title_text(),
|
||||
true); // NON-NLS
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates new form ManageOrganizationsPanel.
|
||||
*/
|
||||
public ManageOrganizationsDialog() {
|
||||
this((JFrame) WindowManager.getDefault().getMainWindow());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To be run as a part of constructor initialization.
|
||||
*/
|
||||
private void init() {
|
||||
initComponents();
|
||||
try {
|
||||
this.dbManager = CentralRepository.getInstance();
|
||||
@ -85,6 +115,7 @@ public final class ManageOrganizationsDialog extends JDialog {
|
||||
private void display() {
|
||||
this.setLocationRelativeTo(WindowManager.getDefault().getMainWindow());
|
||||
setVisible(true);
|
||||
toFront();
|
||||
}
|
||||
|
||||
private void populateListAndSelect(CentralRepoOrganization selected) throws CentralRepoException {
|
||||
|
@ -25,8 +25,10 @@ import java.io.Reader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.logging.Level;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.textutils.EncodingUtils;
|
||||
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.ReadContentInputStream;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
@ -38,6 +40,7 @@ public final class TextFileExtractor implements TextExtractor {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(TextFileExtractor.class.getName());
|
||||
private final AbstractFile file;
|
||||
private static final String PLAIN_TEXT_MIME_TYPE = "text/plain";
|
||||
|
||||
private Charset encoding = null;
|
||||
|
||||
@ -73,7 +76,22 @@ public final class TextFileExtractor implements TextExtractor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupported() {
|
||||
return file.getMIMEType().equals("text/plain");
|
||||
public boolean isSupported() {
|
||||
// get the MIME type
|
||||
String mimeType = file.getMIMEType();
|
||||
|
||||
// if it is not present, attempt to use the FileTypeDetector to determine
|
||||
if (StringUtils.isEmpty(mimeType)) {
|
||||
FileTypeDetector fileTypeDetector = null;
|
||||
try {
|
||||
fileTypeDetector = new FileTypeDetector();
|
||||
} catch (FileTypeDetector.FileTypeDetectorInitException ex) {
|
||||
logger.log(Level.SEVERE, "Unable to create file type detector for determining MIME type", ex);
|
||||
return false;
|
||||
}
|
||||
mimeType = fileTypeDetector.getMIMEType(file);
|
||||
}
|
||||
|
||||
return PLAIN_TEXT_MIME_TYPE.equals(mimeType);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user