mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
Updated as per pr request, added error messages
This commit is contained in:
parent
2bb8ce29fb
commit
fa9bf14dba
@ -8,7 +8,7 @@ FilesSetPanel.title=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u30bb\u30c3
|
||||
FilesSetRulePanel.extensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f
|
||||
FilesSetRulePanel.fullNameRadioButton.text=\u30d5\u30eb\u30cd\u30fc\u30e0
|
||||
FilesSetRulePanel.jLabel1.text=\u30bf\u30a4\u30d7*\uff1a
|
||||
FilesSetRulePanel.messages.emptyNameFilter=\u3053\u306e\u30eb\u30fc\u30eb\u306f\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3\u3092\u7279\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002
|
||||
FilesSetRulePanel.messages.emptyNameCondition=\u3053\u306e\u30eb\u30fc\u30eb\u306f\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3\u3092\u7279\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002
|
||||
FilesSetRulePanel.messages.invalidCharInName=\u6b63\u898f\u8868\u73fe\u4ee5\u5916\u306f\\\u3001/\u3001\:\u3001*\u3001?\u3001"\u3001<\u3001>\u3092\u540d\u524d\u306b\u542b\u3081\u307e\u305b\u3093\u3002
|
||||
FilesSetRulePanel.messages.invalidCharInPath=\u6b63\u898f\u8868\u73fe\u4ee5\u5916\u306f\\\u3001\:\u3001*\u3001?\u3001"\u3001<\u3001>\u3092\u30d1\u30b9\u306b\u542b\u3081\u307e\u305b\u3093\u3002
|
||||
FilesSetRulePanel.messages.invalidNameRegex=\u6b63\u898f\u8868\u73fe\u306f\u6709\u52b9\u306a\u540d\u524d\u3067\u306f\u3042\u308a\u307e\u305b\u3093\uff1a\n\n{0}
|
||||
|
@ -27,6 +27,7 @@ import javax.swing.JTable;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.TableColumn;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||
import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings;
|
||||
import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel;
|
||||
@ -35,6 +36,10 @@ import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel;
|
||||
* Ingest job settings panel for interesting files identifier ingest modules.
|
||||
*/
|
||||
final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobSettingsPanel implements Observer {
|
||||
@Messages({
|
||||
"FilesIdentifierIngestJobSettingsPanel.updateError=Could not update interesting files sets.",
|
||||
"FilesIdentifierIngestJobSettingsPanel.getError=Could not get interesting files sets."
|
||||
})
|
||||
|
||||
private final FilesSetsTableModel tableModel;
|
||||
|
||||
@ -80,7 +85,8 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS
|
||||
try {
|
||||
this.filesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets());
|
||||
} catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) {
|
||||
MessageNotifyUtil.Message.error("Test Error");
|
||||
MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_getError());
|
||||
this.filesSetSnapshot = new TreeMap<>();
|
||||
}
|
||||
for (FilesSet set : this.filesSetSnapshot.values()) {
|
||||
filesSetRows.add(new FilesSetRow(set, settings.interestingFilesSetIsEnabled(set.getName())));
|
||||
@ -140,7 +146,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS
|
||||
try {
|
||||
newFilesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets());
|
||||
} catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) {
|
||||
MessageNotifyUtil.Message.error("Test error");
|
||||
MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_updateError());
|
||||
return;
|
||||
}
|
||||
for (FilesSet set : newFilesSetSnapshot.values()) {
|
||||
|
@ -85,7 +85,7 @@ final class FilesIdentifierIngestModule implements FileIngestModule {
|
||||
}
|
||||
}
|
||||
} catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) {
|
||||
throw new IngestModuleException("Test");
|
||||
throw new IngestModuleException("Could not start up interesting files module.");
|
||||
}
|
||||
FilesIdentifierIngestModule.interestingFileSetsByJob.put(context.getJobId(), filesSets);
|
||||
}
|
||||
|
@ -51,10 +51,10 @@ final class InterestingItemDefsManager extends Observable {
|
||||
|
||||
private static final List<String> ILLEGAL_FILE_NAME_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", "/", ":", "*", "?", "\"", "<", ">")));
|
||||
private static final List<String> ILLEGAL_FILE_PATH_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", ":", "*", "?", "\"", "<", ">")));
|
||||
private static final String INTERESTING_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS
|
||||
private static final String LEGACY_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS
|
||||
private static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME = "InterestingFileSets.settings";
|
||||
private static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH = PlatformUtil.getUserConfigDirectory() + File.separator + INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME;
|
||||
private static final String DEFAULT_FILE_SET_DEFS_PATH = PlatformUtil.getUserConfigDirectory() + File.separator + INTERESTING_FILES_SET_DEFS_FILE_NAME;
|
||||
private static final String LEGACY_FILE_SET_DEFS_PATH = PlatformUtil.getUserConfigDirectory() + File.separator + LEGACY_FILES_SET_DEFS_FILE_NAME;
|
||||
private static InterestingItemDefsManager instance;
|
||||
|
||||
/**
|
||||
@ -93,7 +93,7 @@ final class InterestingItemDefsManager extends Observable {
|
||||
* possibly empty.
|
||||
*/
|
||||
synchronized Map<String, FilesSet> getInterestingFilesSets() throws InterestingItemDefsManagerException {
|
||||
return FilesSetXML.readDefinitionsFile(DEFAULT_FILE_SET_DEFS_PATH);
|
||||
return FilesSetXML.readDefinitionsFile(LEGACY_FILE_SET_DEFS_PATH);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -188,8 +188,7 @@ final class InterestingItemDefsManager extends Observable {
|
||||
}
|
||||
|
||||
private static Map<String, FilesSet> readSerializedDefinitions() throws InterestingItemDefsManagerException {
|
||||
throw new InterestingItemDefsManagerException("Test");
|
||||
/*String filePath = INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH;
|
||||
String filePath = INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH;
|
||||
File fileSetFile = new File(filePath);
|
||||
if (fileSetFile.exists()) {
|
||||
try {
|
||||
@ -202,7 +201,7 @@ final class InterestingItemDefsManager extends Observable {
|
||||
}
|
||||
} else {
|
||||
return new HashMap<String, FilesSet>();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -511,24 +510,28 @@ final class InterestingItemDefsManager extends Observable {
|
||||
} catch (IOException ex) {
|
||||
throw new InterestingItemDefsManagerException(String.format("Failed to write settings to %s", filePath), ex);
|
||||
}
|
||||
File xmlFile = new File(DEFAULT_FILE_SET_DEFS_PATH);
|
||||
File xmlFile = new File(LEGACY_FILE_SET_DEFS_PATH);
|
||||
if (xmlFile.exists()) {
|
||||
xmlFile.delete();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static class InterestingItemDefsManagerException extends Exception {
|
||||
|
||||
InterestingItemDefsManagerException() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
InterestingItemDefsManagerException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
InterestingItemDefsManagerException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
InterestingItemDefsManagerException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2014 Basis Technology Corp.
|
||||
* Copyright 2011-2016 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -54,7 +54,9 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp
|
||||
"InterestingItemDefsPanel.bytes=Bytes",
|
||||
"InterestingItemDefsPanel.kiloBytes=Kilobytes",
|
||||
"InterestingItemDefsPanel.megaBytes=Megabytes",
|
||||
"InterestingItemDefsPanel.gigaBytes=Gigabytes"
|
||||
"InterestingItemDefsPanel.gigaBytes=Gigabytes",
|
||||
"InterestingItemsDefsPanel.loadError=Could not load interesting files sets.",
|
||||
"InterestingItemsDefsPanel.saveError=Could not save interesting files sets."
|
||||
})
|
||||
|
||||
private static final SortedSet<MediaType> mediaTypes = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes();
|
||||
@ -125,7 +127,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp
|
||||
try {
|
||||
InterestingItemDefsManager.getInstance().setInterestingFilesSets(this.filesSets);
|
||||
} catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) {
|
||||
MessageNotifyUtil.Message.error("Test Error");
|
||||
MessageNotifyUtil.Message.error(Bundle.InterestingItemsDefsPanel_saveError());
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,7 +151,8 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp
|
||||
// by set name.
|
||||
this.filesSets = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets());
|
||||
} catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) {
|
||||
MessageNotifyUtil.Message.error("Test error");
|
||||
MessageNotifyUtil.Message.error(Bundle.InterestingItemsDefsPanel_loadError());
|
||||
this.filesSets = new TreeMap<>();
|
||||
}
|
||||
|
||||
// Populate the list model for the interesting files sets list
|
||||
|
@ -1,7 +1,20 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011-2016 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.modules.interestingitems;
|
||||
|
||||
|
@ -22,6 +22,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.openide.util.lookup.ServiceProvider;
|
||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||
import org.sleuthkit.autopsy.coreutils.Version;
|
||||
@ -39,6 +40,10 @@ import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel;
|
||||
@ServiceProvider(service = IngestModuleFactory.class)
|
||||
final public class InterestingItemsIngestModuleFactory extends IngestModuleFactoryAdapter {
|
||||
|
||||
@Messages({
|
||||
"InterestingItemsIngestModuleFactory.defaultSettingsError=Could not get default interesting files settings."
|
||||
})
|
||||
|
||||
@Override
|
||||
public String getModuleDisplayName() {
|
||||
return getModuleName();
|
||||
@ -83,7 +88,7 @@ final public class InterestingItemsIngestModuleFactory extends IngestModuleFacto
|
||||
enabledFilesSetNames.add(name);
|
||||
}
|
||||
} catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) {
|
||||
MessageNotifyUtil.Message.error("Test Error");
|
||||
MessageNotifyUtil.Message.error(Bundle.InterestingItemsIngestModuleFactory_defaultSettingsError());
|
||||
}
|
||||
return new FilesIdentifierIngestJobSettings(enabledFilesSetNames);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user