mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
Updated how the error dialog gets the host name to avoid long pauses
This commit is contained in:
parent
2436cba12a
commit
1ccd2a882a
1 changed files with 33 additions and 10 deletions
|
@ -20,8 +20,7 @@ import java.awt.event.ComponentAdapter;
|
||||||
import java.awt.event.ComponentEvent;
|
import java.awt.event.ComponentEvent;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
@ -117,12 +116,36 @@ public class ErrLogDialog extends AbstractErrDialog {
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
sb.append(System.getProperty("os.arch"));
|
sb.append(System.getProperty("os.arch"));
|
||||||
sb.append(EOL);
|
sb.append(EOL);
|
||||||
sb.append("Workstation: ");
|
|
||||||
sb.append(getHostname());
|
String hostname = getHostnameString();
|
||||||
sb.append(EOL);
|
if (hostname != null) {
|
||||||
|
sb.append("Workstation: ");
|
||||||
|
sb.append(getHostname());
|
||||||
|
sb.append(EOL);
|
||||||
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getHostnameString() {
|
||||||
|
//
|
||||||
|
// Note: we avoid use of InetAddress; using that to get the host name can timeout
|
||||||
|
//
|
||||||
|
String name = null;
|
||||||
|
Map<String, String> env = System.getenv();
|
||||||
|
if (env.containsKey("COMPUTERNAME")) {
|
||||||
|
name = env.get("COMPUTERNAME");
|
||||||
|
}
|
||||||
|
else if (env.containsKey("HOSTNAME")) {
|
||||||
|
name = env.get("HOSTNAME");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "Workstation: " + name;
|
||||||
|
}
|
||||||
|
|
||||||
private Object getHostname() {
|
private Object getHostname() {
|
||||||
String hostname = "<unknown>";
|
String hostname = "<unknown>";
|
||||||
try {
|
try {
|
||||||
|
@ -174,14 +197,14 @@ public class ErrLogDialog extends AbstractErrDialog {
|
||||||
|
|
||||||
detailsPane = new ErrorDetailsSplitPane();
|
detailsPane = new ErrorDetailsSplitPane();
|
||||||
|
|
||||||
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 5));
|
JPanel sideButtonPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 5));
|
||||||
buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
sideButtonPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||||
if (errorReporter != null) {
|
if (errorReporter != null) {
|
||||||
buttonPanel.add(sendButton);
|
sideButtonPanel.add(sendButton);
|
||||||
}
|
}
|
||||||
buttonPanel.add(detailsButton);
|
sideButtonPanel.add(detailsButton);
|
||||||
|
|
||||||
introPanel.add(buttonPanel, BorderLayout.EAST);
|
introPanel.add(sideButtonPanel, BorderLayout.EAST);
|
||||||
mainPanel.add(detailsPane, BorderLayout.CENTER);
|
mainPanel.add(detailsPane, BorderLayout.CENTER);
|
||||||
|
|
||||||
addWorkPanel(mainPanel);
|
addWorkPanel(mainPanel);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue