diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractProgramLoader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractProgramLoader.java index cd7c8fd959..f125963ea4 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractProgramLoader.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractProgramLoader.java @@ -47,7 +47,7 @@ import ghidra.util.task.TaskMonitor; * Subclasses are responsible for the actual load. *

* This {@link Loader} provides a couple processor-related options, as all {@link Program}s will - * have a processor associated with them. + * have a processor associated with them. */ public abstract class AbstractProgramLoader implements Loader { @@ -55,19 +55,19 @@ public abstract class AbstractProgramLoader implements Loader { public static final String ANCHOR_LABELS_OPTION_NAME = "Anchor Processor Defined Labels"; /** - * Loads program bytes in a particular format as a new {@link Program}. Multiple + * Loads program bytes in a particular format as a new {@link Program}. Multiple * {@link Program}s may end up getting created, depending on the nature of the format. * * @param provider The bytes to load. * @param programName The name of the {@link Program} that's being loaded. - * @param programFolder The {@link DomainFolder} where the loaded thing should be saved. Could + * @param programFolder The {@link DomainFolder} where the loaded thing should be saved. Could * be null if the thing should not be pre-saved. * @param loadSpec The {@link LoadSpec} to use during load. * @param options The load options. * @param log The message log. * @param consumer A consumer object for {@link Program}s generated. * @param monitor A cancelable task monitor. - * @return A list of loaded {@link Program}s (element 0 corresponds to primary loaded + * @return A list of loaded {@link Program}s (element 0 corresponds to primary loaded * {@link Program}). * @throws IOException if there was an IO-related problem loading. * @throws CancelledException if the user cancelled the load. @@ -77,7 +77,7 @@ public abstract class AbstractProgramLoader implements Loader { Object consumer, TaskMonitor monitor) throws IOException, CancelledException; /** - * Loads program bytes into the specified {@link Program}. This method will not create any new + * Loads program bytes into the specified {@link Program}. This method will not create any new * {@link Program}s. It is only for adding to an existing {@link Program}. *

* NOTE: The loading that occurs in this method will automatically be done in a transaction. @@ -122,7 +122,7 @@ public abstract class AbstractProgramLoader implements Loader { loadedProgram.setEventsEnabled(true); - // TODO: null should not be used as a determinant for saving; don't allow null + // TODO: null should not be used as a determinant for saving; don't allow null // folders? if (folder == null) { results.add(loadedProgram); @@ -179,8 +179,7 @@ public abstract class AbstractProgramLoader implements Loader { public List

* The default behavior of this method is to return the {@link DefaultLanguageService}. - * + * * @return The {@link Loader}'s language service. */ protected LanguageService getLanguageService() { @@ -360,7 +360,7 @@ public abstract class AbstractProgramLoader implements Loader { /** * Releases the given consumer from each of the provided {@link DomainObject}s. - * + * * @param domainObjects A list of {@link DomainObject}s which are no longer being used. * @param consumer The consumer that was marking the {@link DomainObject}s as being used. */ @@ -389,6 +389,19 @@ public abstract class AbstractProgramLoader implements Loader { throw e; } catch (Exception e) { + Throwable t = e.getCause(); + if (t == null) { + t = e; + } + String msg = t.getMessage(); + if (msg == null) { + msg = ""; + } + else { + msg = "\n" + msg; + } + Msg.showError(this, null, "Create Program Failed", + "Failed to create program file: " + uniqueName + msg, e); messageLog.appendMsg("Unexpected exception creating file: " + uniqueName); messageLog.appendException(e); return false; @@ -441,8 +454,7 @@ public abstract class AbstractProgramLoader implements Loader { if (info.getScope() != null) { namespace = info.getScope(); } - s = symTable.createLabel(addr, info.getLabel(), namespace, - info.getSource()); + s = symTable.createLabel(addr, info.getLabel(), namespace, info.getSource()); if (info.isEntry()) { symTable.addExternalEntryPoint(addr); }