From 6b11521adc438376a23d8c327e658dc9be720727 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Mon, 19 Jun 2017 13:26:25 -0400 Subject: [PATCH 1/2] Fixed broken RegEx for class name normalization. --- .../autopsy/ingest/FactoryClassNameNormalizer.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/FactoryClassNameNormalizer.java b/Core/src/org/sleuthkit/autopsy/ingest/FactoryClassNameNormalizer.java index a03abea38a..2a326bca2d 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/FactoryClassNameNormalizer.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/FactoryClassNameNormalizer.java @@ -8,7 +8,7 @@ package org.sleuthkit.autopsy.ingest; import org.sleuthkit.autopsy.coreutils.Logger; /** - * Used to strip python ids on factory class names. + * Used to strip Python IDs on factory class names. */ class FactoryClassNameNormalizer { @@ -17,9 +17,11 @@ class FactoryClassNameNormalizer { static String normalize(String canonicalClassName) { if (isPythonModuleSettingsFile(canonicalClassName)) { - // compiled python modules have variable instance number as a part of their file name. - // This block of code gets rid of that variable instance number and helps maitains constant module name over multiple runs. - String moduleClassName = canonicalClassName.replaceAll("[$][\\d]", ""); //NON-NLS NON-NLS + // Compiled Python modules have variable instance number as a part + // of their file name. This block of code gets rid of that variable + // instance number and helps maitains constant module name over + // multiple runs. + String moduleClassName = canonicalClassName.replaceAll("[$\\d]", ""); //NON-NLS NON-NLS return moduleClassName; } return canonicalClassName; From 96ab9d1dfa2d4e0770d5d7c1a8782e3ee34dc616 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Tue, 20 Jun 2017 13:44:32 -0400 Subject: [PATCH 2/2] Refined RegEx to only purge numbers at the end of a string. --- .../ingest/FactoryClassNameNormalizer.java | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/FactoryClassNameNormalizer.java b/Core/src/org/sleuthkit/autopsy/ingest/FactoryClassNameNormalizer.java index 2a326bca2d..8fbeb1d19c 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/FactoryClassNameNormalizer.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/FactoryClassNameNormalizer.java @@ -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 2016-2017 Basis Technology Corp. + * Contact: carrier sleuthkit 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.ingest; @@ -21,14 +34,14 @@ class FactoryClassNameNormalizer { // of their file name. This block of code gets rid of that variable // instance number and helps maitains constant module name over // multiple runs. - String moduleClassName = canonicalClassName.replaceAll("[$\\d]", ""); //NON-NLS NON-NLS + String moduleClassName = canonicalClassName.replaceAll("\\d*$", ""); //NON-NLS NON-NLS return moduleClassName; } return canonicalClassName; } /** - * Determines if the moduleSettingsFilePath is that of a serialized jython + * Determines if the moduleSettingsFilePath is that of a serialized Jython * instance. Serialized Jython instances (settings saved on the disk) * contain "org.python.proxies." in their fileName based on the current * implementation.