Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-1064

ResourceLifecycle fails to restore UIViewRoot

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 3.1.0
    • Fix Version/s: 3.1.1
    • Component/s: None
    • Labels:
      None

      Description

      org.ajax4jsf.resource.ResourceLifecycle.send() has this code:

      // create "dummy" viewRoot, to avoid problems in phase listeners.
      UIViewRoot root = new UIViewRoot();
      root.setViewId(resource.getKey());
      root.setLocale(Locale.getDefault());
      root.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);
      facesContext.setViewRoot(root);

      This causes JBoss JSFUnit to fail because the original UIViewRoot is never restored. JSFUnit saves the FacesContext so that it can be examined by unit tests. So it needs to be able to see the original component tree. Can you do something like:

      UIViewRoot savedViewRoot = facesContext.getViewRoot();
      try {
      // do stuff with your dummy ViewRoot
      } finally {
      facesContext.setViewRoot(savedViewRoot);
      }

      Thanks,

      Stan Silvert
      JBoss JSFUnit Lead

        Gliffy Diagrams

          Activity

          Hide
          alexsmirnov Alexander Smirnov added a comment -

          I have appended suggested code into resource lifecycle implementation class.

          Show
          alexsmirnov Alexander Smirnov added a comment - I have appended suggested code into resource lifecycle implementation class.

            People

            • Assignee:
              ayanul Aleksej Yanul
              Reporter:
              ssilvert Stan Silvert
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development