Program: 12461
Project: 12461
Buggy source:
/** 
 * @param typeGenLoc
 * @return
 * @throws SBOLValidationException if either of the following conditions is satisfied:<ul> <li>any of the following SBOL validation rules was violated: 10203, 10204, 10206, 10208, 10212, 10213,  11002; or   </li> <li>an SBOL validation rule violation occurred in the following constructor or methods: <ul> <li> {@link GenericLocation#GenericLocation(URI)},</li> <li>  {@link GenericLocation#setDisplayId(String)},</li> <li>  {@link GenericLocation#setVersion(String)},</li>	 <li>  {@link GenericLocation#setWasDerivedFrom(URI)}, or</li> <li>  {@link Identified#setAnnotations(List)}.</li> </ul> </li> </ul>
 */
private static GenericLocation parseGenericLocation(NestedDocument<QName> typeGenLoc) throws SBOLValidationException {
  String displayId=null;
  String name=null;
  String description=null;
  URI persistentIdentity=null;
  URI orientation=null;
  String version=null;
  Set<URI> wasDerivedFroms=new HashSet<>();
  List<Annotation> annotations=new ArrayList<>();
  for (  NamedProperty<QName> namedProperty : typeGenLoc.getProperties()) {
    if (namedProperty.getName().equals(Sbol2Terms.GenericLocation.orientation)) {
      if (!(namedProperty.getValue() instanceof Literal) || orientation != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI))) {
        throw new SBOLValidationException("String_Node_Str",typeGenLoc.getIdentity());
      }
      orientation=URI.create(((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",typeGenLoc.getIdentity());
      }
      displayId=((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",typeGenLoc.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",typeGenLoc.getIdentity());
      }
      description=((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",typeGenLoc.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",typeGenLoc.getIdentity());
      }
      version=((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",typeGenLoc.getIdentity());
      }
      wasDerivedFroms.add(URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString()));
    }
 else {
      annotations.add(new Annotation(namedProperty));
    }
  }
  GenericLocation gl=new GenericLocation(typeGenLoc.getIdentity());
  if (displayId != null)   gl.setDisplayId(displayId);
  if (name != null)   gl.setName(name);
  if (description != null)   gl.setDescription(description);
  if (orientation != null)   try {
    gl.setOrientation(OrientationType.convertToOrientationType(orientation));
  }
 catch (  SBOLValidationException e) {
    throw new SBOLValidationException("String_Node_Str",gl);
  }
  if (persistentIdentity != null)   gl.setPersistentIdentity(persistentIdentity);
  if (version != null)   gl.setVersion(version);
  gl.setWasDerivedFroms(wasDerivedFroms);
  if (!annotations.isEmpty())   gl.setAnnotations(annotations);
  return gl;
}

Fixed version (ground truth):
/** 
 * @param typeGenLoc
 * @return
 * @throws SBOLValidationException if either of the following conditions is satisfied:<ul> <li>any of the following SBOL validation rules was violated: 10203, 10204, 10206, 10208, 10212, 10213,  11002; or   </li> <li>an SBOL validation rule violation occurred in the following constructor or methods: <ul> <li> {@link GenericLocation#GenericLocation(URI)},</li> <li>  {@link GenericLocation#setDisplayId(String)},</li> <li>  {@link GenericLocation#setVersion(String)},</li>	 <li>  {@link GenericLocation#setWasDerivedFrom(URI)}, or</li> <li>  {@link Identified#setAnnotations(List)}.</li> </ul> </li> </ul>
 */
private static GenericLocation parseGenericLocation(NestedDocument<QName> typeGenLoc) throws SBOLValidationException {
  String displayId=null;
  String name=null;
  String description=null;
  URI persistentIdentity=null;
  URI orientation=null;
  String version=null;
  Set<URI> wasDerivedFroms=new HashSet<>();
  List<Annotation> annotations=new ArrayList<>();
  for (  NamedProperty<QName> namedProperty : typeGenLoc.getProperties()) {
    if (namedProperty.getName().equals(Sbol2Terms.GenericLocation.orientation) || namedProperty.getName().equals(Sbol2Terms.GenericLocation.Orientation)) {
      if (!(namedProperty.getValue() instanceof Literal) || orientation != null || (!(((Literal<QName>)namedProperty.getValue()).getValue() instanceof URI))) {
        throw new SBOLValidationException("String_Node_Str",typeGenLoc.getIdentity());
      }
      orientation=URI.create(((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",typeGenLoc.getIdentity());
      }
      displayId=((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",typeGenLoc.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",typeGenLoc.getIdentity());
      }
      description=((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",typeGenLoc.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",typeGenLoc.getIdentity());
      }
      version=((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",typeGenLoc.getIdentity());
      }
      wasDerivedFroms.add(URI.create(((Literal<QName>)namedProperty.getValue()).getValue().toString()));
    }
 else {
      annotations.add(new Annotation(namedProperty));
    }
  }
  GenericLocation gl=new GenericLocation(typeGenLoc.getIdentity());
  if (displayId != null)   gl.setDisplayId(displayId);
  if (name != null)   gl.setName(name);
  if (description != null)   gl.setDescription(description);
  if (orientation != null)   try {
    gl.setOrientation(OrientationType.convertToOrientationType(orientation));
  }
 catch (  SBOLValidationException e) {
    throw new SBOLValidationException("String_Node_Str",gl);
  }
  if (persistentIdentity != null)   gl.setPersistentIdentity(persistentIdentity);
  if (version != null)   gl.setVersion(version);
  gl.setWasDerivedFroms(wasDerivedFroms);
  if (!annotations.isEmpty())   gl.setAnnotations(annotations);
  return gl;
}