mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
Fixed poorly formatted error message containing stack trace info
This commit is contained in:
parent
8b2ea61e27
commit
04b48ce39e
3 changed files with 35 additions and 22 deletions
|
@ -496,34 +496,38 @@ class PluginManager {
|
|||
}
|
||||
|
||||
private void initConfigStates(Map<String, SaveState> map) throws PluginException {
|
||||
StringBuffer errMsg = new StringBuffer();
|
||||
StringBuilder errMsg = new StringBuilder();
|
||||
Iterator<Plugin> it = pluginList.iterator();
|
||||
while (it.hasNext()) {
|
||||
Plugin p = it.next();
|
||||
configure(p, map, errMsg);
|
||||
readSaveState(p, map, errMsg);
|
||||
}
|
||||
if (errMsg.length() > 0) {
|
||||
throw new PluginException(errMsg.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private void configure(Plugin p, Map<String, SaveState> map, StringBuffer errMsg) {
|
||||
private void readSaveState(Plugin p, Map<String, SaveState> map, StringBuilder errMsg) {
|
||||
SaveState ss = map.get(p.getClass().getName());
|
||||
if (ss != null) {
|
||||
try {
|
||||
p.readConfigState(ss);
|
||||
}
|
||||
catch (Exception e) {
|
||||
errMsg.append("Problem restoring plugin state for: " + p.getName()).append("\n\n");
|
||||
errMsg.append(e.getClass().getName()).append(": ").append(e.getMessage()).append(
|
||||
'\n');
|
||||
StackTraceElement[] st = e.getStackTrace();
|
||||
int depth = Math.min(5, st.length); // only show the important stuff (magic guess)
|
||||
for (int j = 0; j < depth; j++) {
|
||||
errMsg.append(" ").append(st[j].toString()).append('\n');
|
||||
}
|
||||
errMsg.append('\n'); // extra break between this and future messages
|
||||
if (ss == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
p.readConfigState(ss);
|
||||
}
|
||||
catch (Exception e) {
|
||||
errMsg.append("Problem restoring plugin state for: " + p.getName()).append("\n\n");
|
||||
errMsg.append(e.getClass().getName())
|
||||
.append(": ")
|
||||
.append(e.getMessage())
|
||||
.append('\n');
|
||||
StackTraceElement[] st = e.getStackTrace();
|
||||
int depth = Math.min(5, st.length); // only show the important stuff (magic guess)
|
||||
for (int j = 0; j < depth; j++) {
|
||||
errMsg.append(" ").append(st[j].toString()).append('\n');
|
||||
}
|
||||
errMsg.append('\n'); // extra break between this and future messages
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -562,7 +562,7 @@ public abstract class PluginTool extends AbstractDockingTool {
|
|||
}
|
||||
catch (PluginException e) {
|
||||
hasErrors = true;
|
||||
Msg.showError(this, getToolFrame(), "Error Restoring Plugins", e.getMessage());
|
||||
Msg.showError(this, getToolFrame(), "Error Restoring Plugins", e.getMessage(), e);
|
||||
}
|
||||
|
||||
winMgr.restoreWindowDataFromXml(root);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue