ICEfaces-EE
  1. ICEfaces-EE
  2. IPCK-566

WindowScopeManager$ScopeMap.disactivateIfUnused throws NullPointerException

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: EE-3.3.0.GA_P02
    • Fix Version/s: None
    • Component/s: Facelet Components
    • Labels:
      None
    • Environment:
      Windows 7; JDK 1.8.0-66 (x64); javax.faces 2.1.29-08; GlassFish 3.1.2-16

      Description

      In our application the method WindowScopeManager$ScopeMap.disactivateIfUnused always throws a NullPointerException. The exception is caught in the calling method determineWindowID, which is why this is not so obvious.

      This happens once a window is opened and once it is closed.

      Code:
              private void disactivateIfUnused(FacesContext facesContext) {
                  if (!EnvUtils.containsBeans(this) && !EnvUtils.containsDisposedBeans(facesContext.getViewRoot().getViewMap())) {
                      //the map *does not* contain objects (most probably beans) other than the ones inserted by the framework
                      disactivate(getState(facesContext));
                  }
              }

      Root cause:
      In our application facesContext.getViewRoot() is always null.

      Resolution:
      Implement a null check for facesContext.getViewRoot() in disactivateIfUnused.

      Impacts:
      - Our DynaTrace outputs are polluted with that NullPointerException. It may lead to wrong assumptions when debugging non-related defects that always occur afterwards.
      - Disactivate will never be called, even there are no beans in the map and no beans have a @WindowDisposed annotation.

      For us the latter is not relevant, because we use @WindowDisposed. But: Please evaluate what impact this might have on others.

      Furthermore:
      - Check whether you may get the viewMap a different way. (To me that code looks strange.)
      - The calling WindowScopeManager.disposeWindow catches this NullPointerException with "catch (Throwable e)". IMHO this must be "catch (RuntimeException e)". Please fix immediately with this bug. Similar code smell a few lines below.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Ken Fyten
            Reporter:
            Hayo Schmidt
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: