Index: /branches/eam_branch_20080430/psLib/src/types/psMetadata.c
===================================================================
--- /branches/eam_branch_20080430/psLib/src/types/psMetadata.c	(revision 17505)
+++ /branches/eam_branch_20080430/psLib/src/types/psMetadata.c	(revision 17506)
@@ -12,6 +12,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.168.6.2 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2008-05-02 00:10:43 $
+ *  @version $Revision: 1.168.6.3 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2008-05-04 23:39:27 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -423,5 +423,6 @@
     default:
         // Other kinds of pointers
-        psWarning("Copying a pointer in the metadata item: %s (%x)\n", in->name, in->type);
+      // XXX EAM : why was this a warning??
+      // psWarning("Copying a pointer in the metadata item: %s (%x)\n", in->name, in->type);
         newItem = p_psMetadataItemAlloc(file, lineno, func, in->name, in->type, in->comment, in->data.V);
         break;
@@ -502,5 +503,5 @@
     // save a list of the MULTI entries which has REPLACE turned off?
 
-    psArray *multiItems = psArrayAlloc (128);
+    psArray *multiItems = psArrayAllocEmpty (128);
 
     psMetadataIterator *iter = psMetadataIteratorAlloc(in, PS_LIST_HEAD, NULL);
@@ -545,5 +546,5 @@
         psMetadataItem *newItem = psMetadataItemCopy(inItem); // Copied item
         if (!psMetadataAddItem(out, newItem, PS_LIST_TAIL, flag)) {
-            fprintf (stderr, "Error copying %s\n", inItem->name);
+	    psError(PS_ERR_UNKNOWN, false, "Error copying %s\n", inItem->name);
             result = false;
         }
@@ -692,12 +693,21 @@
 
     // special block for items which are METADATA folders
-    if (item->type == PS_DATA_METADATA) {
+    if (existingEntry && (item->type == PS_DATA_METADATA)) {
+	// REPLACE and UPDATE must be mutually exclusive
+	psAssert ((!((flags & PS_META_REPLACE) && (flags & PS_META_UPDATE_FOLDER))), "cannot have both REPLACE and UPDATE");
+
+	# if (0) 
+	// handle the case of replace below
 	if (flags & PS_META_REPLACE) {
 	    // drop the existing entry (skip if we are replacing with same pointer)
 	    // XXX what if existingEntry is a MULTI?  drop all?
+	    // XXX this segment does not check for matched types
 	    if (item != existingEntry) {
 		psMetadataRemoveKey(md, key);
 	    }
+	    existingEntry = NULL;
 	} 
+	# endif
+
 	if (flags & PS_META_UPDATE_FOLDER) {
 	    if (existingEntry->type != PS_DATA_METADATA) {
@@ -1246,5 +1256,5 @@
             *status = false;
         } else {
-            psLogMsg(__func__, PS_LOG_WARN, "%s isn't of type PS_DATA_META, as expected.\n", key);
+            psLogMsg(__func__, PS_LOG_DETAIL, "%s isn't of type PS_DATA_META, as expected.\n", key);
         }
         //        value = NULL;
@@ -1281,5 +1291,5 @@
             *status = false;
         } else {
-            psLogMsg(__func__, PS_LOG_WARN, "%s isn't of type PS_DATA_TIME, as expected.\n", key);
+            psLogMsg(__func__, PS_LOG_DETAIL, "%s isn't of type PS_DATA_TIME, as expected.\n", key);
         }
         return NULL;
@@ -1316,5 +1326,5 @@
             *status = false;
         } else {
-            psLogMsg(__func__, PS_LOG_WARN, "%s isn't of type PS_DATA_STRING, as expected.\n", key);
+            psLogMsg(__func__, PS_LOG_DETAIL, "%s isn't of type PS_DATA_STRING, as expected.\n", key);
         }
         //        value = NULL;
