8 Replies Latest reply on Jun 14, 2007 11:59 AM by Pete Muir

    s:graphicImage problems with Sun JSF Impl

    Bieth Bruno Newbie

      I have few problems with seam's graphicImage component.
      * NullPointerException due to getRenderType() != null
      This is the encodeChildren method of UIComponentBase (Sun impl)

       /**
       * @throws NullPointerException {@inheritDoc}
       */
       public void encodeChildren(FacesContext context) throws IOException {
      
       if (context == null) {
       throw new NullPointerException();
       }
       if (!isRendered()) {
       return;
       }
       String rendererType = getRendererType();
       if (rendererType != null) {
       getRenderer(context).encodeChildren(context, this);
       }
      
       }
      

      Here is the UIGraphicImage component :
       @Override
       protected Renderer getRenderer(FacesContext context)
       {
       return null;
       }
      

      But inherit a render type != null :
       public HtmlGraphicImage() {
       super();
       setRendererType("javax.faces.Image");
       }
      

      My solution is easy : add a 0-arg constructor which disable the render type :
       public UIGraphicImage() {
       super();
       setRendererType( null );
       }
      

      This is working now (I have the < img > tag in my page).

      * Next problem : for some reason the DynamicImageResource doesnt get the same instance of DynamicImageStore, so the image is not found !
      It's weird since the DynamicImageStore is a Session scope component.
      => I gave up at this point :)