mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Updated BugzReporter -
- Fixed layout issues causing truncated labels. - Changed "Git rev" field to "SVN rev." field. - Added "Steps to Reproduce" field. - Check Summary and Description fields for valid data, Error Message Dialog if not. - Attempt to match Build Version with Mantis version list. - Populate SVN rev. field with revision if available. - If crash report, relabel "Additional Information" field as "Error Dump" and auto-select category "New Crash Report". - Fix log4j warning. - Fix close and Cancel buttons not terminating window.
This commit is contained in:
@@ -7,11 +7,10 @@ import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import com.jgoodies.forms.layout.FormLayout;
|
||||
import com.jgoodies.forms.layout.ColumnSpec;
|
||||
import com.jgoodies.forms.layout.RowSpec;
|
||||
import com.jgoodies.forms.factories.FormFactory;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.model.BuildInfo;
|
||||
import forge.model.FModel;
|
||||
import forge.properties.ForgePreferences;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
@@ -26,6 +25,7 @@ import javax.swing.JTextArea;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mantisbt.connect.MCException;
|
||||
import org.mantisbt.connect.axis.MCSession;
|
||||
import org.mantisbt.connect.model.CustomFieldValue;
|
||||
@@ -62,9 +62,13 @@ public class BugzReporter extends JDialog {
|
||||
private JComboBox cboVersion = new JComboBox();
|
||||
private JComboBox cboSeverity = new JComboBox();
|
||||
final JCheckBox chkReportAnonymously = new JCheckBox("Report Anonymously");
|
||||
private JTextField txtGit;
|
||||
private JTextField txtSVN;
|
||||
private JLabel lblAddInfo = new JLabel();
|
||||
private JTextArea txtSteps = new JTextArea();
|
||||
|
||||
private static BugzReporter dialog = new BugzReporter();
|
||||
private static BugzReporter dialog = null;
|
||||
|
||||
private IMCAttribute Severities[];
|
||||
|
||||
/**
|
||||
* Launch the application.
|
||||
@@ -79,15 +83,28 @@ public class BugzReporter extends JDialog {
|
||||
|
||||
public void setDumpText(String dump) {
|
||||
txtErrorDump.setText(dump);
|
||||
lblAddInfo.setText("Error Dump");
|
||||
cboCategory.setSelectedItem("New Crash Report");
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the dialog.
|
||||
*/
|
||||
public BugzReporter() {
|
||||
dialog = this;
|
||||
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
setResizable(false);
|
||||
|
||||
// Init Logger for Axis, which is used by Mantis Library
|
||||
org.apache.log4j.ConsoleAppender appCON = new org.apache.log4j.ConsoleAppender(new org.apache.log4j.SimpleLayout(), "System.out");
|
||||
|
||||
org.apache.log4j.Logger logAxis= Logger.getLogger("org.apache.axis");
|
||||
logAxis.addAppender(appCON);
|
||||
logAxis.setLevel(org.apache.log4j.Level.ERROR);
|
||||
// Init Logger
|
||||
|
||||
//System.out.println(System.getProperties().toString().replace(", ", "\n"));
|
||||
|
||||
MCSession mCS = null;
|
||||
|
||||
try {
|
||||
@@ -105,13 +122,11 @@ public class BugzReporter extends JDialog {
|
||||
System.out.println("MCException - getCategories - " + e1.getMessage());
|
||||
}
|
||||
|
||||
IMCAttribute sevs[] = {};
|
||||
try {
|
||||
sevs = mCS.getEnum(Enumeration.SEVERITIES);
|
||||
Severities = mCS.getEnum(Enumeration.SEVERITIES);
|
||||
} catch (MCException e1) {
|
||||
System.out.println("MCException - getEnum - " + e1.getMessage());
|
||||
}
|
||||
final IMCAttribute imCA[] = sevs;
|
||||
|
||||
IProjectVersion[] vers = {};
|
||||
try {
|
||||
@@ -120,60 +135,25 @@ public class BugzReporter extends JDialog {
|
||||
System.out.println("MCException - getVersions - " + e1.getMessage());
|
||||
}
|
||||
|
||||
setTitle("Bug Report");
|
||||
setBounds(100, 100, 500, 542);
|
||||
BuildInfo bi = Singletons.getModel().getBuildInfo();
|
||||
|
||||
setTitle("Report Issue");
|
||||
setBounds(100, 100, 442, 575);
|
||||
getContentPane().setLayout(new BorderLayout());
|
||||
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
getContentPane().add(contentPanel, BorderLayout.CENTER);
|
||||
contentPanel.setLayout(new FormLayout(new ColumnSpec[] {
|
||||
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
|
||||
ColumnSpec.decode("35dlu"),
|
||||
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
|
||||
ColumnSpec.decode("16dlu:grow"),
|
||||
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
|
||||
ColumnSpec.decode("16dlu"),
|
||||
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
|
||||
ColumnSpec.decode("16dlu"),
|
||||
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
|
||||
ColumnSpec.decode("16dlu"),
|
||||
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
|
||||
ColumnSpec.decode("16dlu"),
|
||||
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
|
||||
ColumnSpec.decode("16dlu"),
|
||||
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
|
||||
ColumnSpec.decode("16dlu:grow"),
|
||||
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
|
||||
ColumnSpec.decode("16dlu"),
|
||||
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
|
||||
ColumnSpec.decode("16dlu"),
|
||||
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,},
|
||||
new RowSpec[] {
|
||||
FormFactory.RELATED_GAP_ROWSPEC,
|
||||
FormFactory.DEFAULT_ROWSPEC,
|
||||
FormFactory.RELATED_GAP_ROWSPEC,
|
||||
FormFactory.DEFAULT_ROWSPEC,
|
||||
FormFactory.RELATED_GAP_ROWSPEC,
|
||||
FormFactory.DEFAULT_ROWSPEC,
|
||||
FormFactory.RELATED_GAP_ROWSPEC,
|
||||
FormFactory.DEFAULT_ROWSPEC,
|
||||
FormFactory.RELATED_GAP_ROWSPEC,
|
||||
FormFactory.DEFAULT_ROWSPEC,
|
||||
FormFactory.RELATED_GAP_ROWSPEC,
|
||||
FormFactory.DEFAULT_ROWSPEC,
|
||||
FormFactory.RELATED_GAP_ROWSPEC,
|
||||
FormFactory.DEFAULT_ROWSPEC,
|
||||
FormFactory.RELATED_GAP_ROWSPEC,
|
||||
FormFactory.DEFAULT_ROWSPEC,
|
||||
FormFactory.RELATED_GAP_ROWSPEC,
|
||||
FormFactory.DEFAULT_ROWSPEC,}));
|
||||
contentPanel.setLayout(null);
|
||||
{
|
||||
JLabel lblMantisUsername = new JLabel("Username");
|
||||
contentPanel.add(lblMantisUsername, "2, 2, right, default");
|
||||
lblMantisUsername.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblMantisUsername.setBounds(10, 16, 75, 14);
|
||||
contentPanel.add(lblMantisUsername);
|
||||
}
|
||||
{
|
||||
txtUserName = new JTextField("ForgeGUI");
|
||||
txtUserName.setBounds(90, 13, 185, 21);
|
||||
txtUserName.setFont(new Font("Dialog", Font.PLAIN, 11));
|
||||
contentPanel.add(txtUserName, "4, 2, 9, 1, fill, default");
|
||||
contentPanel.add(txtUserName);
|
||||
txtUserName.setColumns(4);
|
||||
|
||||
try {
|
||||
@@ -190,6 +170,7 @@ public class BugzReporter extends JDialog {
|
||||
}
|
||||
}
|
||||
{
|
||||
chkReportAnonymously.setBounds(284, 11, 139, 25);
|
||||
chkReportAnonymously.setFont(new Font("Dialog", Font.PLAIN, 12));
|
||||
chkReportAnonymously.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
@@ -208,75 +189,90 @@ public class BugzReporter extends JDialog {
|
||||
}
|
||||
});
|
||||
|
||||
contentPanel.add(chkReportAnonymously, "14, 2, 7, 1, center, default");
|
||||
contentPanel.add(chkReportAnonymously);
|
||||
}
|
||||
{
|
||||
JLabel lblMantisPassword = new JLabel("Password");
|
||||
contentPanel.add(lblMantisPassword, "2, 4, right, default");
|
||||
lblMantisPassword.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblMantisPassword.setBounds(10, 45, 75, 14);
|
||||
contentPanel.add(lblMantisPassword);
|
||||
}
|
||||
{
|
||||
txtPassword.setBounds(90, 42, 185, 21);
|
||||
txtPassword.setFont(new Font("Dialog", Font.PLAIN, 11));
|
||||
contentPanel.add(txtPassword, "4, 4, 9, 1, fill, default");
|
||||
contentPanel.add(txtPassword);
|
||||
}
|
||||
{
|
||||
JSeparator separator = new JSeparator();
|
||||
contentPanel.add(separator, "2, 6, 19, 1");
|
||||
separator.setBounds(10, 69, 417, 2);
|
||||
contentPanel.add(separator);
|
||||
}
|
||||
{
|
||||
JLabel lblCategory = new JLabel("Category");
|
||||
lblCategory.setBounds(10, 81, 75, 14);
|
||||
lblCategory.setFont(new Font("Tahoma", Font.BOLD, 11));
|
||||
lblCategory.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
contentPanel.add(lblCategory, "2, 8");
|
||||
contentPanel.add(lblCategory);
|
||||
}
|
||||
{
|
||||
cboCategory.setBounds(90, 77, 223, 22);
|
||||
cboCategory.setFont(new Font("Dialog", Font.BOLD, 10));
|
||||
|
||||
if (cats.length > 0) {
|
||||
for (int i=0; i<cats.length; i++)
|
||||
cboCategory.addItem(cats[i]);
|
||||
}
|
||||
|
||||
cboCategory.setSelectedItem("General Bug Report");
|
||||
|
||||
contentPanel.add(cboCategory, "4, 8, 11, 1, fill, default");
|
||||
contentPanel.add(cboCategory);
|
||||
}
|
||||
{
|
||||
JLabel lblSummary = new JLabel("Summary");
|
||||
lblSummary.setBounds(10, 108, 75, 14);
|
||||
lblSummary.setFont(new Font("Tahoma", Font.BOLD, 11));
|
||||
lblSummary.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
contentPanel.add(lblSummary, "2, 10");
|
||||
contentPanel.add(lblSummary);
|
||||
}
|
||||
{
|
||||
txtSummary = new JTextField();
|
||||
txtSummary.setBounds(90, 105, 337, 21);
|
||||
txtSummary.setFont(new Font("Dialog", Font.PLAIN, 11));
|
||||
contentPanel.add(txtSummary, "4, 10, 17, 1, fill, default");
|
||||
contentPanel.add(txtSummary);
|
||||
txtSummary.setColumns(10);
|
||||
}
|
||||
{
|
||||
JLabel lblDescription = new JLabel("Description");
|
||||
lblDescription.setBounds(10, 182, 75, 21);
|
||||
lblDescription.setFont(new Font("Tahoma", Font.BOLD, 11));
|
||||
lblDescription.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
contentPanel.add(lblDescription, "2, 12");
|
||||
contentPanel.add(lblDescription);
|
||||
}
|
||||
{
|
||||
JScrollPane scrollPane = new JScrollPane();
|
||||
contentPanel.add(scrollPane, "4, 12, 17, 1, fill, fill");
|
||||
scrollPane.setBounds(90, 132, 337, 120);
|
||||
contentPanel.add(scrollPane);
|
||||
{
|
||||
txtDescription.setFont(new Font("Dialog", Font.PLAIN, 10));
|
||||
scrollPane.setViewportView(txtDescription);
|
||||
txtDescription.setBorder(null);
|
||||
txtDescription.setWrapStyleWord(true);
|
||||
txtDescription.setLineWrap(true);
|
||||
txtDescription.setRows(10);
|
||||
txtDescription.setRows(8);
|
||||
}
|
||||
}
|
||||
{
|
||||
JLabel lblNewLabel = new JLabel("Error Dump");
|
||||
lblNewLabel.setFont(new Font("Dialog", Font.PLAIN, 12));
|
||||
lblNewLabel.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
contentPanel.add(lblNewLabel, "2, 14");
|
||||
lblAddInfo.setText("<html><p align=\"right\">Additional<br>Information</p></html>");
|
||||
lblAddInfo.setBounds(10, 294, 75, 40);
|
||||
lblAddInfo.setFont(new Font("Dialog", Font.PLAIN, 12));
|
||||
lblAddInfo.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
|
||||
contentPanel.add(lblAddInfo);
|
||||
}
|
||||
{
|
||||
JScrollPane scrollPane = new JScrollPane();
|
||||
contentPanel.add(scrollPane, "4, 14, 17, 1, fill, fill");
|
||||
scrollPane.setBounds(90, 254, 337, 120);
|
||||
contentPanel.add(scrollPane);
|
||||
{
|
||||
txtErrorDump.setFont(new Font("Monospaced", Font.PLAIN, 10));
|
||||
scrollPane.setViewportView(txtErrorDump);
|
||||
@@ -285,129 +281,119 @@ public class BugzReporter extends JDialog {
|
||||
txtErrorDump.setBorder(null);
|
||||
txtErrorDump.setLineWrap(true);
|
||||
txtErrorDump.setWrapStyleWord(true);
|
||||
txtErrorDump.setRows(10);
|
||||
txtErrorDump.setRows(8);
|
||||
}
|
||||
}
|
||||
{
|
||||
JLabel lblNewLabel_1 = new JLabel("Version");
|
||||
lblNewLabel_1.setFont(new Font("Dialog", Font.PLAIN, 12));
|
||||
contentPanel.add(lblNewLabel_1, "2, 16, right, default");
|
||||
JLabel lblVersion = new JLabel("Version");
|
||||
lblVersion.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblVersion.setBounds(20, 468, 65, 16);
|
||||
lblVersion.setFont(new Font("Dialog", Font.PLAIN, 12));
|
||||
contentPanel.add(lblVersion);
|
||||
}
|
||||
{
|
||||
cboVersion.setBounds(90, 465, 160, 22);
|
||||
cboVersion.setFont(new Font("Dialog", Font.BOLD, 10));
|
||||
|
||||
cboVersion.addItem("");
|
||||
if (vers.length > 0) {
|
||||
for (int i=0; i<vers.length; i++)
|
||||
for (int i=0; i<vers.length; i++) {
|
||||
cboVersion.addItem(vers[i].getName());
|
||||
//System.out.println(vers[i].getName());
|
||||
}
|
||||
}
|
||||
cboVersion.setSelectedIndex(0);
|
||||
|
||||
String curVer = bi.getVersion();
|
||||
String ss[] = curVer.split("-");
|
||||
String rx = "^" + ss[0].replaceAll("\\.", "\\\\.") + ".*";
|
||||
System.out.println(ss[0] + " -> " + rx);
|
||||
|
||||
if (curVer.equals("SVN")) {
|
||||
cboVersion.setSelectedItem("SVN");
|
||||
} else {
|
||||
for (int i=0; i<vers.length; i++) {
|
||||
System.out.println(vers[i].getName());
|
||||
if (vers[i].getName().matches(rx)) {
|
||||
System.out.println("match");
|
||||
cboVersion.setSelectedItem(vers[i].getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
contentPanel.add(cboVersion, "4, 16, 9, 1, fill, default");
|
||||
contentPanel.add(cboVersion);
|
||||
}
|
||||
{
|
||||
JLabel lblGit = new JLabel("Git");
|
||||
lblGit.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblGit.setFont(new Font("Dialog", Font.PLAIN, 12));
|
||||
contentPanel.add(lblGit, "14, 16, right, default");
|
||||
JLabel lblRev = new JLabel("SVN rev.");
|
||||
lblRev.setBounds(247, 468, 66, 16);
|
||||
lblRev.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblRev.setFont(new Font("Dialog", Font.PLAIN, 12));
|
||||
contentPanel.add(lblRev);
|
||||
}
|
||||
{
|
||||
txtGit = new JTextField();
|
||||
txtGit.setFont(new Font("Dialog", Font.PLAIN, 11));
|
||||
txtGit.setColumns(10);
|
||||
contentPanel.add(txtGit, "16, 16, 5, 1, fill, default");
|
||||
txtSVN = new JTextField();
|
||||
|
||||
String curRev = bi.getBuildID();
|
||||
if (curRev != null) {
|
||||
if (!curRev.equals("null"))
|
||||
txtSVN.setText(curRev);
|
||||
}
|
||||
txtSVN.setBounds(318, 465, 109, 21);
|
||||
txtSVN.setFont(new Font("Dialog", Font.PLAIN, 11));
|
||||
txtSVN.setColumns(10);
|
||||
contentPanel.add(txtSVN);
|
||||
}
|
||||
{
|
||||
JLabel lblSeverity = new JLabel("Severity");
|
||||
lblSeverity.setBounds(10, 496, 75, 16);
|
||||
lblSeverity.setFont(new Font("Dialog", Font.PLAIN, 12));
|
||||
lblSeverity.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
contentPanel.add(lblSeverity, "2, 18");
|
||||
contentPanel.add(lblSeverity);
|
||||
}
|
||||
{
|
||||
|
||||
cboSeverity.setBounds(90, 493, 160, 22);
|
||||
cboSeverity.setFont(new Font("Dialog", Font.BOLD, 10));
|
||||
cboSeverity.addItem("");
|
||||
|
||||
if (imCA.length > 0) {
|
||||
for (int i=0; i<imCA.length; i++)
|
||||
cboSeverity.addItem(imCA[i].getName());
|
||||
if (Severities.length > 0) {
|
||||
for (int i=0; i<Severities.length; i++)
|
||||
cboSeverity.addItem(Severities[i].getName());
|
||||
}
|
||||
|
||||
contentPanel.add(cboSeverity, "4, 18, 9, 1, fill, default");
|
||||
contentPanel.add(cboSeverity);
|
||||
}
|
||||
{
|
||||
JScrollPane scrollPane = new JScrollPane();
|
||||
scrollPane.setBounds(90, 380, 337, 80);
|
||||
contentPanel.add(scrollPane);
|
||||
{
|
||||
txtSteps.setWrapStyleWord(true);
|
||||
txtSteps.setRows(5);
|
||||
txtSteps.setMaximumSize(new Dimension(2147483647, 300));
|
||||
txtSteps.setLineWrap(true);
|
||||
txtSteps.setFont(new Font("Monospaced", Font.PLAIN, 10));
|
||||
txtSteps.setAutoscrolls(false);
|
||||
scrollPane.setViewportView(txtSteps);
|
||||
}
|
||||
}
|
||||
{
|
||||
JLabel lblSteps = new JLabel();
|
||||
lblSteps.setText("<html><p align=\"right\">Steps to<br>Reproduce</p></html>");
|
||||
lblSteps.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblSteps.setFont(new Font("Dialog", Font.PLAIN, 12));
|
||||
lblSteps.setBounds(10, 400, 75, 40);
|
||||
contentPanel.add(lblSteps);
|
||||
}
|
||||
{
|
||||
JPanel buttonPane = new JPanel();
|
||||
buttonPane.setOpaque(false);
|
||||
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
|
||||
getContentPane().add(buttonPane, BorderLayout.SOUTH);
|
||||
{
|
||||
JButton cmdReport = new JButton("Report");
|
||||
cmdReport.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
Report: {
|
||||
MCSession rep = null;
|
||||
if (!chkReportAnonymously.isSelected()) {
|
||||
|
||||
try {
|
||||
rep = new MCSession(new URL("http://cardforge.org/bugz/api/soap/mantisconnect.php"), txtUserName.getText(), String.valueOf(txtPassword.getPassword()));
|
||||
} catch (MalformedURLException e) {
|
||||
System.out.println("MalFormedURLException");
|
||||
} catch (MCException e) {
|
||||
System.out.println("MCException - new MCSession - " + e.getMessage());
|
||||
JOptionPane.showMessageDialog(null, "MCException - new MCSession - " + e.getMessage(), "Bug Report", JOptionPane.INFORMATION_MESSAGE);
|
||||
break Report;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
rep = new MCSession(new URL("http://cardforge.org/bugz/api/soap/mantisconnect.php"), "ForgeGUI", "vi2ccTbfBUu^");
|
||||
} catch (MalformedURLException e) {
|
||||
System.out.println("MalformedURLException");
|
||||
} catch (MCException e) {
|
||||
System.out.println("MCException - new MCSession - " + e.getMessage());
|
||||
JOptionPane.showMessageDialog(null, "MCException - new MCSession - " + e.getMessage(), "Bug Report", JOptionPane.INFORMATION_MESSAGE);
|
||||
break Report;
|
||||
}
|
||||
}
|
||||
|
||||
IIssue iBug = null;
|
||||
try {
|
||||
iBug = rep.newIssue(1);
|
||||
} catch (MCException e) {
|
||||
System.out.println("MCException - newIssue - " + e.getMessage());
|
||||
JOptionPane.showMessageDialog(null, "MCException - newIssue - " + e.getMessage(), "Bug Report", JOptionPane.INFORMATION_MESSAGE);
|
||||
break Report;
|
||||
}
|
||||
|
||||
iBug.setCategory(cboCategory.getSelectedItem().toString());
|
||||
iBug.setSummary(txtSummary.getText());
|
||||
iBug.setDescription(txtDescription.getText());
|
||||
iBug.setAdditionalInformation(txtErrorDump.getText());
|
||||
iBug.setVersion(cboVersion.getSelectedItem().toString());
|
||||
|
||||
for (int i=0; i<imCA.length; i++) {
|
||||
if (cboSeverity.getSelectedItem().toString().equals(imCA[i].getName()))
|
||||
iBug.setSeverity(imCA[i]);
|
||||
}
|
||||
|
||||
ICustomFieldValue icfv[] = {new CustomFieldValue(new MCAttribute(1, "Detected at Git Rev (hex7)"), txtGit.getText())};
|
||||
iBug.setCustomFields(icfv);
|
||||
|
||||
DefaultSubmitter ds = new DefaultSubmitter(false);
|
||||
try {
|
||||
ds.submitIssue(rep, iBug);
|
||||
} catch (MCException e1) {
|
||||
System.out.println("MCException - submit Issue - " + e1.getMessage());
|
||||
JOptionPane.showMessageDialog(null, "MCException - submit Issue - " + e1.getMessage(), "Bug Report", JOptionPane.INFORMATION_MESSAGE);
|
||||
break Report;
|
||||
}
|
||||
|
||||
prefs.BugzName = txtUserName.getText();
|
||||
prefs.BugzPwd = String.valueOf(txtPassword.getPassword());
|
||||
try {
|
||||
prefs.save();
|
||||
} catch (Exception e) {
|
||||
System.out.println("Exception - save preferences - " + e.getMessage());
|
||||
}
|
||||
|
||||
JOptionPane.showMessageDialog(null, "This Issue Has Been Reported, Thank You.", "Bug Report", JOptionPane.INFORMATION_MESSAGE);
|
||||
dialog.dispose();
|
||||
}// Report:
|
||||
doReport();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -426,5 +412,89 @@ Report: {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void doReport() {
|
||||
Report: {
|
||||
|
||||
if (txtSummary.getText().length() < 4) {
|
||||
JOptionPane.showMessageDialog(null, "Summary field must be provided", "Bug Report", JOptionPane.ERROR_MESSAGE);
|
||||
break Report;
|
||||
}
|
||||
|
||||
if (txtDescription.getText().length() < 10) {
|
||||
JOptionPane.showMessageDialog(null, "Description field must be provided", "Bug Report", JOptionPane.ERROR_MESSAGE);
|
||||
break Report;
|
||||
}
|
||||
|
||||
MCSession rep = null;
|
||||
if (!chkReportAnonymously.isSelected()) {
|
||||
try {
|
||||
rep = new MCSession(new URL("http://cardforge.org/bugz/api/soap/mantisconnect.php"), txtUserName.getText(), String.valueOf(txtPassword.getPassword()));
|
||||
} catch (MalformedURLException e) {
|
||||
System.out.println("MalFormedURLException");
|
||||
} catch (MCException e) {
|
||||
System.out.println("MCException - new MCSession - " + e.getMessage());
|
||||
JOptionPane.showMessageDialog(null, "MCException - new MCSession - " + e.getMessage(), "Bug Report", JOptionPane.INFORMATION_MESSAGE);
|
||||
break Report;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
rep = new MCSession(new URL("http://cardforge.org/bugz/api/soap/mantisconnect.php"), "ForgeGUI", "vi2ccTbfBUu^");
|
||||
} catch (MalformedURLException e) {
|
||||
System.out.println("MalformedURLException");
|
||||
} catch (MCException e) {
|
||||
System.out.println("MCException - new MCSession - " + e.getMessage());
|
||||
JOptionPane.showMessageDialog(null, "MCException - new MCSession - " + e.getMessage(), "Bug Report", JOptionPane.INFORMATION_MESSAGE);
|
||||
break Report;
|
||||
}
|
||||
}
|
||||
|
||||
IIssue iBug = null;
|
||||
try {
|
||||
iBug = rep.newIssue(1);
|
||||
} catch (MCException e) {
|
||||
System.out.println("MCException - newIssue - " + e.getMessage());
|
||||
JOptionPane.showMessageDialog(null, "MCException - newIssue - " + e.getMessage(), "Bug Report", JOptionPane.INFORMATION_MESSAGE);
|
||||
break Report;
|
||||
}
|
||||
|
||||
iBug.setCategory(cboCategory.getSelectedItem().toString());
|
||||
iBug.setSummary(txtSummary.getText());
|
||||
iBug.setDescription(txtDescription.getText());
|
||||
iBug.setAdditionalInformation(txtErrorDump.getText());
|
||||
iBug.setVersion(cboVersion.getSelectedItem().toString());
|
||||
|
||||
for (int i=0; i<Severities.length; i++) {
|
||||
if (cboSeverity.getSelectedItem().toString().equals(Severities[i].getName()))
|
||||
iBug.setSeverity(Severities[i]);
|
||||
}
|
||||
|
||||
ICustomFieldValue icfv[] = {
|
||||
new CustomFieldValue(new MCAttribute(1, "Detected at SVN Rev"), txtSVN.getText()),
|
||||
new CustomFieldValue(new MCAttribute(1, "Steps to Reproduce"), txtSteps.getText())
|
||||
};
|
||||
iBug.setCustomFields(icfv);
|
||||
|
||||
DefaultSubmitter ds = new DefaultSubmitter(false);
|
||||
try {
|
||||
ds.submitIssue(rep, iBug);
|
||||
} catch (MCException e1) {
|
||||
System.out.println("MCException - submit Issue - " + e1.getMessage());
|
||||
JOptionPane.showMessageDialog(null, "MCException - submit Issue - " + e1.getMessage(), "Bug Report", JOptionPane.INFORMATION_MESSAGE);
|
||||
break Report;
|
||||
}
|
||||
|
||||
prefs.BugzName = txtUserName.getText();
|
||||
prefs.BugzPwd = String.valueOf(txtPassword.getPassword());
|
||||
try {
|
||||
prefs.save();
|
||||
} catch (Exception e) {
|
||||
System.out.println("Exception - save preferences - " + e.getMessage());
|
||||
}
|
||||
|
||||
JOptionPane.showMessageDialog(null, "This Issue Has Been Reported, Thank You.", "Bug Report", JOptionPane.INFORMATION_MESSAGE);
|
||||
dialog.dispose();
|
||||
}// Report:
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user