qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kw...@apache.org
Subject svn commit: r1682801 - in /qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid: common/ResourceWidget.js common/util.js management/addAccessControlProvider.js management/addStore.js management/addVirtualHostNodeAndVirtualHost.js
Date Sun, 31 May 2015 21:44:37 GMT
Author: kwall
Date: Sun May 31 21:44:37 2015
New Revision: 1682801

URL: http://svn.apache.org/r1682801
Log:
QPID-6561: [Java Broker] Handle exception from HTML5 FileReader#abort()

Also ensure that KeyStore/TrustStore/AccessControl dialogues abort any in progress file reading
operation
if dialogue is cancelled.

Modified:
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ResourceWidget.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ResourceWidget.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ResourceWidget.js?rev=1682801&r1=1682800&r2=1682801&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ResourceWidget.js
(original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ResourceWidget.js
Sun May 31 21:44:37 2015
@@ -104,6 +104,14 @@ function (declare, array, lang, util, _W
                this.uploader.startup();
            }
        },
+       destroy: function()
+       {
+         if (this.fileReaderSupported && this.fileReader)
+         {
+           util.abortReaderSafely(this.fileReader);
+         }
+         this.inherited(arguments);
+       },
        _fileChanged: function (evt)
        {
            var file = this.uploader.domNode.children[0].files[0];

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js?rev=1682801&r1=1682800&r2=1682801&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js
(original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js
Sun May 31 21:44:37 2015
@@ -729,5 +729,20 @@ define(["dojo/_base/xhr",
                                      util.xhrErrorHandler);
            }
 
-           return util;
+           util.abortReaderSafely = function(reader)
+           {
+             if (reader && reader.readyState > 0)
+             {
+               try
+               {
+                 this.reader.abort();
+               }
+               catch(ex)
+               {
+                 // Ignore - read no longer in progress
+               }
+             }
+           }
+
+         return util;
        });

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js?rev=1682801&r1=1682800&r2=1682801&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js
(original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js
Sun May 31 21:44:37 2015
@@ -84,10 +84,7 @@ define(["dojo/_base/lang",
             _cancel: function(e)
             {
                 event.stop(e);
-                if (this.reader)
-                {
-                    this.reader.abort();
-                }
+                this._destroyTypeFields(this.accessControlProviderTypeFieldsContainer);
                 this.dialog.hide();
             },
             _add: function(e)
@@ -112,11 +109,15 @@ define(["dojo/_base/lang",
             {
                 this._typeChanged(type, this.accessControlProviderTypeFieldsContainer, "qpid/management/accesscontrolprovider/",
"AccessControlProvider" );
             },
+            _destroyTypeFields: function(typeFieldsContainer)
+            {
+              var widgets = registry.findWidgets(typeFieldsContainer);
+              array.forEach(widgets, function(item) { item.destroyRecursive();});
+              construct.empty(typeFieldsContainer);
+            },
             _typeChanged: function(type, typeFieldsContainer, baseUrl, category )
             {
-                 var widgets = registry.findWidgets(typeFieldsContainer);
-                 array.forEach(widgets, function(item) { item.destroyRecursive();});
-                 construct.empty(typeFieldsContainer);
+                 this._destroyTypeFields(typeFieldsContainer);
 
                  if (type)
                  {

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js?rev=1682801&r1=1682800&r2=1682801&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js
(original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js
Sun May 31 21:44:37 2015
@@ -114,10 +114,7 @@ define(["dojo/_base/lang",
             _cancel: function(e)
             {
                 event.stop(e);
-                if (this.reader)
-                {
-                    this.reader.abort();
-                }
+                this._destroyTypeFields(this.storeTypeFieldsContainer);
                 this.dialog.hide();
             },
             _add: function(e)

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js?rev=1682801&r1=1682800&r2=1682801&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js
(original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js
Sun May 31 21:44:37 2015
@@ -292,10 +292,7 @@ define([
       },
       _cancel: function(e)
       {
-          if (this.reader)
-          {
-            this.reader.abort();
-          }
+          util.abortReaderSafely(this.reader);
           this.dialog.hide();
       },
       _add: function(e)
@@ -312,7 +309,7 @@ define([
         if (uploadVHConfig && this.virtualHostNodeFile.getFileList().length >
0 && this.virtualHostNodeForm.validate())
         {
           // VH config is being uploaded
-          virtualHostNodeData = this._getValues(this.virtualHostNodeForm);
+          virtualHostNodeData = util.getFormWidgetValues(this.virtualHostNodeForm);
           var virtualHostNodeContext = this.virtualHostNodeContext.get("value");
           if (virtualHostNodeContext)
           {
@@ -324,14 +321,14 @@ define([
         }
         else if (!uploadVHConfig && this.virtualHostNodeForm.validate() &&
this.virtualHostForm.validate())
         {
-          virtualHostNodeData = this._getValues(this.virtualHostNodeForm);
+          virtualHostNodeData = util.getFormWidgetValues(this.virtualHostNodeForm);
           var virtualHostNodeContext = this.virtualHostNodeContext.get("value");
           if (virtualHostNodeContext)
           {
             virtualHostNodeData["context"] = virtualHostNodeContext;
           }
 
-          var virtualHostData = this._getValues(this.virtualHostForm);
+          var virtualHostData = util.getFormWidgetValues(this.virtualHostForm);
           var virtualHostContext = this.virtualHostContext.get("value");
           if (virtualHostContext)
           {
@@ -352,64 +349,6 @@ define([
 
         var that = this;
         that.management.create("virtualhostnode", {type: "broker"}, virtualHostNodeData).then(function(x){that.dialog.hide();});
-      },
-      _getValues: function (form)
-      {
-        var values = {};
-        var contextMap = {};
-
-        var formWidgets = form.getChildren();
-        for(var i in formWidgets)
-        {
-            var widget = formWidgets[i];
-            var value = widget.value;
-            var propName = widget.name;
-            if (propName && (widget.required || value ))
-            {
-                if (widget.contextvar)
-                {
-                    contextMap [propName] = String(value); // Broker requires that context
values are Strings
-                }
-                else
-                {
-                    if (widget instanceof dijit.form.CheckBox)
-                    {
-                        values[ propName ] = widget.checked;
-                    }
-                    else if (widget instanceof dijit.form.RadioButton && value)
-                    {
-                        var currentValue = values[propName];
-                        if (currentValue)
-                        {
-                            if (lang.isArray(currentValue))
-                            {
-                                currentValue.push(value)
-                            }
-                            else
-                            {
-                                values[ propName ] = [currentValue, value];
-                            }
-                        }
-                        else
-                        {
-                            values[ propName ] = value;
-                        }
-                    }
-                    else
-                    {
-                        values[ propName ] = value ? value: null;
-                    }
-
-                }
-            }
-        }
-
-        // One or more context variables were defined on form
-        if (fobject.keys(contextMap).length > 0)
-        {
-            values ["context"] = contextMap;
-        }
-        return values;
       }
     };
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message