Browse Source

feat: improved handling of board parsing errors

develop
Ezerous 2 years ago
parent
commit
f378e7c465
  1. 11
      app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java

11
app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java

@ -59,6 +59,7 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
private String boardUrl; private String boardUrl;
private String boardTitle; private String boardTitle;
private String boardId;
private String parsedTitle; private String parsedTitle;
private String newTopicUrl; private String newTopicUrl;
@ -88,6 +89,8 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
if (!tmpUrlSbstr.substring(tmpUrlSbstr.indexOf("board=")).contains(".")) if (!tmpUrlSbstr.substring(tmpUrlSbstr.indexOf("board=")).contains("."))
boardUrl = tmpUrlSbstr + ".0"; boardUrl = tmpUrlSbstr + ".0";
boardId = ThmmyPage.getBoardId(boardUrl);
//Initializes graphics //Initializes graphics
toolbar = findViewById(R.id.toolbar); toolbar = findViewById(R.id.toolbar);
if (boardTitle != null && !Objects.equals(boardTitle, "")) toolbar.setTitle(boardTitle); if (boardTitle != null && !Objects.equals(boardTitle, "")) toolbar.setTitle(boardTitle);
@ -98,7 +101,7 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true);
} }
thisPageBookmark = new Bookmark(boardTitle, ThmmyPage.getBoardId(boardUrl), true); thisPageBookmark = new Bookmark(boardTitle, boardId, true);
if (boardTitle != null && !Objects.equals(boardTitle, "")) if (boardTitle != null && !Objects.equals(boardTitle, ""))
setBoardBookmark(findViewById(R.id.bookmark)); setBoardBookmark(findViewById(R.id.bookmark));
@ -303,7 +306,8 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
if (!parsingFailed) if (!parsingFailed)
tempSubBoards.add(new Board(pUrl, pTitle, pMods, pStats, pLastPost, pLastPostUrl)); tempSubBoards.add(new Board(pUrl, pTitle, pMods, pStats, pLastPost, pLastPostUrl));
else else
Timber.e("Parsing failed (pLastPost came with: \"%s\", subBoardColumns html was \"%s\")", pLastPost, subBoardColumns); Timber.e("Parsing failed for a subBoard in board %s (subBoardRow html was \"%s\")",
boardId, subBoardRow);
} }
} }
} }
@ -338,7 +342,8 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
pLastUser = matcher.group(2); pLastUser = matcher.group(2);
} }
else { else {
Timber.e("Parsing failed (pLastPost came with: \"%s\", topicColumns html was \"%s\")", pLastPost, topicColumns); Timber.e("Parsing failed for a topic in board %s (topicRow html was \"%s\")",
boardId, topicRow);
continue; continue;
} }

Loading…
Cancel
Save