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

Forums ClassCastException when calling services from SiteStats

    XMLWordPrintable

    Details

    • Test Plan:
      Hide
      • On a server with SiteStats > User Activity enabled and configured to use the internal SiteStats database (like nightly experimental), post to a Forum as a student
      • Visit User Activity as an instructor and find the forum post event
      • Click the show more button, confirm that additional details about the event are presented
      Show
      On a server with SiteStats > User Activity enabled and configured to use the internal SiteStats database (like nightly experimental), post to a Forum as a student Visit User Activity as an instructor and find the forum post event Click the show more button, confirm that additional details about the event are presented

      Description

      Forums uses a single-table inheritance structure to model topics and forums. Internally, Forums service methods will often cast directly to the appropriate subclass. For example, a Topic object is cast to DiscussionTopic.

      When these methods are called from SiteStats with the default database setting, Hibernate returns proxy objects instead of the real objects. The proxy objects are for the base class (ie. TopicImpl_$$_jvst4cf_3b), which then cannot be cast to the subclass (DiscussionTopic) and we get a ClassCastException. Interestingly, the same code does not return proxies when called from within Forums, or from SiteStats when it is configured to use an external database.

      To get around this problem, this patch unproxies the objects similarly to SAK-24996. It also fixes some error handling bugs uncovered in SiteStats as a result of this issue.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  plukasew Paul Lukasewych
                  Reporter:
                  plukasew Paul Lukasewych
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Git Source Code