Buggy code:
public class RoboSpiceRequestCategoriesArts extends SpiceRequest < Articles > { public static final String LOG = RoboSpiceRequestCategoriesArts . class . getSimpleName ( ) ; boolean resetCategoryInDB = false ; private Context ctx ; private MyRoboSpiceDatabaseHelper databaseHelper ; private String url ; private String categoryOrTagUrl ; public RoboSpiceRequestCategoriesArts ( Context ctx , String categoryOrTagUrl ) { } public void setResetCategoryInDB ( ) { } @ Override public Articles loadDataFromNetwork ( ) throws Exception { Articles articles = new Articles ( ) ; String responseBody = makeRequest ( ) ; Document document = Jsoup . parse ( responseBody ) ; ArrayList < Article > list = HtmlParsing . parseForArticlesList ( document , databaseHelper ) ; list = Article . writeArtsList ( list , databaseHelper ) ; int newArtsQuont ; Boolean isCategoryOrTagOrDoNotExists = MyRoboSpiceDatabaseHelper . isCategoryOrTagOrDoNotExists ( databaseHelper , this . categoryOrTagUrl ) ; if ( isCategoryOrTagOrDoNotExists == null ) { Log . i ( RoboSpiceRequestCategoriesArts . LOG , "NO<seq2seq4repair_space>such<seq2seq4repair_space>cat//tag<seq2seq4repair_space>in<seq2seq4repair_space>DB,<seq2seq4repair_space>so<seq2seq4repair_space>crete<seq2seq4repair_space>new<seq2seq4repair_space>one!" ) ; String title ; String urlOfCatOrTag ; if ( url . contains ( "//category//" ) ) { isCategoryOrTagOrDoNotExists = true ; title = document . head ( ) . getElementsByAttributeValue ( "og:title" , "content" ) . first ( ) . attr ( "content" ) ; if ( categoryOrTagUrl . startsWith ( "http" ) ) { int indexOfCategory = categoryOrTagUrl . indexOf ( "//category//" ) ; urlOfCatOrTag = categoryOrTagUrl . substring ( indexOfCategory ) ; } else { urlOfCatOrTag = categoryOrTagUrl ; } Category category = new Category ( ) ; category . setTitle ( title ) ; category . setUrl ( urlOfCatOrTag ) ; databaseHelper . getDaoCategory ( ) . createOrUpdate ( category ) ; } else if ( url . contains ( "//tag//" ) ) { isCategoryOrTagOrDoNotExists = false ; title = document . head ( ) . getElementsByAttributeValue ( "og:title" , "content" ) . first ( ) . attr ( "content" ) ; if ( categoryOrTagUrl . startsWith ( "http" ) ) { int indexOfTag = categoryOrTagUrl . indexOf ( "//tag//" ) ; urlOfCatOrTag = categoryOrTagUrl . substring ( indexOfTag ) ; } else { urlOfCatOrTag = categoryOrTagUrl ; } Tag tag = new Tag ( ) ; tag . setTitle ( title ) ; tag . setUrl ( urlOfCatOrTag ) ; databaseHelper . getDaoTag ( ) . createOrUpdate ( tag ) ; } else { throw new NullPointerException ( "can't<seq2seq4repair_space>figure<seq2seq4repair_space>out<seq2seq4repair_space>if<seq2seq4repair_space>it's<seq2seq4repair_space>category<seq2seq4repair_space>or<seq2seq4repair_space>tag..." ) ; } } boolean isCategoryOrTag = isCategoryOrTagOrDoNotExists ; if ( isCategoryOrTag ) { Category category = Category . getCategoryByUrl ( categoryOrTagUrl , databaseHelper ) ; if ( resetCategoryInDB ) { Log . i ( RoboSpiceRequestCategoriesArts . LOG , "resetCategoryInDB" ) ; ArrayList < ArticleCategory > allArtCatList = ( ( ArrayList < ArticleCategory > ) ( databaseHelper . getDaoArtCat ( ) . queryBuilder ( ) . where ( ) . eq ( FIELD_CATEGORY_ID , category . getId ( ) ) . query ( ) ) ) ; databaseHelper . getDaoArtCat ( ) . delete ( allArtCatList ) ; } newArtsQuont = ArticleCategory . writeArtsListToArtCatFromTop ( list , category . getId ( ) , databaseHelper ) ; category . setRefreshed ( Calendar . getInstance ( ) . getTime ( ) ) ; databaseHelper . getDaoCategory ( ) . createOrUpdate ( category ) . isUpdated ( ) ; } else { Tag tag = Tag . getTagByUrl ( categoryOrTagUrl , databaseHelper ) ; if ( resetCategoryInDB ) { Log . i ( RoboSpiceRequestCategoriesArts . LOG , "resetCategoryInDB" ) ; ArrayList < ArticleTag > allArtCatList = ( ( ArrayList < ArticleTag > ) ( databaseHelper . getDaoArtTag ( ) . queryBuilder ( ) . where ( ) . eq ( FIELD_TAG_ID , tag . getId ( ) ) . query ( ) ) ) ; databaseHelper . getDaoArtTag ( ) . delete ( allArtCatList ) ; } <START_BUG> newArtsQuont = ArticleTag . writeArtsListToArtCatFromTop ( list , tag . getId ( ) , databaseHelper ) ; <END_BUG> tag . setRefreshed ( Calendar . getInstance ( ) . getTime ( ) ) ; databaseHelper . getDaoTag ( ) . createOrUpdate ( tag ) . isUpdated ( ) ; } articles . setNumOfNewArts ( newArtsQuont ) ; articles . setResult ( list ) ; Log . d ( RoboSpiceRequestCategoriesArts . LOG , ( "list.size():<seq2seq4repair_space>" + ( list . size ( ) ) ) ) ; if ( ( list . size ( ) ) < ( Const . NUM_OF_ARTS_ON_PAGE ) ) { articles . setContainsBottomArt ( true ) ; } Log . d ( RoboSpiceRequestCategoriesArts . LOG , ( "articles.isContainsBottomArt():<seq2seq4repair_space>" + ( articles . isContainsBottomArt ( ) ) ) ) ; return articles ; } private String makeRequest ( ) throws Exception { } private void updateTagsAndCategoriesIfNeed ( String html ) { } private void createInitialTagCategoriesInfoFile ( ArrayList < Category > cats , ArrayList < Tag > tags ) { } No newline ; at end ; of file ; }

Fix:
newArtsQuont = ArticleTag . writeArtsListToArtTagFromTop ( list , tag . getId ( ) , databaseHelper ) ;