X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftext%2FSoneTextParser.java;h=ae299e1163ea4072f7f83a4b99c9a91ad93e6b17;hb=16b7ecd68873178d79b81023fc702d61d7696e13;hp=18ac4678e66975074171ac3b0650da203715905a;hpb=662bcd45433c0ab480ad0e52f3e72e9e886bdfc6;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java index 18ac467..ae299e1 100644 --- a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java +++ b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java @@ -28,6 +28,9 @@ import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.data.impl.IdOnlySone; @@ -117,8 +120,9 @@ public class SoneTextParser implements Parser { /** * {@inheritDoc} */ + @Nonnull @Override - public Iterable parse(SoneTextParserContext context, String source) throws IOException { + public Iterable parse(@Nullable SoneTextParserContext context, @Nonnull String source) { PartContainer parts = new PartContainer(); BufferedReader bufferedReader = new BufferedReader(new StringReader(source)); try { @@ -271,6 +275,9 @@ public class SoneTextParser implements Parser { } lastLineEmpty = false; } + } catch (IOException ioe1) { + // a buffered reader around a string reader should never throw. + throw new RuntimeException(ioe1); } finally { Closer.close(bufferedReader); }