mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
3845 fix codacy issues with object detection module
This commit is contained in:
parent
9d2639a177
commit
ab4aefc9cc
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.experimental.objectDetection;
|
||||
package org.sleuthkit.autopsy.experimental.objectdetection;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -83,13 +83,11 @@ public class ObjectDetectectionFileIngestModule extends FileIngestModuleAdapter
|
||||
} else {
|
||||
throw new IngestModule.IngestModuleException("Unable to load classifiers for object detection module.");
|
||||
}
|
||||
if (refCounter.incrementAndGet(jobId) == 1) {
|
||||
if (classifiers.isEmpty()) {
|
||||
if (refCounter.incrementAndGet(jobId) == 1 && classifiers.isEmpty()) {
|
||||
services.postMessage(IngestMessage.createWarningMessage(ObjectDetectionModuleFactory.getModuleName(),
|
||||
Bundle.ObjectDetectionFileIngestModule_noClassifiersFound_subject(),
|
||||
Bundle.ObjectDetectionFileIngestModule_noClassifiersFound_message(PlatformUtil.getObjectDetectionClassifierPath())));
|
||||
}
|
||||
}
|
||||
try {
|
||||
blackboard = Case.getCurrentCaseThrows().getServices().getBlackboard();
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
@ -100,8 +98,8 @@ public class ObjectDetectectionFileIngestModule extends FileIngestModuleAdapter
|
||||
@Messages({"# {0} - detectionCount", "ObjectDetectionFileIngestModule.classifierDetection.text=Classifier detected {0} object(s)"})
|
||||
@Override
|
||||
public ProcessResult process(AbstractFile file) {
|
||||
if (!classifiers.isEmpty()) {
|
||||
if (ImageUtils.isImageThumbnailSupported(file)) { //Any image we can create a thumbnail for is one we should apply the classifiers to
|
||||
if (!classifiers.isEmpty() && ImageUtils.isImageThumbnailSupported(file)) {
|
||||
//Any image we can create a thumbnail for is one we should apply the classifiers to
|
||||
InputStream inputStream = new ReadContentInputStream(file);
|
||||
byte[] imageInMemory;
|
||||
try {
|
||||
@ -136,8 +134,7 @@ public class ObjectDetectectionFileIngestModule extends FileIngestModuleAdapter
|
||||
}
|
||||
|
||||
/*
|
||||
* Send an event to update the view with the new
|
||||
* result.
|
||||
* Send an event to update the view with the new result.
|
||||
*/
|
||||
services.fireModuleDataEvent(new ModuleDataEvent(ObjectDetectionModuleFactory.getModuleName(), TSK_OBJECT_DETECTED, Collections.singletonList(artifact)));
|
||||
} catch (TskCoreException ex) {
|
||||
@ -147,7 +144,6 @@ public class ObjectDetectectionFileIngestModule extends FileIngestModuleAdapter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return IngestModule.ProcessResult.OK;
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.experimental.objectDetection;
|
||||
package org.sleuthkit.autopsy.experimental.objectdetection;
|
||||
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.openide.util.lookup.ServiceProvider;
|
Loading…
x
Reference in New Issue
Block a user