ICEfaces
  1. ICEfaces
  2. ICE-8058

Null Event Source caused bridge to stop working

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-3.0.0.GA
    • Fix Version/s: 3.1.0.RC1, 3.1, EE-3.0.0.GA_P01
    • Component/s: Bridge
    • Labels:
      None
    • Environment:
      IceFaces 3.0.0 EE GA, Tomcat 7.x.x, Chrome, IE, FF

      Description

      Under certain conditions, the bridge.js stops responding. This is caused by an uncaught exception in the function submitEventBroadcaster (line 1885 in bridge.js). The exception is "Uncaught TypeError: Cannot read property 'id' of null". Tracing it back it is caused when when jsf.js calls sendEvent with a null source because it couldn't find the element.
      ar sendEvent = function sendEvent(request, context, status) {
      var data = {};
      data.type = "event";
      data.status = status;
      data.source = context.sourceid;
      if (typeof data.source === "string") {
      data.source = document.getElementById(data.source)
      }
      if (status !== "begin") {
      data.responseCode = request.status;
      data.responseXML = request.responseXML;
      data.responseText = request.responseText
      }
      if (context.onevent) {
      context.onevent.call(null, data)
      }

      TO REPRODUCE:

      1. Create the following page:
      <html xmlns="http://www.w3.org/1999/xhtml"
            xmlns:h="http://java.sun.com/jsf/html"
            xmlns:ace="http://www.icefaces.org/icefaces/components"
            xmlns:ice="http://www.icesoft.com/icefaces/component"
            >
          <h:head>
              <title>Case 11177</title>
              <ice:outputStyle href="./xmlhttp/css/rime/rime.css" />
          </h:head>
          <h:body>
              <h:form>
                      <h:commandButton value="Show" action="#{sessBean.toggleRendered}" />
                      <br/>
                      <center>
                      <h:panelGrid rendered="#{sessBean.rendered}">
                          <h:outputText value="Some text that will be dynamically rendered" />
                          <h:commandButton value="Hide" action="#{sessBean.toggleRendered}" />
                      </h:panelGrid>
                      </center>
              </h:form>
          </h:body>
      </html>

      2. And a session bean like the one below:

      @ManagedBean
      @SessionScoped
      public class SessBean implements Serializable{
          
          private boolean rendered;

          public SessBean() {
              rendered = false;
          }
          
          public String toggleRendered()
          {
              try {
                  Thread.currentThread().sleep(1000);
                  this.rendered = ! this.rendered;
              }
              catch (InterruptedException ex) {
                  Logger.getLogger(SessBean.class.getName()).log(Level.SEVERE, null, ex);
              }
              
              return null;
          }

          public boolean isRendered() { return rendered; }
          public void setRendered(boolean rendered) { this.rendered = rendered; }
          
      }

      NOTES:
      This behavior can be prevented with blockUIOnSubmit parameter set to true.
      Once bridge is down no action can be constituted with a server via buttons, links e.t.c

        Issue Links

          Activity

          Evgheni Sadovoi created issue -
          Evgheni Sadovoi made changes -
          Field Original Value New Value
          Salesforce Case [5007000000LHmBc]
          Evgheni Sadovoi made changes -
          Assignee Ken Fyten [ ken.fyten ]
          Stefan Greiner made changes -
          Link This issue blocks ICE-7993 [ ICE-7993 ]
          Stefan Greiner made changes -
          Link This issue blocks ICE-7993 [ ICE-7993 ]
          Stefan Greiner made changes -
          Link This issue duplicates ICE-7993 [ ICE-7993 ]
          Ken Fyten made changes -
          Fix Version/s 3.1 [ 10312 ]
          Assignee Priority P2
          Assignee Ken Fyten [ ken.fyten ] Mircea Toma [ mircea.toma ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #28970 Tue May 08 09:58:58 MDT 2012 mircea.toma ICE-8058 Assume user initiated request when 'source' element is missing, most probably the submitting element doesn't have an ID which causes JSF to fail looking it up.
          Files Changed
          Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/javascript/application.js
          Hide
          Mircea Toma added a comment -

          Assume user initiated request when 'source' element is missing, most probably the submitting element doesn't have an ID which causes JSF to fail when looking it up.

          Show
          Mircea Toma added a comment - Assume user initiated request when 'source' element is missing, most probably the submitting element doesn't have an ID which causes JSF to fail when looking it up.
          Mircea Toma made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Fix Version/s 3.1.0.BETA1 [ 10335 ]
          Hide
          Mircea Toma added a comment -

          The issue is not fixed yet, see forum thread http://jforum.icesoft.org/JForum/posts/list/20933.page.

          Show
          Mircea Toma added a comment - The issue is not fixed yet, see forum thread http://jforum.icesoft.org/JForum/posts/list/20933.page .
          Mircea Toma made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Deryk Sinotte made changes -
          Ken Fyten made changes -
          Fix Version/s 3.1.0.BETA2 [ 10336 ]
          Assignee Priority P2 P1
          Ken Fyten made changes -
          Fix Version/s 3.1.0.RC1 [ 10337 ]
          Fix Version/s 3.1.0.BETA2 [ 10336 ]
          Ken Fyten made changes -
          Fix Version/s 3.1.0.BETA1 [ 10335 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #29445 Tue Jun 12 07:55:22 MDT 2012 mircea.toma ICE-8058 Lookup missing submit triggering element by navigating up the call stack to the fullSubmit or singleSubmit function call, and then retrieve the element parameter. Set the triggering element as property on the XMLHttpRequest object to act as a thread context variable so that its value can be used by the 'complete' and 'success' following events.
          Files Changed
          Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/javascript/application.js
          Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/javascript/submit.js
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #29446 Tue Jun 12 08:02:39 MDT 2012 mircea.toma ICE-8058 Return from filterICEfacesEvents() function when fullSubmit or singleSubmit functions cannot be found in the call stack.
          Files Changed
          Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/javascript/application.js
          Hide
          Mircea Toma added a comment -

          Lookup missing submit triggering element by navigating up the call stack to the fullSubmit or singleSubmit function call, and then retrieve the element parameter. Set the triggering element as property on the XMLHttpRequest object to act as a thread context variable so that its value can be used by the 'complete' and 'success' following events. This way the use of a global variable that can be changed by different browser asynchronous request threads is avoided.

          Show
          Mircea Toma added a comment - Lookup missing submit triggering element by navigating up the call stack to the fullSubmit or singleSubmit function call, and then retrieve the element parameter. Set the triggering element as property on the XMLHttpRequest object to act as a thread context variable so that its value can be used by the 'complete' and 'success' following events. This way the use of a global variable that can be changed by different browser asynchronous request threads is avoided.
          Mircea Toma made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Ken Fyten made changes -
          Fix Version/s EE-3.0.0.GA_P01 [ 10327 ]
          Hide
          Mircea Toma added a comment -

          Backported fix maintenance branch.

          Show
          Mircea Toma added a comment - Backported fix maintenance branch.
          Mircea Toma made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Evgheni Sadovoi made changes -
          Salesforce Case [5007000000LHmBc] [5007000000LHmBc, 5007000000NID6t]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Mircea Toma
              Reporter:
              Evgheni Sadovoi
            • Votes:
              4 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: