Buggy code:
public class API implements APIProvider { private final Connection c ; public API ( Connection c ) { } @ Override public Result < Map < String , String > > getUsers ( ) { } @ Override public Result < PersonView > getPersonView ( String username ) { } @ Override public Result < List < SimpleForumSummaryView > > getSimpleForums ( ) { } @ Override public Result < Integer > countPostsInTopic ( long topicId ) { } @ Override public Result < List < PersonView > > getLikers ( long topicId ) { } @ Override public Result < SimpleTopicView > getSimpleTopic ( long topicId ) { try ( PreparedStatement s = c . prepareStatement ( ( "SELECT<seq2seq4repair_space>t.id<seq2seq4repair_space>as<seq2seq4repair_space>topicid,<seq2seq4repair_space>t.title,<seq2seq4repair_space>p.id<seq2seq4repair_space>as<seq2seq4repair_space>postid,<seq2seq4repair_space>per.username,<seq2seq4repair_space>p.text,<seq2seq4repair_space>p.date<seq2seq4repair_space>FROM<seq2seq4repair_space>Topic<seq2seq4repair_space>AS<seq2seq4repair_space>t<seq2seq4repair_space>" + ( ( "JOIN<seq2seq4repair_space>Post<seq2seq4repair_space>AS<seq2seq4repair_space>p<seq2seq4repair_space>ON<seq2seq4repair_space>t.id<seq2seq4repair_space>=<seq2seq4repair_space>p.topicid<seq2seq4repair_space>" + "JOIN<seq2seq4repair_space>Person<seq2seq4repair_space>AS<seq2seq4repair_space>per<seq2seq4repair_space>ON<seq2seq4repair_space>p.authorid<seq2seq4repair_space>=<seq2seq4repair_space>per.id<seq2seq4repair_space>" ) + "WHERE<seq2seq4repair_space>t.id<seq2seq4repair_space>=<seq2seq4repair_space>?" ) ) ) ) { s . setLong ( 1 , topicId ) ; ResultSet r = s . executeQuery ( ) ; <START_BUG> List simplePostsList = new ArrayList < SimplePostView > ( ) ; <END_BUG> while ( r . next ( ) ) { SimplePostView spv = new SimplePostView ( r . getInt ( "postid" ) , r . getString ( "username" ) , r . getString ( "text" ) , r . getInt ( "date" ) ) ; simplePostsList . add ( spv ) ; } r . first ( ) ; SimpleTopicView stv = new SimpleTopicView ( r . getLong ( "id" ) , r . getString ( "title" ) , simplePostsList ) ; return Result . success ( stv ) ; } catch ( SQLException ex ) { printError ( ( "Error<seq2seq4repair_space>in<seq2seq4repair_space>getSimpleTopic:<seq2seq4repair_space>" + ( ex . getMessage ( ) ) ) ) ; } return Result . fatal ( "Fatal<seq2seq4repair_space>getSimpleTopic" ) ; } @ Override public Result < PostView > getLatestPost ( long topicId ) { } @ Override public Result < List < ForumSummaryView > > getForums ( ) { } @ Override public Result createForum ( String title ) { } @ Override public Result createPost ( long topicId , String username , String text ) { } @ Override public Result addNewPerson ( String name , String username , String studentId ) { } @ Override public Result < ForumView > getForum ( long id ) { } @ Override public Result < TopicView > getTopic ( long topicId , int page ) { } @ Override public Result likeTopic ( String username , long topicId , boolean like ) { } @ Override public Result favouriteTopic ( String username , long topicId , boolean fav ) { } @ Override public Result createTopic ( long forumId , String username , String title , String text ) { } @ Override public Result < List < AdvancedForumSummaryView > > getAdvancedForums ( ) { } @ Override public Result < AdvancedPersonView > getAdvancedPersonView ( String username ) { } @ Override public Result < AdvancedForumView > getAdvancedForum ( long id ) { } @ Override public Result likePost ( String username , long topicId , int post , boolean like ) { } private void printError ( String s ) { } private void printDebug ( String s ) { } }

Fix:
List < SimplePostView > simplePostsList = new ArrayList < > ( ) ;