Source:
<code>private void processImageInContents() { ArrayList<PageModel> pages = NovelsDao.getInstance().getAllContentPageModel(); updated = 0; int count = 1; StringBuilder message = new StringBuilder(); for (PageModel page : pages) { message.delete(0, message.length()); message.append(LNReaderApplication.getInstance().getApplicationContext().getResources().getString(R.string.relink_task_progress, page.getPage(), count, pages.size())); publishProgress(new CallbackEventData(message.toString())); try { NovelContentModel content = NovelsDao.getInstance().getNovelContent(page, false, callback); if (content != null) { Document doc = Jsoup.parse(content.getContent()); Elements imageElements = doc.select("img"); for (Element image : imageElements) { String imgUrl = image.attr("src"); if (imgUrl.startsWith("file:/ String mntImgUrl = imgUrl.replace("file:/ Log.d(TAG, "Found image : " + imgUrl); if (!new File(mntImgUrl).exists()) { Log.d(TAG, "Old image doesn't exists/moved: " + mntImgUrl); String newUrl = imgUrl.replaceAll("file:/ String mntNewUrl = newUrl.replace("file:/ Log.d(TAG, "Trying to replace with " + mntNewUrl); if (new File(mntNewUrl).exists()) { Log.d(TAG, "Replace image: " + imgUrl + " ==> " + newUrl); image.attr("src", newUrl); ++updated; } } } } content.setContent(doc.html()); NovelsDao.getInstance().updateNovelContent(content); } } catch (Exception e) { <START> message.delete(0, message.length()); <END> message.append(LNReaderApplication.getInstance().getApplicationContext().getResources().getString(R.string.relink_task_error, page.getPage())); Log.e(TAG, message.toString(), e); publishProgress(new CallbackEventData(message.toString())); } if(this.isCancelled()) { Log.d(TAG, "Stopped relinking at:"+page.getPage()+" ["+count+" of "+pages.size()+"]"); break; } ++count; } }</code><technical_language>need delete message</technical_language>

Target:
private void processImageInContents() { ArrayList<PageModel> pages = NovelsDao.getInstance().getAllContentPageModel(); updated = 0; int count = 1; for (PageModel page : pages) { String message = LNReaderApplication.getInstance().getApplicationContext().getResources().getString(R.string.relink_task_progress, page.getPage(), count, pages.size()); publishProgress(new CallbackEventData(message)); try { NovelContentModel content = NovelsDao.getInstance().getNovelContent(page, false, callback); if (content != null) { Document doc = Jsoup.parse(content.getContent()); Elements imageElements = doc.select("img"); for (Element image : imageElements) { String imgUrl = image.attr("src"); if (imgUrl.startsWith("file:/ String mntImgUrl = imgUrl.replace("file:/ Log.d(TAG, "Found image : " + imgUrl); if (!new File(mntImgUrl).exists()) { Log.d(TAG, "Old image doesn't exists/moved: " + mntImgUrl); String newUrl = imgUrl.replaceAll("file:/ String mntNewUrl = newUrl.replace("file:/ Log.d(TAG, "Trying to replace with " + mntNewUrl); if (new File(mntNewUrl).exists()) { Log.d(TAG, "Replace image: " + imgUrl + " ==> " + newUrl); image.attr("src", newUrl); ++updated; } } } } content.setContent(doc.html()); NovelsDao.getInstance().updateNovelContent(content); } } catch (Exception e) { message = LNReaderApplication.getInstance().getApplicationContext().getResources().getString(R.string.relink_task_error, page.getPage()); Log.e(TAG, message, e); publishProgress(new CallbackEventData(message)); } ++count; } }