Uploaded image for project: 'Confluence Server'
  1. Confluence Server
  2. CONFSERVER-45778

fix class cast exception on MailEventServerListener

    Details

    • Symptom Severity:
      Minor
    • Sprint:
      Paddington
    • QA Demo Status:
      Not Done
    • QA Kickoff Status:
      Not Needed

      Description

      We seem to hit the following error on the Cluster Acceptance Test build

      2016-12-19 08:58:20,777 ERROR [cached4] [atlassian.confluence.event.ConfluenceEventDispatcher] run There was an exception thrown trying to dispatch event [com.atlassian.confluence.cluster.hazelcast.HazelcastClusterEventWrapper[source=null]] from the invoker [com.atlassian.confluence.event.ConfluenceListenerHandlersConfiguration$TimingListenerHandler$1$1@50dd2b40]
       -- event: com.atlassian.confluence.event.events.admin.MailServerEditEvent[source=null] | originatingMemberUuid: c5e0aa3a-c46f-42ea-998b-ca7d2b8f9873
      java.lang.ClassCastException: com.atlassian.confluence.cluster.hazelcast.HazelcastClusterEventWrapper cannot be cast to com.atlassian.confluence.event.events.admin.MailServerEditEvent
        at com.atlassian.confluence.event.listeners.MailServerEventListener.handleEvent(MailServerEventListener.java:34)
        at com.atlassian.event.legacy.LegacyListenerHandler$LegacyListenerInvoker.invoke(LegacyListenerHandler.java:55)
        at com.atlassian.confluence.event.ConfluenceListenerHandlersConfiguration$TimingListenerHandler$1$1.invoke(ConfluenceListenerHandlersConfiguration.java:69)
        at com.atlassian.confluence.event.ConfluenceEventDispatcher$VCacheRequestContextRunnableFactory$1.lambda$run$0(ConfluenceEventDispatcher.java:93)
        at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$doInRequestContext$0(VCacheRequestContextOperations.java:50)
        at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:87)
        at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:71)
      

      The root cause is definitely legit

      Event underlyingEvent = EventUtils.extractWrappedEventOrOriginal(event);
      
              if (underlyingEvent instanceof MailServerCreateEvent) {
                  MailServerCreateEvent createEvent = (MailServerCreateEvent) underlyingEvent;
                  MailServer server = createEvent.getServer();
                  JmxUtil.registerBean(makeNameForServer(server.getName()), createEvent.getServer());
              } else if (underlyingEvent instanceof MailServerDeleteEvent) {
                  JmxUtil.unregisterBean(makeNameForServer(((MailServerDeleteEvent) underlyingEvent).getServer().getName()));
              } else if (underlyingEvent instanceof MailServerEditEvent) {
                  //Additionally handle edit events
                  MailServerEditEvent editEvent = (MailServerEditEvent) event;
                  JmxUtil.unregisterBean(makeNameForServer(editEvent.getOriginalServerName()));
                  JmxUtil.registerBean(makeNameForServer(editEvent.getServer().getName()), editEvent.getServer());
              }
      

      we are casting the wrong Edit Event

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Last commented:
                  47 weeks ago