Merge branch 'release-0.9.5'
[Sone.git] / src / main / java / net / pterodactylus / sone / text / SoneTextParser.java
index 18ac467..fb4e7cd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - SoneTextParser.java - Copyright © 2010–2015 David Roden
+ * Sone - SoneTextParser.java - Copyright © 2010–2016 David Roden
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -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<SoneTextParserContext> {
        /**
         * {@inheritDoc}
         */
+       @Nonnull
        @Override
-       public Iterable<Part> parse(SoneTextParserContext context, String source) throws IOException {
+       public Iterable<Part> parse(@Nonnull String source, @Nullable SoneTextParserContext context) {
                PartContainer parts = new PartContainer();
                BufferedReader bufferedReader = new BufferedReader(new StringReader(source));
                try {
@@ -271,6 +275,9 @@ public class SoneTextParser implements Parser<SoneTextParserContext> {
                                }
                                lastLineEmpty = false;
                        }
+               } catch (IOException ioe1) {
+                       // a buffered reader around a string reader should never throw.
+                       throw new RuntimeException(ioe1);
                } finally {
                        Closer.close(bufferedReader);
                }