Uploaded image for project: 'ZK Calendar'
  1. ZK Calendar
  2. ZKCAL-104

AbstractCalendarItem have no arg constructor, fails to deserialize

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 3.1.2
    • 3.1.0
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      Serialize then deserialize a SimpleCalendarItem

      Current Result

      org.springframework.data.redis.serializer.SerializationException: Cannot deserialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to deserialize payload. Is the byte array a result of corresponding serialization for DefaultDeserializer?; nested exception is java.io.InvalidClassException: ch.unil.calendar.core.domain.EventCourses; no valid constructor
      

      Expected Result

      no error

      Debug Information

      reproducing case
      // EventCourses extends SimpleCalendarItem

      import ch.unil.calendar.core.domain.EventCourses;
      import org.junit.jupiter.api.Test;
      import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
      @Test
      void should_be_able_to_serialize_and_deserialize_event_courses_with_jdk_redis_serializer() {
      EventCourses eventCourses = new EventCourses();
      JdkSerializationRedisSerializer serializer = new JdkSerializationRedisSerializer();
      byte[] bytes = serializer.serialize(eventCourses);
      Object object = serializer.deserialize(bytes);
      System.out.println(object);
      }
      

      Workaround

      add a no arg constructor to an overriden AbstractCalendarItem class:
      See forum thread:
      https://forum.zkoss.org/question/114726/issue-with-serialization-simplecalendaritem-zkcalendar311/

            MDuchemin MDuchemin
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: