Move HTML sanitation to DbThread
HTML Sanitation currently causes a StrictMode violation:
D/StrictMode: StrictMode policy violation; ~duration=407 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=31 violation=2
at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1152)
at libcore.io.BlockGuardOs.stat(BlockGuardOs.java:292)
at java.io.File.isDirectory(File.java:524)
at java.io.File.getAbsoluteName(File.java:1099)
at java.io.File.toURL(File.java:1085)
at dalvik.system.DexPathList$Element.findResource(DexPathList.java:477)
at dalvik.system.DexPathList.findResource(DexPathList.java:343)
at dalvik.system.BaseDexClassLoader.findResource(BaseDexClassLoader.java:67)
at java.lang.ClassLoader.getResource(ClassLoader.java:403)
at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:442)
at java.lang.Class.getResourceAsStream(Class.java:1368)
at org.jsoup.nodes.Entities.loadEntities(Entities.java:240)
at org.jsoup.nodes.Entities.<clinit>(Entities.java:225)
at org.jsoup.nodes.Entities.access$000(Entities.java:17)
at org.jsoup.nodes.Entities$EscapeMode.<clinit>(Entities.java:20)
at org.jsoup.nodes.Document$OutputSettings.<init>(Document.java:371)
at org.jsoup.nodes.Document.<init>(Document.java:18)
at org.jsoup.nodes.Document.createShell(Document.java:42)
at org.jsoup.parser.Parser.parseBodyFragment(Parser.java:128)
at org.jsoup.Jsoup.parseBodyFragment(Jsoup.java:148)
at org.jsoup.Jsoup.clean(Jsoup.java:198)
at org.jsoup.Jsoup.clean(Jsoup.java:215)
at org.briarproject.briar.util.HtmlUtils.clean(HtmlUtils.java:15)
The clean()
method should be called right after the blog posts are retrieved from disk to prevent that.