Fixed some thread-safety issues in ScalpelCarver.

This commit is contained in:
Samuel H. Kenyon 2014-04-21 11:36:57 -04:00
parent d46d055779
commit 9034e685da
2 changed files with 3 additions and 3 deletions

View File

@ -115,7 +115,7 @@ class ScalpelCarverIngestModule extends IngestModuleAdapter implements FileInges
@Override @Override
public ProcessResult process(AbstractFile abstractFile) { public ProcessResult process(AbstractFile abstractFile) {
ScalpelCarver.init(); // RJCTODO: Is this ScalpelCarver class thread-safe? ScalpelCarver.init();
if (!initialized) { if (!initialized) {
return ProcessResult.OK; return ProcessResult.OK;

View File

@ -39,7 +39,7 @@ public class ScalpelCarver {
private static final String SCALPEL_JNI_LIB = "libscalpel_jni"; private static final String SCALPEL_JNI_LIB = "libscalpel_jni";
private static final String SCALPEL_OUTPUT_FILE_NAME = "audit.txt"; private static final String SCALPEL_OUTPUT_FILE_NAME = "audit.txt";
private static 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());
private static native void carveNat(String carverInputId, ReadContentInputStream input, String configFilePath, String outputFolderPath) throws ScalpelException; private static native void carveNat(String carverInputId, ReadContentInputStream input, String configFilePath, String outputFolderPath) throws ScalpelException;
@ -48,7 +48,7 @@ public class ScalpelCarver {
} }
public static boolean init() { public static synchronized boolean init() {
if (initialized) { if (initialized) {
return true; return true;
} }