public static StringAnnotation fromRawString(String value) { return new StringAnnotation(Strings.escapeLFCRBackSlash(value)); }
static StringAnnotation obfuscate(StringAnnotation m) { StringAnnotation result = new StringAnnotation("obfuscated: " + hashData(m.getValue())); result.setDescription(m.getDescription()); return result; }
/** * Add a String annotation. * * @param value * the String value * @return this object */ @Nonnull public BugInstance addString(String value) { add(StringAnnotation.fromRawString(value)); return this; }
ValueNumberFrame vnaFrame, @CheckForNull String partialRole) { if (location.getHandle().getInstruction() instanceof ACONST_NULL) { StringAnnotation nullConstant = new StringAnnotation("null"); nullConstant.setDescription(StringAnnotation.STRING_NONSTRING_CONSTANT_ROLE); return nullConstant;
/** * Returns a printable String concatenating bug locations. */ private static String getBugsLocations(List<BugInstance> unexpectedBugs) { StringBuilder message = new StringBuilder(); for (BugInstance bugInstance : unexpectedBugs) { message.append("\n"); if (bugInstance.getBugPattern().getType().equals(FB_MISSING_EXPECTED_WARNING)) { message.append("missing "); } else { message.append("unexpected "); } StringAnnotation pattern = (StringAnnotation) bugInstance.getAnnotations().get(2); message.append(pattern.getValue()); message.append(" "); message.append(bugInstance.getPrimarySourceLineAnnotation()); } return message.toString(); }
@Override public void writeXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary) throws IOException { XMLAttributeList attributeList = new XMLAttributeList().addAttribute("value", value); String role = getDescription(); if (!DEFAULT_ROLE.equals(role)) { attributeList.addAttribute("role", role); } BugAnnotationUtil.writeXML(xmlOutput, ELEMENT_NAME, this, attributeList, addMessages); }
@Override public String toString(ClassAnnotation primaryClass) { return toString(); } }
@Override public void writeXML(XMLOutput xmlOutput) throws IOException { writeXML(xmlOutput, false, false); }
bugAnnotation = StringAnnotation.fromXMLEscapedString(value); } else if ("LocalVariable".equals(qName)) { try {
private void addMessage(BugInstance bug, String role, String text) { StringAnnotation stringAnnotation = new StringAnnotation(text); stringAnnotation.setDescription(role); bug.add(stringAnnotation); }
@Override public void writeXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary) throws IOException { XMLAttributeList attributeList = new XMLAttributeList().addAttribute("value", value); String role = getDescription(); if (!DEFAULT_ROLE.equals(role)) { attributeList.addAttribute("role", role); } BugAnnotationUtil.writeXML(xmlOutput, ELEMENT_NAME, this, attributeList, addMessages); }
@Override public String toString(ClassAnnotation primaryClass) { return toString(); } }
@Override public void writeXML(XMLOutput xmlOutput) throws IOException { writeXML(xmlOutput, false, false); }
bugAnnotation = StringAnnotation.fromXMLEscapedString(value); } else if ("LocalVariable".equals(qName)) { try {
public static StringAnnotation fromXMLEscapedString(String value) { return new StringAnnotation(Strings.unescapeXml(value)); }
static StringAnnotation obfuscate(StringAnnotation m) { StringAnnotation result = new StringAnnotation("obfuscated: " + hashData(m.getValue())); result.setDescription(m.getDescription()); return result; }
private void addMessage(BugInstance bug, String role, String text) { StringAnnotation stringAnnotation = new StringAnnotation(text); stringAnnotation.setDescription(role); bug.add(stringAnnotation); }
/** * Add a String annotation. * * @param c * the char value * @return this object */ @Nonnull public BugInstance addString(char c) { add(StringAnnotation.fromRawString(Character.toString(c))); return this; }