[hg] main-silver: Issue #225328 - too many failed queries = too ...

  • From: Tomas Stupka < >
  • To:
  • Subject: [hg] main-silver: Issue #225328 - too many failed queries = too ...
  • Date: Thu, 01 Aug 2013 09:56:49 -0700

changeset 126557e144de in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/126557e144de
description:
        Issue #225328 - too many failed queries = too many error popups

diffstat:

 bugzilla/nbproject/project.properties                                     |  
 2 +-
 bugzilla/src/org/netbeans/modules/bugzilla/commands/BugzillaExecutor.java |  
37 +++++++++-
 2 files changed, 37 insertions(+), 2 deletions(-)

diffs (99 lines):

diff --git a/bugzilla/nbproject/project.properties 
b/bugzilla/nbproject/project.properties
--- a/bugzilla/nbproject/project.properties
+++ b/bugzilla/nbproject/project.properties
@@ -1,5 +1,5 @@
 
-javac.source=1.6
+javac.source=1.7
 javac.compilerargs=-Xlint -Xlint:-serial
 
 test.config.stableBTD.includes=**/*Test.class
diff --git 
a/bugzilla/src/org/netbeans/modules/bugzilla/commands/BugzillaExecutor.java 
b/bugzilla/src/org/netbeans/modules/bugzilla/commands/BugzillaExecutor.java
--- 
a/bugzilla/src/org/netbeans/modules/bugzilla/commands/BugzillaExecutor.java
+++ 
b/bugzilla/src/org/netbeans/modules/bugzilla/commands/BugzillaExecutor.java
@@ -46,7 +46,10 @@
 import java.net.MalformedURLException;
 import java.net.UnknownHostException;
 import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.MissingResourceException;
+import java.util.concurrent.Callable;
 import java.util.logging.Level;
 import org.apache.commons.httpclient.RedirectException;
 import org.eclipse.core.runtime.CoreException;
@@ -55,7 +58,6 @@
 import org.eclipse.mylyn.internal.bugzilla.core.BugzillaUserMatchResponse;
 import org.eclipse.mylyn.internal.bugzilla.core.BugzillaVersion;
 import org.eclipse.mylyn.tasks.core.RepositoryStatus;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
 import org.netbeans.modules.bugtracking.util.NBBugzillaUtils;
 import org.netbeans.modules.bugzilla.Bugzilla;
 import org.netbeans.modules.bugzilla.autoupdate.BugzillaAutoupdate;
@@ -67,6 +69,7 @@
 import org.openide.DialogDescriptor;
 import org.openide.DialogDisplayer;
 import org.openide.NotifyDescriptor;
+import org.openide.util.Exceptions;
 import org.openide.util.HelpCtx;
 import org.openide.util.NbBundle;
 
@@ -88,6 +91,8 @@
 
     private final BugzillaRepository repository;
 
+    private static final Map<String, Callable<Boolean>> handlerCalls = new 
HashMap<>();
+    
     public BugzillaExecutor(BugzillaRepository repository) {
         this.repository = repository;
     }
@@ -133,6 +138,10 @@
             cmd.setFailed(false);
             cmd.setErrorMessage(null);
 
+            synchronized ( handlerCalls ) {
+                handlerCalls.remove(repository.getUrl());
+            }
+            
         } catch (CoreException ce) {
             Bugzilla.LOG.log(Level.FINE, null, ce);
 
@@ -552,12 +561,38 @@
             }
             @Override
             protected boolean handle() {
+                Callable<Boolean> c;
+                synchronized ( handlerCalls ) {
+                    final String key = repository.getUrl();
+                    c = handlerCalls.get(key);
+                    if(c == null) {
+                        c = new Callable<Boolean>() {
+                            private boolean alreadyCalled = false;
+                            @Override
+                            public Boolean call() {
+                                if(alreadyCalled) {
+                                    Bugzilla.LOG.log(Level.INFO, key, ce); 
+                                    return false;
+                                }
+                                // do not handle this kind of erorr until 
flag turned false by a succesfull command
+                                alreadyCalled = true;                        
        
                 boolean ret = 
Bugzilla.getInstance().getBugtrackingFactory().editRepository(BugzillaUtil.getRepository(executor.repository),
 errroMsg);
                 if(!ret) {
                     
notifyErrorMessage(NbBundle.getMessage(BugzillaExecutor.class, 
"MSG_ActionCanceledByUser")); // NOI18N
                 }
                 return ret;
             }
+                        };
+                        handlerCalls.put(key, c);
+                    } 
+                }
+                try {
+                    return c.call();
+                } catch (Exception ex) {
+                    Exceptions.printStackTrace(ex);
+                }
+                return false;
+            }
         }
         private static class DefaultHandler extends ExceptionHandler {
             public DefaultHandler(CoreException ce, String msg, 
BugzillaExecutor executor, BugzillaRepository repository) {

[hg] main-silver: Issue #225328 - too many failed queries = too ...

Tomas Stupka 08/01/2013

Project Features

About this Project

ConnectedDeveloper was started in November 2009, is owned by tpavek, and has 64 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close