From: David ‘Bombe’ Roden Date: Sat, 9 Nov 2013 00:00:01 +0000 (+0100) Subject: Extract removal of trailing whitespace parts into its own method. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=a3d9921d99a094c86c48531444b28ad650c849ff;p=Sone.git Extract removal of trailing whitespace parts into its own method. --- diff --git a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java index 313758e..78d9bdc 100644 --- a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java +++ b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java @@ -298,6 +298,11 @@ public class SoneTextParser implements Parser { Closer.close(bufferedReader); } } + removeTrailingWhitespaceParts(parts); + return parts; + } + + private void removeTrailingWhitespaceParts(PartContainer parts) { for (int partIndex = parts.size() - 1; partIndex >= 0; --partIndex) { Part part = parts.getPart(partIndex); if (!(part instanceof PlainTextPart) || !"\n".equals(part.getText())) { @@ -305,7 +310,6 @@ public class SoneTextParser implements Parser { } parts.removePart(partIndex); } - return parts; } private int findNextWhitespace(String line) {