Program: 12851
Project: 12851
Buggy source:
private static ComponentDefinition parseDnaComponentV1(SBOLDocument SBOLDoc,IdentifiableDocument<QName> componentDef){
  String displayId=null;
  String name=null;
  String description=null;
  URI seq_identity=null;
  Set<URI> roles=new HashSet<URI>();
  URI identity=componentDef.getIdentity();
  List<Annotation> annotations=new ArrayList<Annotation>();
  List<SequenceAnnotation> sequenceAnnotations=new ArrayList<SequenceAnnotation>();
  List<Component> components=new ArrayList<Component>();
  List<SequenceConstraint> sequenceConstraints=new ArrayList<SequenceConstraint>();
  List<SBOLPair> precedePairs=new ArrayList<SBOLPair>();
  Map<URI,URI> componentDefMap=new HashMap<URI,URI>();
  Set<URI> type=new HashSet<URI>();
  type.add(Sbol2Terms.DnaComponentV1URI.type);
  int component_num=0;
  for (  NamedProperty<QName> namedProperty : componentDef.getProperties()) {
    if (namedProperty.getName().equals(Sbol1Terms.DNAComponent.displayId)) {
      displayId=((Literal<QName>)namedProperty.getValue()).getValue().toString();
      if (authority != null) {
        identity=URI.create(authority + "String_Node_Str" + displayId+ "String_Node_Str");
      }
    }
 else     if (namedProperty.getName().equals(Sbol1Terms.DNAComponent.name)) {
      name=((Literal<QName>)namedProperty.getValue()).getValue().toString();
    }
 else     if (namedProperty.getName().equals(Sbol1Terms.DNAComponent.description)) {
      description=((Literal<QName>)namedProperty.getValue()).getValue().toString();
    }
 else     if (namedProperty.getName().equals(Sbol1Terms.DNAComponent.type)) {
      roles.add(URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString()));
    }
 else     if (namedProperty.getName().equals(Sbol1Terms.DNAComponent.annotations)) {
      SequenceAnnotation sa=parseSequenceAnnotationV1(SBOLDoc,((NestedDocument<QName>)namedProperty.getValue()),precedePairs,identity);
      sequenceAnnotations.add(sa);
      URI component_identity=URI.create(getParentURI(identity) + "String_Node_Str" + ++component_num+ "String_Node_Str");
      URI access=Sbol2Terms.Access.PUBLIC;
      URI instantiatedComponent=sa.getComponent();
      componentDefMap.put(sa.getIdentity(),component_identity);
      sa.setComponent(component_identity);
      Component component=new Component(component_identity,access,instantiatedComponent);
      components.add(component);
    }
 else     if (namedProperty.getName().equals(Sbol1Terms.DNAComponent.dnaSequence)) {
      seq_identity=parseDnaSequenceV1(SBOLDoc,(NestedDocument<QName>)namedProperty.getValue()).getIdentity();
    }
 else {
      annotations.add(new Annotation(namedProperty));
    }
  }
  if (roles.isEmpty())   roles.add(Sbol2Terms.DnaComponentV1URI.roles);
  int sc_number=0;
  for (  SBOLPair pair : precedePairs) {
    URI sc_identity=URI.create(getParentURI(identity) + "String_Node_Str" + ++sc_number+ "String_Node_Str");
    URI restriction=Sbol2Terms.DnaComponentV1URI.restriction;
    URI subject=null;
    URI object=null;
    for (    URI key : componentDefMap.keySet()) {
      if (pair.getLeft().equals(key)) {
        subject=componentDefMap.get(key);
      }
 else       if (pair.getRight().equals(key)) {
        object=componentDefMap.get(key);
      }
    }
    SequenceConstraint sc=new SequenceConstraint(sc_identity,restriction,subject,object);
    sequenceConstraints.add(sc);
  }
  ComponentDefinition c=SBOLDoc.createComponentDefinition(identity,type,roles);
  if (displayId != null)   c.setDisplayId(displayId);
  if (name != null && !name.isEmpty())   c.setName(name);
  if (description != null && !description.isEmpty())   c.setDescription(description);
  if (seq_identity != null)   c.setSequence(seq_identity);
  if (!annotations.isEmpty())   c.setAnnotations(annotations);
  if (!sequenceAnnotations.isEmpty())   c.setSequenceAnnotations(sequenceAnnotations);
  if (!components.isEmpty())   c.setSubComponents(components);
  if (!sequenceConstraints.isEmpty())   c.setSequenceConstraints(sequenceConstraints);
  return c;
}

