Uploaded image for project: 'MyFaces Tomahawk'
  1. MyFaces Tomahawk
  2. TOMAHAWK-1088

InputHtmlRenderer throws an ClassCastException (java.lang.Class cannot be cast to java.lang.String)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.1.6, 1.1.7-SNAPSHOT
    • None
    • Html Editor
    • None
    • Windows XP
      Tomcat 6.0
      JDK 1.6
      (using facelets 1.1.13)

    Description

      Hello

      The component t:inputHtml throws an exception when it is rendered.

      See call stack below...

      java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.String
      at org.apache.myfaces.util.AbstractAttributeMap.put(AbstractAttributeMap.java:35)
      at org.apache.myfaces.custom.inputHtml.InputHtmlRenderer.setThisPageAlreadyRenderedAnInputHtml(InputHtmlRenderer.java:107)
      at org.apache.myfaces.custom.inputHtml.InputHtmlRenderer.encodeEnd(InputHtmlRenderer.java:93)
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:539)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:250)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:247)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:247)
      at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:577)
      at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
      at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
      at org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:91)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

      I have managed to fix this bug by downloading the source code of tomahawk and editing the following file:
      org\apache\myfaces\custom\inputHtml\InputHtmlRenderer.java
      https://svn.apache.org/repos/asf/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/inputHtml/InputHtmlRenderer.java

      Change line 103 from...
      return context.getExternalContext().getRequestMap().containsKey( InputHtmlRenderer.class );
      ... to ...
      return context.getExternalContext().getRequestMap().containsKey( InputHtmlRenderer.class.getName() );

      Change the live 107 from ...
      context.getExternalContext().getRequestMap().put(InputHtmlRenderer.class, Boolean.TRUE);
      ... to ...
      context.getExternalContext().getRequestMap().put(InputHtmlRenderer.class.getName(), Boolean.TRUE);

      Could you modify the source code in version 1.1.7-SNAPSHOT as described above?

      Thank you

      Nicolas

      Attachments

        1. InputHtmlRenderer.java.diff
          1 kB
          Felix Röthenbacher

        Activity

          People

            lu4242 Leonardo Uribe
            ncochard Nicolas Cochard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: