mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-01 03:37:26 +08:00
Merge remote-tracking branch 'origin/GP-3-dragonmacher-error-message-fix'
This commit is contained in:
@@ -66,7 +66,13 @@ public class DockingErrorDisplay implements ErrorDisplay {
|
||||
private static String wrap(String text) {
|
||||
|
||||
StringBuilder buffy = new StringBuilder();
|
||||
List<String> lines = HtmlLineSplitter.split(text, 100, true);
|
||||
|
||||
// Wrap any poorly formatted text that gets displayed in the label; 80-100 chars is
|
||||
// a reasonable line length based on historical print margins.
|
||||
// Update: increased the limit to handle long messages containing stack trace elements,
|
||||
// which look odd when wrapped
|
||||
int limit = 120;
|
||||
List<String> lines = HtmlLineSplitter.split(text, limit, true);
|
||||
String newline = "\n";
|
||||
for (String line : lines) {
|
||||
|
||||
@@ -80,9 +86,12 @@ public class DockingErrorDisplay implements ErrorDisplay {
|
||||
continue;
|
||||
}
|
||||
|
||||
// wrap any poorly formatted text that gets displayed in the label; 80-100 chars is
|
||||
// a reasonable line length based on historical print margins
|
||||
String wrapped = WordUtils.wrap(line, 100, null, true);
|
||||
String wrapped = line;
|
||||
if (line.length() > limit) {
|
||||
// this method will trim leading spaces; only call if the line is too long
|
||||
wrapped = WordUtils.wrap(line, limit, null, true);
|
||||
}
|
||||
|
||||
buffy.append(wrapped);
|
||||
}
|
||||
return buffy.toString();
|
||||
|
||||
+21
-17
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user