From fcce353e111604c9c048c75e9759645f08835c43 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 17 Jun 2019 11:53:51 +0300 Subject: TwitterManager: do not overwrite top event message user --- src/main/java/com/juick/Message.java | 3 ++- src/main/java/com/juick/User.java | 3 ++- src/main/java/com/juick/server/TwitterManager.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java index 2035d4c6..8c270326 100644 --- a/src/main/java/com/juick/Message.java +++ b/src/main/java/com/juick/Message.java @@ -26,6 +26,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder; import javax.annotation.Nonnull; import javax.xml.bind.annotation.*; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import java.io.Serializable; import java.net.URI; import java.time.Instant; import java.util.HashSet; @@ -39,7 +40,7 @@ import java.util.Set; */ @XmlRootElement(name = "juick", namespace = "http://juick.com/message") @XmlAccessorType() -public class Message implements Comparable { +public class Message implements Comparable, Serializable { private int mid = 0; private int rid = 0; private int replyto = 0; diff --git a/src/main/java/com/juick/User.java b/src/main/java/com/juick/User.java index f34f07a8..5407fa95 100644 --- a/src/main/java/com/juick/User.java +++ b/src/main/java/com/juick/User.java @@ -26,6 +26,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; +import java.io.Serializable; import java.net.URI; import java.time.Instant; import java.util.ArrayList; @@ -37,7 +38,7 @@ import java.util.Objects; */ @XmlRootElement(name = "user", namespace = "http://juick.com/user") @XmlAccessorType() -public class User { +public class User implements Serializable { private int uid; private String name; private String avatar; diff --git a/src/main/java/com/juick/server/TwitterManager.java b/src/main/java/com/juick/server/TwitterManager.java index 613594e6..d799bb17 100644 --- a/src/main/java/com/juick/server/TwitterManager.java +++ b/src/main/java/com/juick/server/TwitterManager.java @@ -22,6 +22,7 @@ import com.juick.service.UserService; import com.juick.service.component.*; import com.juick.service.CrosspostService; import com.juick.util.MessageUtils; +import org.apache.commons.lang3.SerializationUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -118,7 +119,7 @@ public class TwitterManager implements NotificationListener { @Override public void processTopEvent(TopEvent topEvent) { - Message jmsg = topEvent.getMessage(); + Message jmsg = SerializationUtils.clone(topEvent.getMessage()); jmsg.setUser(serviceUser); twitterPost(jmsg); } -- cgit v1.2.3