Trim texts of posts and replies before posting.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 17 Jan 2013 11:59:49 +0000 (12:59 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 17 Jan 2013 11:59:49 +0000 (12:59 +0100)
src/main/java/net/pterodactylus/sone/core/Core.java

index 94908cb..7e68521 100644 (file)
@@ -1537,7 +1537,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider
                        logger.log(Level.FINE, String.format("Tried to create post for non-local Sone: %s", sone));
                        return null;
                }
-               final Post post = new PostImpl(sone, time, text);
+               final Post post = new PostImpl(sone, time, text.trim());
                if (recipient != null) {
                        post.setRecipient(recipient);
                }
@@ -1679,7 +1679,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider
                        logger.log(Level.FINE, String.format("Tried to create reply for non-local Sone: %s", sone));
                        return null;
                }
-               final PostReply reply = new PostReply(sone, post, System.currentTimeMillis(), text);
+               final PostReply reply = new PostReply(sone, post, System.currentTimeMillis(), text.trim());
                synchronized (replies) {
                        replies.put(reply.getId(), reply);
                }