RichFaces
  1. RichFaces
  2. RF-1064

ResourceLifecycle fails to restore UIViewRoot

    Details

    • Type: Bug Bug
    • Status: Closed Closed (View Workflow)
    • Priority: Major Major
    • Resolution: Done
    • Affects Version/s: 3.1.0
    • Fix Version/s: 3.1.1
    • Component/s: None
    • Security Level: Public (Everyone can see)
    • Labels:
      None
    • Similar Issues:
      Show 10 results 

      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

        Activity

        Hide
        Alexander Smirnov
        added a comment -

        I have appended suggested code into resource lifecycle implementation class.

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

          People

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

            Dates

            • Created:
              Updated:
              Resolved: