Transition to a non Editable Step causes Javscript error similar as a ConcurrentModificationException in Java

XMLWordPrintable

    • 6.02
    • Severity 3 - Minor
    • Hide
      Atlassian Update – 28 May 2018

      Hi everyone,

      We have recently reviewed this issue and the overall interest in the problem. As the issue hasn't collect votes, watchers, comments, or support cases from many customers during its lifetime, it's very low on our priority list, and will not be fixed in the foreseeable future. That's why we've decided to resolve it as Time Out.

      Although we're aware the issue is still important to those of you who were involved in the conversations around it, we want to be clear in managing your expectations. The Jira team is focusing on issues that have broad impact and high value, reflected by the number of comments, votes, support cases, and customers interested. Please consult the Atlassian Bugfix Policy for more details.

      We understand how disappointing this decision may be, but we hope you'll appreciate our transparent approach and communication.
      Atlassian will continue to watch this issue for further updates, so please feel free to share your thoughts in the comments.

      Thank you,
      Ignat Alexeyenko
      Jira Bugmaster

      Show
      Atlassian Update – 28 May 2018 Hi everyone, We have recently reviewed this issue and the overall interest in the problem. As the issue hasn't collect votes, watchers, comments, or support cases from many customers during its lifetime, it's very low on our priority list, and will not be fixed in the foreseeable future. That's why we've decided to resolve it as Time Out . Although we're aware the issue is still important to those of you who were involved in the conversations around it, we want to be clear in managing your expectations. The Jira team is focusing on issues that have broad impact and high value, reflected by the number of comments, votes, support cases, and customers interested. Please consult the Atlassian Bugfix Policy for more details. We understand how disappointing this decision may be, but we hope you'll appreciate our transparent approach and communication. Atlassian will continue to watch this issue for further updates, so please feel free to share your thoughts in the comments. Thank you, Ignat Alexeyenko Jira Bugmaster

      We are currently using JIRA 6.2.7 with IE8, and we are experiencing an issue with Issue View screen.

      To reproduce the error, it is needed :

      • to use IE8
      • to have an Issue without content in description
      • to have a Workflows Step where the Issue is no editable
      • to have a transition with a screen to this Workflow Step.

      Then :

      • go to the Issue View
      • execute the transition ... the transition screen is displayed
      • validate the transition

      At this moment, a javacript error occurs and the transition screen stays with the Waiting icon.

      After a deep analysis, it appears that it is caused by a Bug in Panel management done in jira-issue-nav-components-6.2.101\issueviewer\js\entities\PanelsGroupModel.js

      • When the issue is displayed before the transition, the Description panel is visible and editable
      • When the transition is called, the return in Javascript returns the new data without the Description panel, since it is no more editable
      • In JIRA.Components.IssueViewer.Models.PanelsGroup, the update() method performs an update of each Panel collections.
        The Description Panel is concerned by
        this.get("leftPanels").update(data.leftPanels, options);

      In JIRA.Components.IssueViewer.Collections.Panels.update(data, options), we have :

      // For each panel already present in this collection, check if it is still present in data.
      // If not, remove it from the collection.
      this.each(function (panel) {
      	var panelId = panel.id;
      	var panelPresentInPanelEntities = _.any(data, function (panel) {
      		return panel.id === panelId
      	});
      	if (!panelPresentInPanelEntities) {
      		this.remove(panel);
      	}
      }, this);
      {code:javascript}
      
      The goal of this update is to remove the missing panels.
      
      The implementation of the each method in JQuery is as follow :
      {code:javascript}
      // The cornerstone, an `each` implementation, aka `forEach`.
      // Handles objects with the built-in `forEach`, arrays, and raw objects.
      // Delegates to **ECMAScript 5**'s native `forEach` if available.
      var each = _.each = _.forEach = function(obj, iterator, context) {
      	if (obj == null) return;
      	if (nativeForEach && obj.forEach === nativeForEach) {
      		obj.forEach(iterator, context);
      	} else if (obj.length === +obj.length) {
      		for (var i = 0, length = obj.length; i < length; i++) {
      			if (iterator.call(context, obj[i], i, obj) === breaker) return;
      		}
      	} else {
      		var keys = _.keys(obj);
      		for (var i = 0, length = keys.length; i < length; i++) {
      			if (iterator.call(context, obj[keys[i]], keys[i], obj) === breaker) return;
      		}
      	}
      };

      In case of IE8, there is no nativeForEach method, and the loop on the iterator is done by a For(...).

      It means that the iterated collection is not ConcurrentModification safe.
      It causes that the function of the iteration removes the missing Panel of the current iterated list, and then the iteration is not aware that the list has changed, and finally the function of the iteration is called with empty value, that causes a sort of NPE.

      The error does not occurs with other tested Browsers (GC40,IE11) since their obj.forEach method supports this ConcurrentModification.

      I have no idea if other browsers can be concerned by a such error ... I let you check that.

      In terms of workaround, i have only the following solution

      • Force a default description, but I am not sure that it will be acceptable by business
      • Patch the plugin as follow :
        var missingPanels = [];
        
        // For each panel already present in this collection, check if it is still present in data.
        // If not, remove it from the collection.
        this.each(function (panel) {
        	var panelId = panel.id;
        	var panelPresentInPanelEntities = _.any(data, function (panel) {
        		return panel.id === panelId
        	});
        	if (!panelPresentInPanelEntities) {
        		missingPanels.push(panel);
        		this.remove(panel);
        	}
        }, this);
        
        AJS.$(missingPanels).each(function (panel) {
        	instance.remove(panel);
        });
        

            Assignee:
            Unassigned
            Reporter:
            Vincent Thoulé
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: