0 Replies Latest reply on May 24, 2010 2:59 AM by jaikiran pai

    Reference to a non-existent skin value leads to a unusable application

    jaikiran pai Master

      This is my first time with RichFaces and was trying out the skinning feature. I am using 3.3.1.GA version. As suggested in the documentation, one of the things required for skinning, is to pass the skin name as a context param:

       

      <context-param>
              <param-name>org.richfaces.SKIN</param-name>
              <param-value>wine</param-value>
          </context-param>
      
      
      

       

       

      Things work out fine as expected. But on one occasion, I ended up with a typo in the skin value, let's say like the one below:

       

       

      <context-param>
              <param-name>org.richfaces.SKIN</param-name>
              <param-value>blah</param-value>
          </context-param>

       

       

      This resulted in the application throwing a 500 error while accessing it:

       

      12:16:18,163 ERROR [BaseXMLFilter] Exception in the filter chain
      javax.servlet.ServletException: Skin with name blah not found
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:270)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
              at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
              at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
              at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
              at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: org.richfaces.skin.SkinNotFoundException: Skin with name blah not found
              at org.richfaces.skin.SkinFactoryImpl.loadProperties(SkinFactoryImpl.java:315)
              at org.richfaces.skin.SkinFactoryImpl.buildSkin(SkinFactoryImpl.java:277)
              at org.richfaces.skin.SkinFactoryImpl.getSkinByName(SkinFactoryImpl.java:133)
              at org.richfaces.skin.SkinFactoryImpl.getSkin(SkinFactoryImpl.java:150)
              at org.ajax4jsf.resource.TemplateCSSRenderer.getData(TemplateCSSRenderer.java:161)
              at org.ajax4jsf.resource.InternetResourceBase.getDataToStore(InternetResourceBase.java:236)
              at org.ajax4jsf.resource.InternetResourceBase.getUri(InternetResourceBase.java:218)
              at org.ajax4jsf.resource.BaseResourceRenderer.encodeBegin(BaseResourceRenderer.java:64)
              at org.ajax4jsf.resource.OneTimeRenderer.encodeBegin(OneTimeRenderer.java:48)
              at org.ajax4jsf.resource.BaseResourceRenderer.encode(BaseResourceRenderer.java:47)
              at org.ajax4jsf.resource.InternetResourceBase.encode(InternetResourceBase.java:313)
              at org.ajax4jsf.context.ViewResources.encodeSkinningResources(ViewResources.java:294)
              at org.ajax4jsf.context.ViewResources.processHeadResources(ViewResources.java:510)
              at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:193)
              at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
              at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
              ... 26 more

       

       

      The error exception stacktrace is clear enough to say what's wrong. But IMO, the non-existence of a skin shouldn't prevent the application from being usable. I would rather expect that maybe a WARN message is logged about the missing skin and RichFaces falls back on the default skin (whichever it is). That way, the application will still be usable and the developer can fix the skin param after he checks the UI and notices that it hasn't been applied.

       

      P.S: As I said, this is my first time with RichFaces. But I found the documentation and the live demo site really impressive and useful. I didn't have to struggle to get a simple application working.