Source:
<code>private StyledString getLineElementLabel(AttributeLineElement lineElement) { String lineNumberString; AttributeType attrType = <START> lineElement.getParent().getAttributeById(lineElement.getAttribute(), false).getAttributeType(); <END> if (attrType.equals(CoreAttributeTypes.WholeWordContent) || attrType.equals(CoreAttributeTypes.WordTemplateContent)) { lineNumberString = ""; } else { lineNumberString = String.format("%s, %s ", lineElement.getLine(), lineElement.getOffset()); } StyledString str = new StyledString(lineNumberString, StyledString.QUALIFIER_STYLER); Match[] matches = lineElement.getMatches(fPage.getInput()); Arrays.sort(matches, fMatchComparator); String content = lineElement.getContents(); int pos = evaluateLineStart(matches, content, lineElement.getOffset()); int length = content.length(); int charsToCut = getCharsToCut(length, matches); for (int i = 0; i < matches.length; i++) { AttributeMatch match = (AttributeMatch) matches[i]; int start = Math.max(match.getOriginalOffset() - lineElement.getOffset(), 0); if (pos < start) { if (charsToCut > 0) { charsToCut = appendShortenedGap(content, pos, start, charsToCut, i == 0, str); } else { str.append(content.substring(pos, start)); } } int end = Math.min(match.getOriginalOffset() + match.getOriginalLength() - lineElement.getOffset(), lineElement.getLength()); str.append(content.substring(start, end), HIGHLIGHT_STYLE); pos = end; } if (charsToCut > 0) { appendShortenedGap(content, pos, length, charsToCut, false, str); } else { str.append(content.substring(pos)); } return str; }</code><technical_language>Is a possibility of a null pointer exception here</technical_language>

Target:
private StyledString getLineElementLabel(AttributeLineElement lineElement) { String lineNumberString; Attribute<?> attribute = lineElement.getParent().getAttributeById(lineElement.getAttribute(), false); if (attribute.isOfType(CoreAttributeTypes.WholeWordContent) || attribute.isOfType(CoreAttributeTypes.WordTemplateContent)) { lineNumberString = ""; } else { lineNumberString = String.format("%s, %s ", lineElement.getLine(), lineElement.getOffset()); } StyledString str = new StyledString(lineNumberString, StyledString.QUALIFIER_STYLER); Match[] matches = lineElement.getMatches(fPage.getInput()); Arrays.sort(matches, fMatchComparator); String content = lineElement.getContents(); int pos = evaluateLineStart(matches, content, lineElement.getOffset()); int length = content.length(); int charsToCut = getCharsToCut(length, matches); for (int i = 0; i < matches.length; i++) { AttributeMatch match = (AttributeMatch) matches[i]; int start = Math.max(match.getOriginalOffset() - lineElement.getOffset(), 0); if (pos < start) { if (charsToCut > 0) { charsToCut = appendShortenedGap(content, pos, start, charsToCut, i == 0, str); } else { str.append(content.substring(pos, start)); } } int end = Math.min(match.getOriginalOffset() + match.getOriginalLength() - lineElement.getOffset(), lineElement.getLength()); str.append(content.substring(start, end), HIGHLIGHT_STYLE); pos = end; } if (charsToCut > 0) { appendShortenedGap(content, pos, length, charsToCut, false, str); } else { str.append(content.substring(pos)); } return str; }