[Jrisk-cvs] SF.net SVN: jrisk-code:[1059] Grasshopper/src_swing/net/yura/grasshopper/ PopupBug.java
Brought to you by:
yuranet
|
From: <yu...@us...> - 2024-12-27 20:22:56
|
Revision: 1059
http://sourceforge.net/p/jrisk/code/1059
Author: yuranet
Date: 2024-12-27 20:22:46 +0000 (Fri, 27 Dec 2024)
Log Message:
-----------
only submit max 5 errors on desktop
Modified Paths:
--------------
Grasshopper/src_swing/net/yura/grasshopper/PopupBug.java
Modified: Grasshopper/src_swing/net/yura/grasshopper/PopupBug.java
===================================================================
--- Grasshopper/src_swing/net/yura/grasshopper/PopupBug.java 2024-12-27 20:06:13 UTC (rev 1058)
+++ Grasshopper/src_swing/net/yura/grasshopper/PopupBug.java 2024-12-27 20:22:46 UTC (rev 1059)
@@ -22,7 +22,8 @@
/**
* when an error happens this pops up a window with the log and offers to submit the bug report.
- * when another error happens it will silently submit the bug again with the same info as was provided the first time
+ * when another error happens it will silently submit the bug again with the same info as was provided the first time.
+ * when more then {@link #MAX_SUBMIT} errors happens, no action will be taken
*
* @author Yura Mamyrin
*/
@@ -29,11 +30,14 @@
public class PopupBug extends Writer {
static PopupBug instance;
+
+ private static final int MAX_SUBMIT = 5;
private JDialog errFrame;
private JTextArea debugText;
private BugManager simplePrintStream;
+ private int count;
private String email;
private String cause;
@@ -51,10 +55,12 @@
simplePrintStream = new BugManager() {
protected void action(String thecause) {
cause = thecause;
- if (email == null) {
+ count++;
+
+ if (count == 1) {
openPopup();
}
- else {
+ else if (count <= MAX_SUBMIT) {
doSubmit(email, false);
}
}
@@ -133,7 +139,7 @@
errFrame.setVisible(true);
}
-
+
private void closePopup() {
errFrame.setVisible(false);
// sometimes on Mac OS (Java1.8) setVisible(false) will not actually hide the dialog
|