Removed the possibility using a class StringBuilder.
boolean isMarkupStart = line.startsWith("\n***");
if (isMarkupStart) {
isStart = line.contains(START_TAG);
isEnd = line.contains(END_TAG);
inTag = isStart || isEnd;
}
if(inTag){
tagForMatch.append(line);
}else if (isInValidText) {
super.insertString(bypass, offset, line, attr);
}
//The stringbuffer is to be sure *** is not broken into many lines
if (inTag && tagForMatch.toString().endsWith("***")) {
isInValidText = isStart && !isEnd;
inTag = false;
tagForMatch.setLength(0);
}