Fixed version (ground truth):
private static ComponentDefinition parseDnaComponentV1(SBOLDocument SBOLDoc,IdentifiableDocument<QName> componentDef){
  String displayId=null;
  String name=null;
  String description=null;
  URI seq_identity=null;
  Set<URI> roles=new HashSet<URI>();
  URI identity=componentDef.getIdentity();
  List<Annotation> annotations=new ArrayList<Annotation>();
  List<SequenceAnnotation> sequenceAnnotations=new ArrayList<SequenceAnnotation>();
  List<Component> components=new ArrayList<Component>();
  List<SequenceConstraint> sequenceConstraints=new ArrayList<SequenceConstraint>();
  List<SBOLPair> precedePairs=new ArrayList<SBOLPair>();
  Map<URI,URI> componentDefMap=new HashMap<URI,URI>();
  Set<URI> type=new HashSet<URI>();
  type.add(Sbol2Terms.DnaComponentV1URI.type);
  int component_num=0;
  int sa_num=0;
  for (  NamedProperty<QName> namedProperty : componentDef.getProperties()) {
    if (namedProperty.getName().equals(Sbol1Terms.DNAComponent.displayId)) {
      displayId=((Literal<QName>)namedProperty.getValue()).getValue().toString();
      if (authority != null) {
        identity=URI.create(authority + "String_Node_Str" + displayId+ "String_Node_Str");
      }
    }
 else     if (namedProperty.getName().equals(Sbol1Terms.DNAComponent.name)) {
      name=((Literal<QName>)namedProperty.getValue()).getValue().toString();
    }
 else     if (namedProperty.getName().equals(Sbol1Terms.DNAComponent.description)) {
      description=((Literal<QName>)namedProperty.getValue()).getValue().toString();
    }
 else     if (namedProperty.getName().equals(Sbol1Terms.DNAComponent.type)) {
      roles.add(URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString()));
    }
 else     if (namedProperty.getName().equals(Sbol1Terms.DNAComponent.annotations)) {
      SequenceAnnotation sa=parseSequenceAnnotationV1(SBOLDoc,((NestedDocument<QName>)namedProperty.getValue()),precedePairs,identity,++sa_num);
      sequenceAnnotations.add(sa);
      URI component_identity=URI.create(getParentURI(identity) + "String_Node_Str" + ++component_num+ "String_Node_Str");
      URI access=Sbol2Terms.Access.PUBLIC;
      URI instantiatedComponent=sa.getComponent();
      URI originalURI=((NestedDocument<QName>)namedProperty.getValue()).getIdentity();
      componentDefMap.put(originalURI,component_identity);
      sa.setComponent(component_identity);
      Component component=new Component(component_identity,access,instantiatedComponent);
      components.add(component);
    }
 else     if (namedProperty.getName().equals(Sbol1Terms.DNAComponent.dnaSequence)) {
      seq_identity=parseDnaSequenceV1(SBOLDoc,(NestedDocument<QName>)namedProperty.getValue()).getIdentity();
    }
 else {
      annotations.add(new Annotation(namedProperty));
    }
  }
  if (roles.isEmpty())   roles.add(Sbol2Terms.DnaComponentV1URI.roles);
  int sc_number=0;
  for (  SBOLPair pair : precedePairs) {
    URI sc_identity=URI.create(getParentURI(identity) + "String_Node_Str" + ++sc_number+ "String_Node_Str");
    URI restriction=Sbol2Terms.DnaComponentV1URI.restriction;
    URI subject=null;
    URI object=null;
    for (    URI key : componentDefMap.keySet()) {
      if (pair.getLeft().equals(key)) {
        subject=componentDefMap.get(key);
      }
 else       if (pair.getRight().equals(key)) {
        object=componentDefMap.get(key);
      }
    }
    SequenceConstraint sc=new SequenceConstraint(sc_identity,restriction,subject,object);
    sequenceConstraints.add(sc);
  }
  ComponentDefinition c=SBOLDoc.createComponentDefinition(identity,type,roles);
  if (displayId != null)   c.setDisplayId(displayId);
  if (name != null && !name.isEmpty())   c.setName(name);
  if (description != null && !description.isEmpty())   c.setDescription(description);
  if (seq_identity != null)   c.setSequence(seq_identity);
  if (!annotations.isEmpty())   c.setAnnotations(annotations);
  if (!sequenceAnnotations.isEmpty())   c.setSequenceAnnotations(sequenceAnnotations);
  if (!components.isEmpty())   c.setSubComponents(components);
  if (!sequenceConstraints.isEmpty())   c.setSequenceConstraints(sequenceConstraints);
  return c;
}