ScalpelCarver - Added NON-NLS tags to hardcoded strings not needing National Language Support.

This commit is contained in:
Nick Davis 2014-04-22 16:04:43 -04:00
parent 33236d6065
commit 7b20874ecb
3 changed files with 23 additions and 23 deletions

View File

@ -53,9 +53,9 @@ import org.sleuthkit.datamodel.Volume;
class ScalpelCarverIngestModule extends IngestModuleAdapter implements FileIngestModule { class ScalpelCarverIngestModule extends IngestModuleAdapter implements FileIngestModule {
private static final Logger logger = Logger.getLogger(ScalpelCarverIngestModule.class.getName()); private static final Logger logger = Logger.getLogger(ScalpelCarverIngestModule.class.getName());
private final String MODULE_OUTPUT_DIR_NAME = "ScalpelCarver"; private final String MODULE_OUTPUT_DIR_NAME = "ScalpelCarver"; //NON-NLS
private String moduleOutputDirPath; private String moduleOutputDirPath;
private final String configFileName = "scalpel.conf"; private final String configFileName = "scalpel.conf"; //NON-NLS
private String configFilePath; private String configFilePath;
private boolean initialized = false; private boolean initialized = false;
private ScalpelCarver carver; private ScalpelCarver carver;
@ -69,8 +69,8 @@ class ScalpelCarverIngestModule extends IngestModuleAdapter implements FileInges
this.context = context; this.context = context;
// make sure this is Windows // make sure this is Windows
String os = System.getProperty("os.name"); String os = System.getProperty("os.name"); //NON-NLS
if (!os.startsWith("Windows")) { if (!os.startsWith("Windows")) { //NON-NLS
String message = NbBundle.getMessage(this.getClass(), "ScalpelCarverIngestModule.startUp.exception.msg1"); String message = NbBundle.getMessage(this.getClass(), "ScalpelCarverIngestModule.startUp.exception.msg1");
logger.log(Level.SEVERE, message); logger.log(Level.SEVERE, message);
throw new IngestModuleException(message); throw new IngestModuleException(message);
@ -132,7 +132,7 @@ class ScalpelCarverIngestModule extends IngestModuleAdapter implements FileInges
File scalpelOutputDir = new File(scalpelOutputDirPath); File scalpelOutputDir = new File(scalpelOutputDirPath);
if (!scalpelOutputDir.exists()) { if (!scalpelOutputDir.exists()) {
if (!scalpelOutputDir.mkdir()) { if (!scalpelOutputDir.mkdir()) {
logger.log(Level.SEVERE, "Could not create Scalpel output directory: {0}", scalpelOutputDirPath); logger.log(Level.SEVERE, "Could not create Scalpel output directory: {0}", scalpelOutputDirPath); //NON-NLS
return ProcessResult.OK; return ProcessResult.OK;
} }
} }
@ -143,7 +143,7 @@ class ScalpelCarverIngestModule extends IngestModuleAdapter implements FileInges
try { try {
parent = abstractFile.getParent(); parent = abstractFile.getParent();
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Exception while trying to get parent of AbstractFile.", ex); logger.log(Level.SEVERE, "Exception while trying to get parent of AbstractFile.", ex); //NON-NLS
} }
while (parent != null) { while (parent != null) {
if (parent instanceof FileSystem if (parent instanceof FileSystem
@ -155,13 +155,13 @@ class ScalpelCarverIngestModule extends IngestModuleAdapter implements FileInges
try { try {
parent = parent.getParent(); parent = parent.getParent();
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Exception while trying to get parent of Content object.", ex); logger.log(Level.SEVERE, "Exception while trying to get parent of Content object.", ex); //NON-NLS
} }
} }
// make sure we have a valid systemID // make sure we have a valid systemID
if (id == -1) { if (id == -1) {
logger.log(Level.SEVERE, "Could not get an ID for a FileSystem, Volume or Image for the given AbstractFile."); logger.log(Level.SEVERE, "Could not get an ID for a FileSystem, Volume or Image for the given AbstractFile."); //NON-NLS
return ProcessResult.OK; return ProcessResult.OK;
} }
@ -170,7 +170,7 @@ class ScalpelCarverIngestModule extends IngestModuleAdapter implements FileInges
try { try {
output = carver.carve(abstractFile, configFilePath, scalpelOutputDirPath); output = carver.carve(abstractFile, configFilePath, scalpelOutputDirPath);
} catch (ScalpelException ex) { } catch (ScalpelException ex) {
logger.log(Level.SEVERE, "Error when attempting to carved data from AbstractFile with ID {0}", abstractFile.getId()); logger.log(Level.SEVERE, "Error when attempting to carved data from AbstractFile with ID {0}", abstractFile.getId()); //NON-NLS
return ProcessResult.OK; return ProcessResult.OK;
} }
@ -184,7 +184,7 @@ class ScalpelCarverIngestModule extends IngestModuleAdapter implements FileInges
try { try {
byteOffset = abstractFile.convertToImgOffset(carvedFileMeta.getByteStart()); byteOffset = abstractFile.convertToImgOffset(carvedFileMeta.getByteStart());
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Could not calculate the image byte offset of AbstractFile ({0})", abstractFile.getName()); logger.log(Level.SEVERE, "Could not calculate the image byte offset of AbstractFile ({0})", abstractFile.getName()); //NON-NLS
break; break;
} }
@ -199,7 +199,7 @@ class ScalpelCarverIngestModule extends IngestModuleAdapter implements FileInges
try { try {
carvedFiles.add(db.addCarvedFile(carvedFileMeta.getFileName(), size, id, data)); carvedFiles.add(db.addCarvedFile(carvedFileMeta.getFileName(), size, id, data));
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.SEVERE, "There was a problem while trying to add a carved file to the database.", ex); logger.log(Level.SEVERE, "There was a problem while trying to add a carved file to the database.", ex); //NON-NLS
} }
} }
@ -212,7 +212,7 @@ class ScalpelCarverIngestModule extends IngestModuleAdapter implements FileInges
try { try {
carvedFileDir = carvedFiles.get(0).getParent(); carvedFileDir = carvedFiles.get(0).getParent();
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.SEVERE, "There was a problem while trying to obtain the carved files directory.", ex); logger.log(Level.SEVERE, "There was a problem while trying to obtain the carved files directory.", ex); //NON-NLS
} }
} }
@ -220,7 +220,7 @@ class ScalpelCarverIngestModule extends IngestModuleAdapter implements FileInges
if (carvedFileDir != null) { if (carvedFileDir != null) {
is.fireModuleContentEvent(new ModuleContentEvent(carvedFileDir)); is.fireModuleContentEvent(new ModuleContentEvent(carvedFileDir));
} else { } else {
logger.log(Level.SEVERE, "Could not obtain the carved files directory."); logger.log(Level.SEVERE, "Could not obtain the carved files directory."); //NON-NLS
} }
// reschedule carved files // reschedule carved files

