ICEfaces
  1. ICEfaces
  2. ICE-2332

NPE in GroupAsyncRender.remove()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7DR#2
    • Fix Version/s: 1.7DR#3, 1.7
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      win xp

      Description

      If a user tries to call renderer.remove() after the Renderable has already been removed the remove method will generate an NPE:

      ava.lang.NullPointerException
              at
      com.icesoft.faces.async.render.GroupAsyncRenderer.remove(GroupAsyncRenderer.java:127)
              at
      com.efunds.oe.fm.pb.AbstractRenderableBean.removePolling(AbstractRenderableBean.java:117)
              at
      com.efunds.oe.fm.pb.AbstractRenderableBean.viewDisposed(AbstractRenderableBean.java:210)
              at com.icesoft.faces.context.View.notifyViewDisposal(View.java:221)
              at com.icesoft.faces.context.View.dispose(View.java:191)
      ...

      suggested fix:

      public void remove(Renderable renderable) {
         if( group != null ){
      synchronized (group) {
                  Iterator iter = group.iterator();
                  while (iter.hasNext()) {
                      WeakReference ref = (WeakReference) iter.next();
                      if (renderable == (Renderable) ref.get()) {
                          group.remove(ref);
                          if (log.isTraceEnabled()) {
                              log.trace(name + " removing " + renderable);
                          }
                          return;
                      }
                  }
                  if (log.isWarnEnabled()) {
                      log.warn(name + " does not contain " + renderable);
                  }
              }
            }
          }

        Activity

        Philip Breau created issue -
        Philip Breau made changes -
        Field Original Value New Value
        Support Case References https://www.icesoft.ca:4443/supportilla/show_bug.cgi?id=4391
        Philip Breau made changes -
        Assignee Deryk Sinotte [ deryk.sinotte ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #15168 Tue Nov 13 16:01:37 MST 2007 deryk.sinotte ICE-2332: No longer set the collection of Renderables to null when disposing.
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/async/render/GroupAsyncRenderer.java
        Hide
        Deryk Sinotte added a comment -

        Rather than add a whole bunch of if(group !=null) logic to the various methods, I've removed the group = null statement from the dispose method. We already clear out all the Renderables and the group is only visible to the GroupAsyncRenderer and sub classes. There is really no need to null it out. The rest of the logic in the class should work fine with an empty rather than null collection.

        Show
        Deryk Sinotte added a comment - Rather than add a whole bunch of if(group !=null) logic to the various methods, I've removed the group = null statement from the dispose method. We already clear out all the Renderables and the group is only visible to the GroupAsyncRenderer and sub classes. There is really no need to null it out. The rest of the logic in the class should work fine with an empty rather than null collection.
        Deryk Sinotte made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.7DR#3 [ 10112 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Fix Version/s 1.7 [ 10080 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Assignee Deryk Sinotte [ deryk.sinotte ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Philip Breau
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: