Merge pull request #3590 from sleuthkit/settings_normalization

Ensure same normalization is done for loading and saving ingest prope…
This commit is contained in:
Richard Cordovano 2018-03-23 10:30:47 -04:00 committed by GitHub
commit a467227580
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -525,7 +525,7 @@ public final class IngestJobSettings {
* @return The file path. * @return The file path.
*/ */
private String getModuleSettingsFilePath(IngestModuleFactory factory) { private String getModuleSettingsFilePath(IngestModuleFactory factory) {
String fileName = factory.getClass().getCanonicalName() + IngestJobSettings.MODULE_SETTINGS_FILE_EXT; String fileName = FactoryClassNameNormalizer.normalize(factory.getClass().getCanonicalName()) + IngestJobSettings.MODULE_SETTINGS_FILE_EXT;
Path path = Paths.get(this.moduleSettingsFolderPath, fileName); Path path = Paths.get(this.moduleSettingsFolderPath, fileName);
return path.toAbsolutePath().toString(); return path.toAbsolutePath().toString();
} }
@ -564,7 +564,7 @@ public final class IngestJobSettings {
* @param settings The ingest job settings for the ingest module * @param settings The ingest job settings for the ingest module
*/ */
private void saveModuleSettings(IngestModuleFactory factory, IngestModuleIngestJobSettings settings) { private void saveModuleSettings(IngestModuleFactory factory, IngestModuleIngestJobSettings settings) {
String moduleSettingsFilePath = Paths.get(this.moduleSettingsFolderPath, FactoryClassNameNormalizer.normalize(factory.getClass().getCanonicalName()) + MODULE_SETTINGS_FILE_EXT).toString(); String moduleSettingsFilePath = getModuleSettingsFilePath(factory);
try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(moduleSettingsFilePath))) { try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(moduleSettingsFilePath))) {
out.writeObject(settings); out.writeObject(settings);
} catch (IOException ex) { } catch (IOException ex) {