Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-38507

Error report due to boolean in site cache.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Verified
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 11.3
    • Fix Version/s: 11.5 [Tentative], 12.0, 19.0
    • Component/s: Kernel
    • Labels:
      None
    • 12 status:
      Resolved
    • 11 status:
      Resolved
    • Previous Issue Keys:
      KNL-1526

      Description

      I've got this error reported by Sakai (the user was in resources tool):

      org.sakaiproject.portal.api.PortalHandlerException: java.lang.ClassCastException: java.lang.Boolean cannot be cast to org.sakaiproject.site.api.Site
          at org.sakaiproject.portal.charon.SkinnableCharonPortal.doGet(SkinnableCharonPortal.java:851)
      caused by: java.lang.ClassCastException: java.lang.Boolean cannot be cast to org.sakaiproject.site.api.Site
          at org.sakaiproject.site.impl.SiteCacheSafe.getTool(SiteCacheSafe.java:216)
          at org.sakaiproject.site.impl.BaseSiteService.findTool(BaseSiteService.java:1594)
          at org.sakaiproject.site.cover.SiteService.findTool(SiteService.java:385)
          at org.sakaiproject.portal.charon.handlers.SiteHandler.doSite(SiteHandler.java:447)
          at org.sakaiproject.portal.charon.handlers.SiteHandler.doGet(SiteHandler.java:265)
          at org.sakaiproject.portal.charon.handlers.SiteHandler.doGet(SiteHandler.java:153)
          at org.sakaiproject.portal.charon.SkinnableCharonPortal.doGet(SkinnableCharonPortal.java:851)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
          at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:460)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
          at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
          at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:676)
          at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
          at org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:868)
          at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
          at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
          at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
          at java.lang.Thread.run(Thread.java:745)
      

      After some research I've found that here:
      https://github.com/sakaiproject/sakai/blob/master/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/BaseSiteService.java#L700-L714

      The code expects that inside "SiteCache" you could find Site or Boolean objects.

      But here:
      https://github.com/sakaiproject/sakai/blob/master/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/SiteCacheSafe.java#L216
      https://github.com/sakaiproject/sakai/blob/master/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/SiteCacheSafe.java#L229
      https://github.com/sakaiproject/sakai/blob/master/kernel/kernel-impl/src/main/java/org/sakaiproject/site/impl/SiteCacheSafe.java#L242

      Only Site objects are expected. It seems reasonable to try/catch or at least check if the object found is a Site object before casting it. Anyway, I don't know the way to reproduce it, maybe trying to invoke the "siteExists" method before any other call that put the site object into the cache.

        Gliffy Diagrams

          Zeplin

            Attachments

              Activity

                People

                Assignee:
                k1team KERNEL TEAM (Inactive)
                Reporter:
                jjmerono@um.es Juan José Meroño Sánchez
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    Git Integration