Program: 68061
Project: 68061
Buggy source:
private void processSimpleAttribute(String targetNamespace,String defaultNamespace,SDOType owningType,Attribute attribute,boolean isGlobal,boolean isQualified){
  if (attribute == null) {
    return;
  }
  SDOProperty p=null;
  String typeName=null;
  SDOType sdoPropertyType=null;
  String mappingUri=null;
  if (owningType != null) {
    mappingUri=owningType.getURI();
  }
  if (attribute.getRef() != null) {
    String ref=attribute.getRef();
    String localName=null;
    String uri=null;
    int index=ref.indexOf(':');
    if (index != -1) {
      String prefix=ref.substring(0,index);
      localName=ref.substring(index + 1,ref.length());
      uri=getURIForPrefix(prefix);
    }
 else {
      localName=ref;
      uri=defaultNamespace;
    }
    Property lookedUp=owningType.getProperty(localName);
    if (lookedUp != null) {
      if (inRestriction) {
        return;
      }
      updateCollisionProperty(owningType,(SDOProperty)lookedUp);
    }
 else {
      SDOProperty theProp=new SDOProperty(aHelperContext);
      theProp.setName(localName);
      theProp.setGlobal(false);
      theProp.setContainment(false);
      theProp.setXsd(true);
      theProp.setMany(false);
      if (attribute.getAnnotation() != null) {
        java.util.List doc=attribute.getAnnotation().getDocumentation();
        if (doc != null) {
          theProp.setInstanceProperty(SDOConstants.DOCUMENTATION_PROPERTY,doc);
        }
      }
      theProp.setFinalized(true);
      GlobalRef globalRef=new GlobalRef();
      globalRef.setProperty(theProp);
      owningType.addDeclaredProperty(theProp);
      globalRef.setIsElement(false);
      globalRef.setOwningType(owningType);
      globalRef.setUri(uri);
      globalRef.setLocalName(localName);
      addGlobalRef(globalRef);
    }
    return;
  }
 else {
    if (isGlobal) {
      SDOProperty lookedUpProp=getExistingGlobalProperty(targetNamespace,attribute.getName(),false);
      if (lookedUpProp != null && lookedUpProp.isFinalized()) {
        return;
      }
    }
    p=createNewProperty(targetNamespace,attribute.getName(),isQualified,isGlobal,false,false,attribute.getAnnotation());
    if (attribute.getAnnotation() != null) {
      p.setAppInfoElements(attribute.getAnnotation().getAppInfo());
    }
    typeName=attribute.getType();
    if (typeName != null) {
      p.setName(attribute.getName());
      QName qname=getQNameForString(defaultNamespace,typeName);
      if (isGlobal) {
        processGlobalItem(targetNamespace,defaultNamespace,typeName);
      }
      if ((qname.equals(XMLConstants.BASE_64_BINARY_QNAME)) || (qname.equals(XMLConstants.HEX_BINARY_QNAME)) || (qname.equals(XMLConstants.DATE_QNAME))|| (qname.equals(XMLConstants.TIME_QNAME))|| (qname.equals(XMLConstants.DATE_TIME_QNAME))) {
        p.setXsdType(qname);
      }
      sdoPropertyType=getSDOTypeForName(targetNamespace,defaultNamespace,typeName);
      if ((p.getXsdType() == null) && (sdoPropertyType.getXsdType() != null)) {
        p.setXsdType(sdoPropertyType.getXsdType());
      }
    }
 else     if (attribute.getSimpleType() != null) {
      p.setName(attribute.getName());
      sdoPropertyType=getSDOTypeForName(targetNamespace,defaultNamespace,attribute.getName());
      typeName=attribute.getName();
    }
 else {
      p.setName(attribute.getName());
      sdoPropertyType=((SDOTypeHelper)aHelperContext.getTypeHelper()).getSDOTypeFromXSDType(SDOConstants.ANY_TYPE_QNAME);
    }
  }
  sdoPropertyType=processSimpleComponentAnnotations(owningType,attribute,p,targetNamespace,defaultNamespace,sdoPropertyType);
  p.setType(sdoPropertyType);
  p.setContainment(false);
  setDefaultValue(p,attribute);
  if (p.getType().isChangeSummaryType()) {
    p.setReadOnly(true);
  }
  if (owningType != null) {
    updateOwnerAndBuildMapping(owningType,p,defaultNamespace,targetNamespace,attribute,typeName,mappingUri);
  }
  p.setFinalized(true);
}

