HtmlEx: added debug logging

pull/209/head
M66B 2 years ago
parent 933ad6a991
commit 16fc4360c6

@ -141,15 +141,7 @@ public class HtmlEx {
int n1 = text.nextSpanTransition(i, end, QuoteSpan.class);
int n2 = text.nextSpanTransition(i, end, eu.faircode.email.IndentSpan.class);
next = Math.min(n1, n2);
if (next > end) {
StringBuilder sb = new StringBuilder();
TextUtils.dumpSpans(text, new StringBuilderPrinter(sb), "withinDiv ");
sb.append(" next=").append(next);
sb.append(" start=").append(start);
sb.append(" end=").append(end);
eu.faircode.email.Log.e(sb.toString());
next = end;
}
try {
List<Object> spans = new ArrayList<>();
for (Object span : getSpans(text, i, next, LeadingMarginSpan.class))
if (span instanceof QuoteSpan ||
@ -172,6 +164,11 @@ public class HtmlEx {
for (Object span : spans) {
out.append("</blockquote>\n");
}
} catch (Throwable ex) {
Log.e("withinDiv " + start + "..." + end + "/" + text.length() +
" i=" + i + " n1=" + n1 + " n2=" + n2);
throw ex;
}
}
}
@ -248,6 +245,7 @@ public class HtmlEx {
int next;
for (int i = start; i <= end; i = next) {
next = TextUtils.indexOf(text, '\n', i, end);
try {
if (next < 0) {
next = end;
}
@ -327,6 +325,11 @@ public class HtmlEx {
}
next++;
} catch (Throwable ex) {
Log.e("withinBlockquoteIndividual " + start + "..." + end + "/" + text.length() +
" i=" + i + " next=" + next);
throw ex;
}
}
}
@ -371,6 +374,7 @@ public class HtmlEx {
int next;
for (int i = start; i < end; i = next) {
next = text.nextSpanTransition(i, end, CharacterStyle.class);
try {
CharacterStyle[] style = getSpans(text, i, next, CharacterStyle.class);
for (int j = 0; j < style.length; j++) {
@ -521,6 +525,11 @@ public class HtmlEx {
}
}
}
} catch (Throwable ex) {
Log.e("withinParagraph " + start + "..." + end + "/" + text.length() +
" i=" + i + " next=" + next);
throw ex;
}
}
}
@ -528,6 +537,7 @@ public class HtmlEx {
private /* static */ void withinStyle(StringBuilder out, CharSequence text,
int start, int end) {
for (int i = start; i < end; i++) {
try {
char c = text.charAt(i);
if (c == '<') {
@ -557,6 +567,10 @@ public class HtmlEx {
} else {
out.append(c);
}
} catch (Throwable ex) {
Log.e("withinStyle " + start + "..." + end + "/" + text.length() + " i=" + i);
throw ex;
}
}
}

Loading…
Cancel
Save