Program: 12373
Project: 12373
Buggy source:
/** 
 * @param SBOLDoc
 * @param topLevel
 * @param nested
 * @return
 */
@SuppressWarnings("String_Node_Str") private static CombinatorialDerivation parseCombinatorialDerivation(SBOLDocument SBOLDoc,IdentifiableDocument<QName> topLevel,Map<URI,NestedDocument<QName>> nested) throws SBOLValidationException {
  String displayId=null;
  String name=null;
  String description=null;
  URI persistentIdentity=null;
  URI template=null;
  StrategyType strategy=null;
  String version=null;
  Set<URI> wasDerivedFroms=new HashSet<>();
  Set<URI> wasGeneratedBys=new HashSet<>();
  Set<URI> attachments=new HashSet<>();
  Set<VariableComponent> variableComponents=new HashSet<>();
  List<Annotation> annotations=new ArrayList<>();
  for (  NamedProperty<QName> namedProperty : topLevel.getProperties()) {
    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.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.CombinatorialDerivation.template)) {
      if (namedProperty.getValue() instanceof Literal) {
        if (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI)) {
          throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
        }
        template=URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString());
      }
 else       if (namedProperty.getValue() instanceof IdentifiableDocument) {
        if (((IdentifiableDocument<QName>)namedProperty).getType().equals(Sbol2Terms.ComponentDefinition.ComponentDefinition)) {
          ComponentDefinition cd=parseComponentDefinition(SBOLDoc,(IdentifiableDocument<QName>)namedProperty.getValue(),nested);
          template=cd.getIdentity();
        }
 else {
          throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
        }
      }
 else {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.CombinatorialDerivation.strategy)) {
      if (!(namedProperty.getValue() instanceof Literal) || strategy != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      String strategyTypeStr=((Literal<QName>)namedProperty.getValue()).getValue().toString();
      try {
        strategy=StrategyType.convertToStrategyType(URI.create(strategyTypeStr));
      }
 catch (      SBOLValidationException e) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
    }
 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.CombinatorialDerivation.hasVariableComponent)) {
      if (namedProperty.getValue() instanceof NestedDocument) {
        NestedDocument<QName> nestedDocument=((NestedDocument<QName>)namedProperty.getValue());
        if (nestedDocument.getType() == null || !nestedDocument.getType().equals(Sbol2Terms.VariableComponent.VariableComponent)) {
          throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
        }
        variableComponents.add(parseVariableComponent(SBOLDoc,((NestedDocument<QName>)namedProperty.getValue()),nested));
      }
 else {
        URI uri=(URI)((Literal<QName>)namedProperty.getValue()).getValue();
        NestedDocument<QName> nestedDocument=nested.get(uri);
        if (nestedDocument == null || nestedDocument.getType() == null || !nestedDocument.getType().equals(Sbol2Terms.VariableComponent.VariableComponent)) {
          throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
        }
        variableComponents.add(parseVariableComponent(SBOLDoc,nested.get(uri),nested));
      }
    }
 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));
    }
  }
  CombinatorialDerivation c=new CombinatorialDerivation(topLevel.getIdentity(),template);
  if (strategy != null)   c.setStrategy(strategy);
  if (displayId != null)   c.setDisplayId(displayId);
  if (persistentIdentity != null)   c.setPersistentIdentity(persistentIdentity);
  if (name != null)   c.setName(name);
  if (!variableComponents.isEmpty())   c.setVariableComponents(variableComponents);
  if (description != null)   c.setDescription(description);
  if (!annotations.isEmpty())   c.setAnnotations(annotations);
  if (version != null)   c.setVersion(version);
  c.setWasDerivedFroms(wasDerivedFroms);
  CombinatorialDerivation oldC=SBOLDoc.getCombinatorialDerivation(topLevel.getIdentity());
  if (oldC == null) {
    SBOLDoc.addCombinatorialDerivation(c);
  }
 else {
    if (!c.equals(oldC)) {
      throw new SBOLValidationException("String_Node_Str",c);
    }
  }
  return c;
}

Fixed version (ground truth):
/** 
 * @param SBOLDoc
 * @param topLevel
 * @param nested
 * @return
 */
