Projects tigase _server server-core Issues #647
Weird issue with EventBus and event serialization (#647)
Closed
Andrzej Wójcik (Tigase) opened 9 years ago

I created following event:

class EventX implements Serializable {
  private BareJID userJid;
  private HashSet<String> enabled;

  public EventX() {}

  public EventX(BareJID userJid, HashSet<String> enabled) {
    this.userJid = userJid;
    this.enabled = enabled;
  }

  public Set<JID> getEnabled() {
    HashSet<JID> result = new HashSet<>();
    if (this.enabled != null) {
      for (String res : this.enabled) {
        result.add(JID.jidInstanceNS(userJid, res));
      }
    }
    return result;
  }
}

In as userJid I passed test@example.com and as resources [ test-1 ] on one cluster node and on second cluster node when I called getEnabled() method I received test@example.com/test@example.com/test-1 which was rather not expected.

I was able to solve this issue by changing method name to getEnabledJids() as serializer used getter method to collect values for field and serialized this collected value, which was not expected result and caused issue here - invalid JID.

Would it be possible to somehow deal with it on system level?

Bartosz Małkowski commented 7 years ago

This is not getter of field "enabled". Serialization assumes that if there are set$FIELDNAME and get/is$FIELDNAME methods, it may be used for simple get and set value.

I don't think it required to be changed. Just use different method to get processed data.

issue 1 of 1
Type
Task
Priority
Normal
Assignee
RedmineID
3946
Version
tigase-server-8.0.0
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#647
Please wait...
Page is in error, reload to recover