Program: 146178
Project: 146178
Buggy source:
/** 
 * /
 * @ejb.interface-method view-type = "service-endpoint"
 * @ejb.permission role-name = "authenticated" view-type = "service-endpoint"
 */
public WSItemPK putItem(WSPutItem wsPutItem) throws RemoteException {
  try {
    String projection=wsPutItem.getXmlString();
    Element root=Util.parse(projection).getDocumentElement();
    String concept=root.getLocalName();
    DataModelPOJO dataModel=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,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=Util.getItemCtrl2Local().putItem(new ItemPOJO(dcpk,concept,itemKeyValues,System.currentTimeMillis(),projection),dataModel);
    if (itemPOJOPK == null)     return null;
    Util.getDataClusterCtrlLocal().getDataCluster(dcpk).addToVocabulary(projection);
    return new WSItemPK(new WSDataClusterPK(itemPOJOPK.getDataClusterPOJOPK().getUniqueId()),itemPOJOPK.getConceptName(),itemPOJOPK.getIds());
  }
 catch (  XtentisException e) {
    String err="String_Node_Str" + e.getMessage();
    org.apache.log4j.Logger.getLogger(this.getClass()).debug(err,e);
    throw (new RemoteException(e.getLocalizedMessage()));
  }
catch (  Exception e) {
    String err="String_Node_Str" + e.getMessage();
    org.apache.log4j.Logger.getLogger(this.getClass()).debug(err,e);
    throw new RemoteException((e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()));
  }
}

Fixed version (ground truth):
/** 
 * /
 * @ejb.interface-method view-type = "service-endpoint"
 * @ejb.permission role-name = "authenticated" view-type = "service-endpoint"
 */
public WSItemPK putItem(WSPutItem wsPutItem) throws RemoteException {
  try {
    String projection=wsPutItem.getXmlString();
    Element root=Util.parse(projection).getDocumentElement();
    String concept=root.getLocalName();
    DataModelPOJO dataModel=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=Util.getItemCtrl2Local().putItem(new ItemPOJO(dcpk,concept,itemKeyValues,System.currentTimeMillis(),projection),dataModel);
    if (itemPOJOPK == null)     return null;
    Util.getDataClusterCtrlLocal().getDataCluster(dcpk).addToVocabulary(projection);
    return new WSItemPK(new WSDataClusterPK(itemPOJOPK.getDataClusterPOJOPK().getUniqueId()),itemPOJOPK.getConceptName(),itemPOJOPK.getIds());
  }
 catch (  XtentisException e) {
    String err="String_Node_Str" + e.getMessage();
    org.apache.log4j.Logger.getLogger(this.getClass()).debug(err,e);
    throw (new RemoteException(e.getLocalizedMessage()));
  }
catch (  Exception e) {
    String err="String_Node_Str" + e.getMessage();
    org.apache.log4j.Logger.getLogger(this.getClass()).debug(err,e);
    throw new RemoteException((e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()));
  }
}