avoid some false positive quotes

This commit is contained in:
Daniel Gultsch 2017-12-04 16:50:15 +01:00
parent 95553750a3
commit 9869310699

View file

@ -9,7 +9,6 @@ import android.widget.PopupMenu;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.math.BigInteger; import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
@ -313,16 +312,16 @@ public class UIHelper {
final char first = body.charAt(pos +1); final char first = body.charAt(pos +1);
return first == ';' return first == ';'
|| first == ':' || first == ':'
|| smallerThanBeforeWhitespace(body,pos+1); || closingBeforeWhitespace(body,pos+1);
} }
} }
private static boolean smallerThanBeforeWhitespace(CharSequence body, int pos) { private static boolean closingBeforeWhitespace(CharSequence body, int pos) {
for(int i = pos; i < body.length(); ++i) { for(int i = pos; i < body.length(); ++i) {
final char c = body.charAt(i); final char c = body.charAt(i);
if (Character.isWhitespace(c)) { if (Character.isWhitespace(c)) {
return false; return false;
} else if (c == '<') { } else if (c == '<' || c == '>') {
return body.length() == i + 1 || Character.isWhitespace(body.charAt(i + 1)); return body.length() == i + 1 || Character.isWhitespace(body.charAt(i + 1));
} }
} }