Program: 12750
Project: 12750
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;
  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 (setURIPrefix != null) {
        identity=URI.create(setURIPrefix + "String_Node_Str" + SBOLDocument.TopLevelTypes.componentDefinition+ "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");
      AccessType access=AccessType.PUBLIC;
      URI instantiatedComponent=sa.getComponentURI();
      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 restrictionURI=Sbol2Terms.DnaComponentV1URI.restriction;
    RestrictionType restriction=SequenceConstraint.RestrictionType.convertToRestrictionType(restrictionURI);
    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);
  if (roles != null)   c.setRoles(roles);
  if (identity != componentDef.getIdentity())   c.setWasDerivedFrom(componentDef.getIdentity());
  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.setComponents(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();
  String persIdentity="String_Node_Str";
  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 (setURIPrefix != null) {
        persIdentity=setURIPrefix + "String_Node_Str" + SBOLDocument.TopLevelTypes.componentDefinition+ "String_Node_Str"+ displayId;
        identity=URI.create(persIdentity + "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,persIdentity,++sa_num);
      sequenceAnnotations.add(sa);
      URI component_identity=URI.create(persIdentity + "String_Node_Str" + ++component_num+ "String_Node_Str");
      AccessType access=AccessType.PUBLIC;
      URI instantiatedComponent=sa.getComponentURI();
      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(persIdentity + "String_Node_Str" + ++sc_number+ "String_Node_Str");
    URI restrictionURI=Sbol2Terms.DnaComponentV1URI.restriction;
    RestrictionType restriction=SequenceConstraint.RestrictionType.convertToRestrictionType(restrictionURI);
    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);
  if (roles != null)   c.setRoles(roles);
  if (identity != componentDef.getIdentity())   c.setWasDerivedFrom(componentDef.getIdentity());
  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.setComponents(components);
  if (!sequenceConstraints.isEmpty())   c.setSequenceConstraints(sequenceConstraints);
  return c;
}