Program: 149237
Project: 149237
Buggy source:
/** 
 * Put Item
 */
public WSItemPK putItem(WSPutItem wsPutItem) throws RemoteException {
  try {
    String projection=wsPutItem.getXmlString();
    Element root=Util.parse(projection).getDocumentElement();
    String concept=root.getLocalName();
    DataModelPOJO dataModel=com.amalto.core.util.Util.getDataModelCtrlLocal().getDataModel(new DataModelPOJOPK(wsPutItem.getWsDataModelPK().getPk()));
    Document schema=Util.parse(dataModel.getSchema());
    XSDKey conceptKey=com.amalto.core.util.Util.getBusinessConceptKey(schema,concept);
    String[] itemKeyValues=com.amalto.core.util.Util.getKeyValuesFromItem(root,conceptKey);
    if (conceptKey.getFields().length == 1) {
      Element conceptRoot=Util.parse(projection).getDocumentElement();
      if (Util.getNodeList(conceptRoot,"String_Node_Str" + concept + "String_Node_Str"+ conceptKey.getFields()[0]).getLength() == 0) {
        Element rootNS=Util.getRootElement("String_Node_Str",schema.getDocumentElement().getNamespaceURI(),"String_Node_Str");
        NodeList complexLists=Util.getNodeList(schema.getDocumentElement(),"String_Node_Str",rootNS.getNamespaceURI(),"String_Node_Str");
        List<UUIDKey> keys=new ArrayList<UUIDKey>();
        for (int i=0; i < complexLists.getLength(); i++) {
          Element element=(Element)complexLists.item(i);
          UUIDKey uuidKey=Util.getUUIDKey(element);
          if (uuidKey != null) {
            keys.add(uuidKey);
            if (i == 0) {
              itemKeyValues=new String[]{uuidKey.getUuidValue()};
            }
          }
        }
        if (keys.size() > 0) {
          projection=Util.getProjectXMLString(keys.toArray(new UUIDKey[keys.size()]),projection);
        }
      }
    }
    DataClusterPOJOPK dcpk=new DataClusterPOJOPK(wsPutItem.getWsDataClusterPK().getPk());
    ItemPOJOPK itemPOJOPK=com.amalto.core.util.Util.getItemCtrl2Local().putItem(new ItemPOJO(dcpk,concept,itemKeyValues,System.currentTimeMillis(),projection),dataModel);
    if (itemPOJOPK == null)     return null;
    com.amalto.core.util.Util.getDataClusterCtrlLocal().addToVocabulary(dcpk,projection);
    return new WSItemPK(new WSDataClusterPK(itemPOJOPK.getDataClusterPOJOPK().getUniqueId()),itemPOJOPK.getConceptName(),itemPOJOPK.getIds());
  }
 catch (  com.amalto.core.util.XtentisException e) {
    throw (new RemoteException(e.getLocalizedMessage()));
  }
catch (  Exception e) {
    throw new RemoteException((e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()));
  }
}

Fixed version (ground truth):
/** 
 * Put Item
 */
public WSItemPK putItem(WSPutItem wsPutItem) throws RemoteException {
  try {
    String projection=wsPutItem.getXmlString();
    Element root=Util.parse(projection).getDocumentElement();
    String concept=root.getLocalName();
    DataModelPOJO dataModel=com.amalto.core.util.Util.getDataModelCtrlLocal().getDataModel(new DataModelPOJOPK(wsPutItem.getWsDataModelPK().getPk()));
    Document schema=Util.parse(dataModel.getSchema());
    XSDKey conceptKey=com.amalto.core.util.Util.getBusinessConceptKey(schema,concept);
    String[] itemKeyValues=com.amalto.core.util.Util.getKeyValuesFromItem(root,conceptKey);
    if (conceptKey.getFields().length == 1) {
      Element conceptRoot=Util.parse(projection).getDocumentElement();
      if (Util.getNodeList(conceptRoot,"String_Node_Str" + concept + "String_Node_Str"+ conceptKey.getFields()[0]).getLength() == 0) {
        Element rootNS=Util.getRootElement("String_Node_Str",schema.getDocumentElement().getNamespaceURI(),"String_Node_Str");
        NodeList complexLists=Util.getNodeList(schema.getDocumentElement(),"String_Node_Str",rootNS.getNamespaceURI(),"String_Node_Str");
        List<UUIDKey> keys=new ArrayList<UUIDKey>();
        for (int i=0; i < complexLists.getLength(); i++) {
          Element element=(Element)complexLists.item(i);
          UUIDKey uuidKey=Util.getUUIDKey(element);
          if (uuidKey != null) {
            keys.add(uuidKey);
            if (i == 0) {
              itemKeyValues=new String[]{uuidKey.getUuidValue()};
            }
          }
        }
        if (keys.size() > 0) {
          if (itemKeyValues == null || itemKeyValues[0] == null)           itemKeyValues=new String[]{keys.get(0).getUuidValue()};
          projection=Util.getProjectXMLString(keys.toArray(new UUIDKey[keys.size()]),projection);
        }
      }
    }
    DataClusterPOJOPK dcpk=new DataClusterPOJOPK(wsPutItem.getWsDataClusterPK().getPk());
    ItemPOJOPK itemPOJOPK=com.amalto.core.util.Util.getItemCtrl2Local().putItem(new ItemPOJO(dcpk,concept,itemKeyValues,System.currentTimeMillis(),projection),dataModel);
    if (itemPOJOPK == null)     return null;
    com.amalto.core.util.Util.getDataClusterCtrlLocal().addToVocabulary(dcpk,projection);
    return new WSItemPK(new WSDataClusterPK(itemPOJOPK.getDataClusterPOJOPK().getUniqueId()),itemPOJOPK.getConceptName(),itemPOJOPK.getIds());
  }
 catch (  com.amalto.core.util.XtentisException e) {
    throw (new RemoteException(e.getLocalizedMessage()));
  }
catch (  Exception e) {
    throw new RemoteException((e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()));
  }
}