@SuppressWarnings("String_Node_Str") private static CombinatorialDerivation parseCombinatorialDerivation(SBOLDocument SBOLDoc,IdentifiableDocument<QName> topLevel,Map<URI,NestedDocument<QName>> nested) throws SBOLValidationException {
  String displayId=null;
  String name=null;
  String description=null;
  URI persistentIdentity=null;
  URI template=null;
  StrategyType strategy=null;
  String version=null;
  Set<URI> wasDerivedFroms=new HashSet<>();
  Set<URI> wasGeneratedBys=new HashSet<>();
  Set<URI> attachments=new HashSet<>();
  Set<VariableComponent> variableComponents=new HashSet<>();
  List<Annotation> annotations=new ArrayList<>();
  for (  NamedProperty<QName> namedProperty : topLevel.getProperties()) {
    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.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.CombinatorialDerivation.template)) {
      if (namedProperty.getValue() instanceof Literal) {
        if (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI)) {
          throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
        }
        template=URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString());
      }
 else       if (namedProperty.getValue() instanceof IdentifiableDocument) {
        if (((IdentifiableDocument<QName>)namedProperty).getType().equals(Sbol2Terms.ComponentDefinition.ComponentDefinition)) {
          ComponentDefinition cd=parseComponentDefinition(SBOLDoc,(IdentifiableDocument<QName>)namedProperty.getValue(),nested);
          template=cd.getIdentity();
        }
 else {
          throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
        }
      }
 else {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
    }
 else     if (namedProperty.getName().equals(Sbol2Terms.CombinatorialDerivation.strategy)) {
      if (!(namedProperty.getValue() instanceof Literal) || strategy != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI))) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
      String strategyTypeStr=((Literal<QName>)namedProperty.getValue()).getValue().toString();
      try {
        strategy=StrategyType.convertToStrategyType(URI.create(strategyTypeStr));
      }
 catch (      SBOLValidationException e) {
        throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
      }
    }
 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.CombinatorialDerivation.hasVariableComponent)) {
      if (namedProperty.getValue() instanceof NestedDocument) {
        NestedDocument<QName> nestedDocument=((NestedDocument<QName>)namedProperty.getValue());
        if (nestedDocument.getType() == null || !nestedDocument.getType().equals(Sbol2Terms.VariableComponent.VariableComponent)) {
          throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
        }
        variableComponents.add(parseVariableComponent(SBOLDoc,((NestedDocument<QName>)namedProperty.getValue()),nested));
      }
 else {
        URI uri=(URI)((Literal<QName>)namedProperty.getValue()).getValue();
        NestedDocument<QName> nestedDocument=nested.get(uri);
        if (nestedDocument == null || nestedDocument.getType() == null || !nestedDocument.getType().equals(Sbol2Terms.VariableComponent.VariableComponent)) {
          throw new SBOLValidationException("String_Node_Str",topLevel.getIdentity());
        }
        variableComponents.add(parseVariableComponent(SBOLDoc,nested.get(uri),nested));
      }
    }
 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));
    }
  }
  CombinatorialDerivation c=new CombinatorialDerivation(topLevel.getIdentity(),template);
  if (strategy != null)   c.setStrategy(strategy);
  if (displayId != null)   c.setDisplayId(displayId);
  if (persistentIdentity != null)   c.setPersistentIdentity(persistentIdentity);
  if (name != null)   c.setName(name);
  if (!variableComponents.isEmpty())   c.setVariableComponents(variableComponents);
  if (description != null)   c.setDescription(description);
  if (!annotations.isEmpty())   c.setAnnotations(annotations);
  if (version != null)   c.setVersion(version);
  c.setWasDerivedFroms(wasDerivedFroms);
  c.setWasGeneratedBys(wasGeneratedBys);
  c.setAttachments(attachments);
  CombinatorialDerivation oldC=SBOLDoc.getCombinatorialDerivation(topLevel.getIdentity());
  if (oldC == null) {
    SBOLDoc.addCombinatorialDerivation(c);
  }
 else {
    if (!c.equals(oldC)) {
      throw new SBOLValidationException("String_Node_Str",c);
    }
  }
  return c;
}