View File

@ -37,8 +37,8 @@ import org.sleuthkit.datamodel.ReadContentInputStream;
*/ */
public class ScalpelCarver { public class ScalpelCarver {
private static final String SCALPEL_JNI_LIB = "libscalpel_jni"; private static final String SCALPEL_JNI_LIB = "libscalpel_jni"; //NON-NLS
private static final String SCALPEL_OUTPUT_FILE_NAME = "audit.txt"; private static final String SCALPEL_OUTPUT_FILE_NAME = "audit.txt"; //NON-NLS
private static volatile boolean initialized = false; private static volatile boolean initialized = false;
private static final Logger logger = Logger.getLogger(ScalpelCarver.class.getName()); private static final Logger logger = Logger.getLogger(ScalpelCarver.class.getName());
@ -53,16 +53,16 @@ public class ScalpelCarver {
return true; return true;
} }
initialized = true; initialized = true;
for (String library : Arrays.asList("libtre-4", "pthreadGC2", SCALPEL_JNI_LIB)) { for (String library : Arrays.asList("libtre-4", "pthreadGC2", SCALPEL_JNI_LIB)) { //NON-NLS
if (!loadLib(library)) { if (!loadLib(library)) {
initialized = false; initialized = false;
logger.log(Level.SEVERE, "Failed initializing " + ScalpelCarver.class.getName() + " due to failure loading library: " + library); logger.log(Level.SEVERE, "Failed initializing " + ScalpelCarver.class.getName() + " due to failure loading library: " + library); //NON-NLS
break; break;
} }
} }
if (initialized) { if (initialized) {
logger.log(Level.INFO, ScalpelCarver.class.getName() + " JNI initialized successfully. "); logger.log(Level.INFO, ScalpelCarver.class.getName() + " JNI initialized successfully. "); //NON-NLS
} }
return initialized; return initialized;
@ -147,14 +147,14 @@ public class ScalpelCarver {
carveNat(carverInputId, carverInput, configFilePath, outputFolderPath); carveNat(carverInputId, carverInput, configFilePath, outputFolderPath);
} }
catch (Exception e) { catch (Exception e) {
logger.log(Level.SEVERE, "Error while caving file " + file, e); logger.log(Level.SEVERE, "Error while caving file " + file, e); //NON-NLS
throw new ScalpelException(e); throw new ScalpelException(e);
} }
finally { finally {
try { try {
carverInput.close(); carverInput.close();
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.SEVERE, "Error closing input stream after carving, file: " + file, ex); logger.log(Level.SEVERE, "Error closing input stream after carving, file: " + file, ex); //NON-NLS
} }
} }
@ -166,9 +166,9 @@ public class ScalpelCarver {
try { try {
output = ScalpelOutputParser.parse(outputFile); output = ScalpelOutputParser.parse(outputFile);
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
logger.log(Level.SEVERE, "Could not find scalpel output file.", ex); logger.log(Level.SEVERE, "Could not find scalpel output file.", ex); //NON-NLS
} catch (IOException ex) { } catch (IOException ex) {
logger.log(Level.SEVERE, "IOException while processing scalpel output file.", ex); logger.log(Level.SEVERE, "IOException while processing scalpel output file.", ex); //NON-NLS
} }
return output; return output;

View File

@ -96,7 +96,7 @@ public class ScalpelOutputParser {
while (!line.isEmpty()) { while (!line.isEmpty()) {
// split the line into tokens // split the line into tokens
String[] fields = line.split("\\s+"); String[] fields = line.split("\\s+"); //NON-NLS
// get the fields of interest // get the fields of interest
String fileName = fields[0]; String fileName = fields[0];