aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-06-17 11:53:51 +0300
committerGravatar Vitaly Takmazov2019-06-17 11:53:51 +0300
commitfcce353e111604c9c048c75e9759645f08835c43 (patch)
treef1f63113d95433acf3389773815c975d5e0e5605 /src/main/java
parent789884af0ccdd299f943cfbce1afd15f69f6f567 (diff)
TwitterManager: do not overwrite top event message user
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/juick/Message.java3
-rw-r--r--src/main/java/com/juick/User.java3
-rw-r--r--src/main/java/com/juick/server/TwitterManager.java3
3 files changed, 6 insertions, 3 deletions
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);
}