mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 16:36:15 +00:00
Bubble dialogs for exception firewall (common with Python modules), better Python load error
This commit is contained in:
parent
91648425fb
commit
404ea583b0
@ -24,6 +24,7 @@ import java.util.List;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||||
import org.sleuthkit.datamodel.Content;
|
import org.sleuthkit.datamodel.Content;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,6 +111,11 @@ final class DataSourceIngestPipeline {
|
|||||||
logger.log(Level.INFO, "{0} analysis of {1} (jobId={2}) finished", new Object[]{module.getDisplayName(), this.job.getDataSource().getName(), this.job.getDataSource().getId()});
|
logger.log(Level.INFO, "{0} analysis of {1} (jobId={2}) finished", new Object[]{module.getDisplayName(), this.job.getDataSource().getName(), this.job.getDataSource().getId()});
|
||||||
} catch (Throwable ex) { // Catch-all exception firewall
|
} catch (Throwable ex) { // Catch-all exception firewall
|
||||||
errors.add(new IngestModuleError(module.getDisplayName(), ex));
|
errors.add(new IngestModuleError(module.getDisplayName(), ex));
|
||||||
|
String msg = ex.getMessage();
|
||||||
|
// Jython run-time errors don't seem to have a message, but have details in toString.
|
||||||
|
if (msg == null)
|
||||||
|
msg = ex.toString();
|
||||||
|
MessageNotifyUtil.Notify.error(module.getDisplayName() + " Error", msg);
|
||||||
}
|
}
|
||||||
if (this.job.isCancelled()) {
|
if (this.job.isCancelled()) {
|
||||||
break;
|
break;
|
||||||
|
@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.ingest;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,6 +120,11 @@ final class FileIngestPipeline {
|
|||||||
module.process(file);
|
module.process(file);
|
||||||
} catch (Throwable ex) { // Catch-all exception firewall
|
} catch (Throwable ex) { // Catch-all exception firewall
|
||||||
errors.add(new IngestModuleError(module.getDisplayName(), ex));
|
errors.add(new IngestModuleError(module.getDisplayName(), ex));
|
||||||
|
String msg = ex.getMessage();
|
||||||
|
// Jython run-time errors don't seem to have a message, but have details in toString.
|
||||||
|
if (msg == null)
|
||||||
|
msg = ex.toString();
|
||||||
|
MessageNotifyUtil.Notify.error(module.getDisplayName() + " Error", msg);
|
||||||
}
|
}
|
||||||
if (this.job.isCancelled()) {
|
if (this.job.isCancelled()) {
|
||||||
break;
|
break;
|
||||||
@ -144,6 +150,11 @@ final class FileIngestPipeline {
|
|||||||
module.shutDown();
|
module.shutDown();
|
||||||
} catch (Throwable ex) { // Catch-all exception firewall
|
} catch (Throwable ex) { // Catch-all exception firewall
|
||||||
errors.add(new IngestModuleError(module.getDisplayName(), ex));
|
errors.add(new IngestModuleError(module.getDisplayName(), ex));
|
||||||
|
String msg = ex.getMessage();
|
||||||
|
// Jython run-time errors don't seem to have a message, but have details in toString.
|
||||||
|
if (msg == null)
|
||||||
|
msg = ex.toString();
|
||||||
|
MessageNotifyUtil.Notify.error(module.getDisplayName() + " Error", msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.running = false;
|
this.running = false;
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
JythonModuleLoader.errorMessages.failedToOpenModule=Failed to open {0}. See log for details.
|
JythonModuleLoader.errorMessages.failedToOpenModule=Failed to open {0}. See log for details.
|
||||||
JythonModuleLoader.errorMessages.failedToLoadModule=Failed to load {0} from {1}. See log for details.
|
JythonModuleLoader.errorMessages.failedToLoadModule=Failed to load {0}. {1}. See log for details.
|
@ -81,8 +81,9 @@ public final class JythonModuleLoader {
|
|||||||
objects.add( createObjectFromScript(script, className, interfaceClass));
|
objects.add( createObjectFromScript(script, className, interfaceClass));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logger.log(Level.SEVERE, String.format("Failed to load %s from %s", className, script.getAbsolutePath()), ex); //NON-NLS
|
logger.log(Level.SEVERE, String.format("Failed to load %s from %s", className, script.getAbsolutePath()), ex); //NON-NLS
|
||||||
|
// NOTE: using ex.toString() because the current version is always returning null for ex.getMessage().
|
||||||
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(
|
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(
|
||||||
NbBundle.getMessage(JythonModuleLoader.class, "JythonModuleLoader.errorMessages.failedToLoadModule", className, script.getAbsolutePath()),
|
NbBundle.getMessage(JythonModuleLoader.class, "JythonModuleLoader.errorMessages.failedToLoadModule", className, ex.toString()),
|
||||||
NotifyDescriptor.ERROR_MESSAGE));
|
NotifyDescriptor.ERROR_MESSAGE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user