Program: 12366
Project: 12366
Buggy source:
@SuppressWarnings("String_Node_Str") private static Attachment parseAttachment(SBOLDocument SBOLDoc,IdentifiableDocument<QName> topLevel) throws SBOLValidationException {
  String displayId=null;
  String name=null;
  String description=null;
  URI persistentIdentity=null;
  String version=null;
  URI source=null;
  URI format=null;
  Long size=null;
  String hash=null;
  Set<URI> wasDerivedFroms=new HashSet<>();
  Set<URI> wasGeneratedBys=new HashSet<>();
  Set<URI> attachments=new HashSet<>();
  List<Annotation> annotations=new ArrayList<>();
  for (  NamedProperty<QName> namedProperty : topLevel.getProperties()) {
    if (namedProperty.getName().equals(Sbol2Terms.Identified.persistentIdentity)) {
      if (!(namedProperty.getValue() instanceof Literal) || persistentIdentity != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      persistentIdentity=URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString());
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Identified.version)) {
      if (!(namedProperty.getValue() instanceof Literal) || version != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof String))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      version=((Literal<QName>)namedProperty.getValue()).getValue().toString();
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Identified.displayId)) {
      if (!(namedProperty.getValue() instanceof Literal) || displayId != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof String))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      displayId=((Literal<QName>)namedProperty.getValue()).getValue().toString();
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Attachment.source)) {
      if (!(namedProperty.getValue() instanceof Literal) || source != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      source=URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString());
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Attachment.format)) {
      if (!(namedProperty.getValue() instanceof Literal) || format != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      format=URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString());
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Attachment.size)) {
      if (!(namedProperty.getValue() instanceof Literal) || size != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof String))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      size=Long.valueOf(((Literal<QName>)namedProperty.getValue()).getValue().toString());
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Attachment.hash)) {
      if (!(namedProperty.getValue() instanceof Literal) || hash != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof String))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      hash=((Literal<QName>)namedProperty.getValue()).getValue().toString();
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Identified.title)) {
      if (!(namedProperty.getValue() instanceof Literal) || name != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof String))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      name=((Literal<QName>)namedProperty.getValue()).getValue().toString();
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Identified.description)) {
      if (!(namedProperty.getValue() instanceof Literal) || description != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof String))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      description=((Literal<QName>)namedProperty.getValue()).getValue().toString();
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Identified.wasDerivedFrom)) {
      if (!(namedProperty.getValue() instanceof Literal) || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      wasDerivedFroms.add(URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString()));
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Identified.wasGeneratedBy)) {
      if (!(namedProperty.getValue() instanceof Literal) || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      wasGeneratedBys.add(URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString()));
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.TopLevel.hasAttachment)) {
      if (namedProperty.getValue() instanceof Literal) {
        if (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI)) {
          throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
        }
        attachments.add(URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString()));
      }
 else       if (namedProperty.getValue() instanceof IdentifiableDocument) {
        if (((IdentifiableDocument<QName>)namedProperty).getType().equals(Sbol2Terms.Attachment.Attachment)) {
          Attachment attachment=parseAttachment(SBOLDoc,(IdentifiableDocument<QName>)namedProperty.getValue());
          attachments.add(attachment.getIdentity());
        }
 else {
          throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
        }
      }
 else {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
    }
 else {
      annotations.add(new Annotation(namedProperty));
    }
  }
  Attachment a=new Attachment(topLevel.getIdentity(),source);
  if (persistentIdentity != null)   a.setPersistentIdentity(persistentIdentity);
  if (version != null)   a.setVersion(version);
  if (displayId != null)   a.setDisplayId(displayId);
  if (name != null)   a.setName(name);
  if (description != null)   a.setDescription(description);
  a.setWasDerivedFroms(wasDerivedFroms);
  a.setWasGeneratedBys(wasGeneratedBys);
  if (!annotations.isEmpty())   a.setAnnotations(annotations);
  if (format != null)   a.setFormat(format);
  if (size != null)   a.setSize(size);
  if (hash != null)   a.setHash(hash);
  Attachment oldA=SBOLDoc.getAttachment(topLevel.getIdentity());
  if (oldA == null) {
    SBOLDoc.addAttachment(a);
  }
 else {
    if (!a.equals(oldA)) {
      throw new SBOLValidationException("String_Node_Str",a);
    }
  }
  return a;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private static Attachment parseAttachment(SBOLDocument SBOLDoc,IdentifiableDocument<QName> topLevel) throws SBOLValidationException {
  String displayId=null;
  String name=null;
  String description=null;
  URI persistentIdentity=null;
  String version=null;
  URI source=null;
  URI format=null;
  Long size=null;
  String hash=null;
  Set<URI> wasDerivedFroms=new HashSet<>();
  Set<URI> wasGeneratedBys=new HashSet<>();
  Set<URI> attachments=new HashSet<>();
  List<Annotation> annotations=new ArrayList<>();
  for (  NamedProperty<QName> namedProperty : topLevel.getProperties()) {
    if (namedProperty.getName().equals(Sbol2Terms.Identified.persistentIdentity)) {
      if (!(namedProperty.getValue() instanceof Literal) || persistentIdentity != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      persistentIdentity=URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString());
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Identified.version)) {
      if (!(namedProperty.getValue() instanceof Literal) || version != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof String))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      version=((Literal<QName>)namedProperty.getValue()).getValue().toString();
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Identified.displayId)) {
      if (!(namedProperty.getValue() instanceof Literal) || displayId != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof String))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      displayId=((Literal<QName>)namedProperty.getValue()).getValue().toString();
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Attachment.source)) {
      if (!(namedProperty.getValue() instanceof Literal) || source != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      source=URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString());
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Attachment.format)) {
      if (!(namedProperty.getValue() instanceof Literal) || format != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      format=URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString());
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Attachment.size)) {
      if (!(namedProperty.getValue() instanceof Literal) || size != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof String))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      size=Long.valueOf(((Literal<QName>)namedProperty.getValue()).getValue().toString());
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Attachment.hash)) {
      if (!(namedProperty.getValue() instanceof Literal) || hash != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof String))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      hash=((Literal<QName>)namedProperty.getValue()).getValue().toString();
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Identified.title)) {
      if (!(namedProperty.getValue() instanceof Literal) || name != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof String))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      name=((Literal<QName>)namedProperty.getValue()).getValue().toString();
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Identified.description)) {
      if (!(namedProperty.getValue() instanceof Literal) || description != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof String))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      description=((Literal<QName>)namedProperty.getValue()).getValue().toString();
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Identified.wasDerivedFrom)) {
      if (!(namedProperty.getValue() instanceof Literal) || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      wasDerivedFroms.add(URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString()));
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.Identified.wasGeneratedBy)) {
      if (!(namedProperty.getValue() instanceof Literal) || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      wasGeneratedBys.add(URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString()));
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.TopLevel.hasAttachment)) {
      if (namedProperty.getValue() instanceof Literal) {
        if (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI)) {
          throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
        }
        attachments.add(URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString()));
      }
 else       if (namedProperty.getValue() instanceof IdentifiableDocument) {
        if (((IdentifiableDocument<QName>)namedProperty).getType().equals(Sbol2Terms.Attachment.Attachment)) {
          Attachment attachment=parseAttachment(SBOLDoc,(IdentifiableDocument<QName>)namedProperty.getValue());
          attachments.add(attachment.getIdentity());
        }
 else {
          throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
        }
      }
 else {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
    }
 else {
      annotations.add(new Annotation(namedProperty));
    }
  }
  Attachment a=new Attachment(topLevel.getIdentity(),source);
  if (persistentIdentity != null)   a.setPersistentIdentity(persistentIdentity);
  if (version != null)   a.setVersion(version);
  if (displayId != null)   a.setDisplayId(displayId);
  if (name != null)   a.setName(name);
  if (description != null)   a.setDescription(description);
  a.setWasDerivedFroms(wasDerivedFroms);
  a.setWasGeneratedBys(wasGeneratedBys);
  a.setAttachments(attachments);
  if (!annotations.isEmpty())   a.setAnnotations(annotations);
  if (format != null)   a.setFormat(format);
  if (size != null)   a.setSize(size);
  if (hash != null)   a.setHash(hash);
  Attachment oldA=SBOLDoc.getAttachment(topLevel.getIdentity());
  if (oldA == null) {
    SBOLDoc.addAttachment(a);
  }
 else {
    if (!a.equals(oldA)) {
      throw new SBOLValidationException("String_Node_Str",a);
    }
  }
  return a;
}