Program: 148256
Project: 148256
Buggy source:
@Override protected boolean doSubmit() throws CommitException {
  try {
    XSDElementDeclaration decl=getCommitedObj().getSourceXSDContent();
    XSDElementDeclaration ref=null;
    if (decl.isElementDeclarationReference()) {
      ref=decl.getResolvedElementDeclaration();
    }
    XSDElementDeclaration newRef=Util.findReference(getCommitedObj().getNewReference(),getCommitedObj().getSchema());
    XSDIdentityConstraintDefinition identify=null;
    XSDXPathDefinition keyPath=null;
    List<Object> keyInfo=Util.getKeyInfo(getCommitedObj().getSourceXSDContent());
    if (keyInfo != null && keyInfo.size() > 0) {
      identify=(XSDIdentityConstraintDefinition)keyInfo.get(0);
      keyPath=(XSDXPathDefinition)keyInfo.get(1);
      identify.getFields().remove(keyPath);
    }
    getCommitedObj().getSourceXSDContent().setName("String_Node_Str".equals(getCommitedObj().getNewName()) ? null : getCommitedObj().getNewName());
    if (keyPath != null) {
      XSDFactory factory=XSDSchemaBuildingTools.getXSDFactory();
      XSDXPathDefinition field=factory.createXSDXPathDefinition();
      field.setVariety(keyPath.getVariety());
      field.setValue(getCommitedObj().getNewName());
      identify.getFields().add(field);
    }
    if (newRef != null) {
      decl.setResolvedElementDeclaration(newRef);
      decl.setTypeDefinition(null);
      Element elem=decl.getElement();
      if (elem.getAttributes().getNamedItem("String_Node_Str") != null)       elem.getAttributes().removeNamedItem("String_Node_Str");
      decl.updateElement();
    }
 else     if (ref != null) {
      getCommitedObj().getSourceXSDContent().setName(getCommitedObj().getNewName());
      getCommitedObj().getSourceXSDContent().setTypeDefinition(getCommitedObj().getSchema().getSchemaForSchema().resolveSimpleTypeDefinition(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001,"String_Node_Str"));
    }
    if (Util.changeElementTypeToSequence(decl,getCommitedObj().getNewMaxOcur()) == Status.CANCEL_STATUS) {
      return false;
    }
    getCommitedObj().getSourceElement().setMinOccurs(getCommitedObj().getNewMinOcur());
    if (getCommitedObj().getNewMaxOcur() > -1) {
      getCommitedObj().getSourceElement().setMaxOccurs(getCommitedObj().getNewMaxOcur());
    }
 else {
      getCommitedObj().getSourceElement().getElement().setAttribute("String_Node_Str","String_Node_Str");
    }
    getCommitedObj().getSourceElement().updateElement();
  }
 catch (  Exception e) {
    throw new CommitException(e.getMessage(),e);
  }
  return true;
}

Fixed version (ground truth):
@Override protected boolean doSubmit() throws CommitException {
  try {
    XSDElementDeclaration decl=getCommitedObj().getSourceXSDContent();
    XSDElementDeclaration ref=null;
    if (decl.isElementDeclarationReference()) {
      ref=decl.getResolvedElementDeclaration();
    }
    XSDElementDeclaration newRef=Util.findReference(getCommitedObj().getNewReference(),getCommitedObj().getSchema());
    XSDIdentityConstraintDefinition identify=null;
    XSDXPathDefinition keyPath=null;
    List<Object> keyInfo=Util.getKeyInfo(getCommitedObj().getSourceXSDContent());
    if (keyInfo != null && keyInfo.size() > 0) {
      identify=(XSDIdentityConstraintDefinition)keyInfo.get(0);
      keyPath=(XSDXPathDefinition)keyInfo.get(1);
      identify.getFields().remove(keyPath);
    }
    getCommitedObj().getSourceXSDContent().setName("String_Node_Str".equals(getCommitedObj().getNewName()) ? null : getCommitedObj().getNewName());
    if (keyPath != null) {
      XSDFactory factory=XSDSchemaBuildingTools.getXSDFactory();
      XSDXPathDefinition field=factory.createXSDXPathDefinition();
      field.setVariety(keyPath.getVariety());
      field.setValue(getCommitedObj().getNewName());
      identify.getFields().add(field);
    }
    if (newRef != null) {
      decl.setResolvedElementDeclaration(newRef);
      decl.setTypeDefinition(null);
      Element elem=decl.getElement();
      if (elem.getAttributes().getNamedItem("String_Node_Str") != null)       elem.getAttributes().removeNamedItem("String_Node_Str");
      decl.updateElement();
    }
 else     if (ref != null) {
      getCommitedObj().getSourceXSDContent().setName(getCommitedObj().getNewName());
      getCommitedObj().getSourceXSDContent().setTypeDefinition(getCommitedObj().getSchema().getSchemaForSchema().resolveSimpleTypeDefinition(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001,"String_Node_Str"));
    }
    int newMaxOcur=getCommitedObj().getNewMaxOcur();
    if (Util.changeElementTypeToSequence(decl,newMaxOcur) == Status.CANCEL_STATUS) {
      return false;
    }
    int newMinOcur=getCommitedObj().getNewMinOcur();
    getCommitedObj().getSourceElement().setMinOccurs(newMinOcur);
    if (newMaxOcur == -1 || (newMaxOcur == 0 & newMinOcur == 0)) {
      getCommitedObj().getSourceElement().getElement().setAttribute("String_Node_Str","String_Node_Str");
    }
 else {
      getCommitedObj().getSourceElement().setMaxOccurs(newMaxOcur);
    }
    getCommitedObj().getSourceElement().updateElement();
  }
 catch (  Exception e) {
    throw new CommitException(e.getMessage(),e);
  }
  return true;
}