From: David ‘Bombe’ Roden <bombe@pterodactylus.net>
Date: Thu, 14 Oct 2010 19:06:37 +0000 (+0200)
Subject: Terminate list of Posts and Replies (to prevent Ghost post/replies from appearing... 
X-Git-Tag: 0.1-RC1~357
X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=beaffe1ccafdf9adaaf7660dc198ade011c71c06;p=Sone.git

Terminate list of Posts and Replies (to prevent Ghost post/replies from appearing after reloading the plugin).
---

diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java
index aeb7d4f..b38aac6 100644
--- a/src/main/java/net/pterodactylus/sone/core/Core.java
+++ b/src/main/java/net/pterodactylus/sone/core/Core.java
@@ -352,6 +352,9 @@ public class Core extends AbstractService {
 					configuration.getLongValue(postPrefix + "/Time").setValue(post.getTime());
 					configuration.getStringValue(postPrefix + "/Text").setValue(post.getText());
 				}
+				/* write null ID as terminator. */
+				configuration.getStringValue(sonePrefix + "/Post." + postId + "/ID").setValue(null);
+
 				int replyId = 0;
 				for (Reply reply : sone.getReplies()) {
 					String replyPrefix = sonePrefix + "/Reply." + replyId++;
@@ -363,6 +366,9 @@ public class Core extends AbstractService {
 					configuration.getLongValue(replyPrefix + "/Time").setValue(reply.getTime());
 					configuration.getStringValue(replyPrefix + "/Text").setValue(reply.getText());
 				}
+				/* write null ID as terminator. */
+				configuration.getStringValue(sonePrefix + "/Reply." + replyId + "/ID").setValue(null);
+
 			}
 		} catch (ConfigurationException ce1) {
 			logger.log(Level.WARNING, "Could not store configuration!", ce1);