Fixed version (ground truth):
private void processSimpleAttribute(String targetNamespace,String defaultNamespace,SDOType owningType,Attribute attribute,boolean isGlobal,boolean isQualified,SDOType sdoPropertyType){
  if (attribute == null) {
    return;
  }
  SDOProperty p=null;
  String typeName=null;
  String mappingUri=null;
  if (owningType != null) {
    mappingUri=owningType.getURI();
  }
  if (attribute.getRef() != null) {
    String ref=attribute.getRef();
    String localName=null;
    String uri=null;
    int index=ref.indexOf(':');
    if (index != -1) {
      String prefix=ref.substring(0,index);
      localName=ref.substring(index + 1,ref.length());
      uri=getURIForPrefix(prefix);
    }
 else {
      localName=ref;
      uri=defaultNamespace;
    }
    Property lookedUp=owningType.getProperty(localName);
    if (lookedUp != null) {
      if (inRestriction) {
        return;
      }
      updateCollisionProperty(owningType,(SDOProperty)lookedUp);
    }
 else {
      SDOProperty theProp=new SDOProperty(aHelperContext);
      theProp.setName(localName);
      theProp.setGlobal(false);
      theProp.setContainment(false);
      theProp.setXsd(true);
      theProp.setMany(false);
      if (attribute.getAnnotation() != null) {
        java.util.List doc=attribute.getAnnotation().getDocumentation();
        if (doc != null) {
          theProp.setInstanceProperty(SDOConstants.DOCUMENTATION_PROPERTY,doc);
        }
      }
      theProp.setFinalized(true);
      GlobalRef globalRef=new GlobalRef();
      globalRef.setProperty(theProp);
      owningType.addDeclaredProperty(theProp);
      globalRef.setIsElement(false);
      globalRef.setOwningType(owningType);
      globalRef.setUri(uri);
      globalRef.setLocalName(localName);
      addGlobalRef(globalRef);
    }
    return;
  }
 else {
    if (isGlobal) {
      SDOProperty lookedUpProp=getExistingGlobalProperty(targetNamespace,attribute.getName(),false);
      if (lookedUpProp != null && lookedUpProp.isFinalized()) {
        return;
      }
    }
    p=createNewProperty(targetNamespace,attribute.getName(),isQualified,isGlobal,false,false,attribute.getAnnotation());
    if (attribute.getAnnotation() != null) {
      p.setAppInfoElements(attribute.getAnnotation().getAppInfo());
    }
    typeName=attribute.getType();
    if (typeName != null) {
      p.setName(attribute.getName());
      QName qname=getQNameForString(defaultNamespace,typeName);
      if (isGlobal) {
        processGlobalItem(targetNamespace,defaultNamespace,typeName);
      }
      if ((qname.equals(XMLConstants.BASE_64_BINARY_QNAME)) || (qname.equals(XMLConstants.HEX_BINARY_QNAME)) || (qname.equals(XMLConstants.DATE_QNAME))|| (qname.equals(XMLConstants.TIME_QNAME))|| (qname.equals(XMLConstants.DATE_TIME_QNAME))) {
        p.setXsdType(qname);
      }
      sdoPropertyType=getSDOTypeForName(targetNamespace,defaultNamespace,typeName);
      if ((p.getXsdType() == null) && (sdoPropertyType.getXsdType() != null)) {
        p.setXsdType(sdoPropertyType.getXsdType());
      }
    }
 else     if (attribute.getSimpleType() != null) {
      p.setName(attribute.getName());
      typeName=attribute.getName();
    }
 else {
      p.setName(attribute.getName());
      sdoPropertyType=((SDOTypeHelper)aHelperContext.getTypeHelper()).getSDOTypeFromXSDType(SDOConstants.ANY_TYPE_QNAME);
    }
  }
  sdoPropertyType=processSimpleComponentAnnotations(owningType,attribute,p,targetNamespace,defaultNamespace,sdoPropertyType);
  p.setType(sdoPropertyType);
  p.setContainment(false);
  setDefaultValue(p,attribute);
  if (p.getType().isChangeSummaryType()) {
    p.setReadOnly(true);
  }
  if (owningType != null) {
    updateOwnerAndBuildMapping(owningType,p,defaultNamespace,targetNamespace,attribute,typeName,mappingUri);
  }
  p.setFinalized(true);
}