Index: bundle/BundleDbPersistenceManager.java
===================================================================
--- bundle/BundleDbPersistenceManager.java	(revision 933222)
+++ bundle/BundleDbPersistenceManager.java	(working copy)
@@ -51,7 +51,6 @@
 import org.apache.jackrabbit.core.persistence.util.NodePropBundle;
 import org.apache.jackrabbit.core.persistence.util.BLOBStore;
 import org.apache.jackrabbit.core.persistence.util.FileSystemBLOBStore;
-import org.apache.jackrabbit.core.persistence.util.Serializer;
 import org.apache.jackrabbit.core.state.ChangeLog;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
@@ -1238,7 +1237,7 @@
         }
 
         ResultSet rs = null;
-        InputStream in = null;
+        DataInputStream din = null;
         try {
             Statement stmt = connectionManager.executeStmt(
                     nodeReferenceSelectSQL, getKey(targetId));
@@ -1247,10 +1246,9 @@
                 throw new NoSuchItemStateException(targetId.toString());
             }
 
-            in = rs.getBinaryStream(1);
-            NodeReferences refs = new NodeReferences(targetId);
-            Serializer.deserialize(refs, in);
-
+            din = new DataInputStream(rs.getBinaryStream(1));
+            NodeReferences refs = binding.readReferences(din, targetId, this);
+                        
             return refs;
         } catch (Exception e) {
             if (e instanceof NoSuchItemStateException) {
@@ -1260,7 +1258,7 @@
             log.error(msg, e);
             throw new ItemStateException(msg, e);
         } finally {
-            IOUtils.closeQuietly(in);
+            IOUtils.closeQuietly(din);
             closeResultSet(rs);
         }
     }
@@ -1287,7 +1285,9 @@
             ByteArrayOutputStream out =
                     new ByteArrayOutputStream(INITIAL_BUFFER_SIZE);
             // serialize references
-            Serializer.serialize(refs, out);
+            DataOutputStream dout = new DataOutputStream(out);
+            binding.writeReferences(dout, refs);
+            dout.close();
 
             Object[] params = createParams(refs.getTargetId(), out.toByteArray(), true);
             connectionManager.executeStmt(sql, params);
Index: bundle/BundleFsPersistenceManager.java
===================================================================
--- bundle/BundleFsPersistenceManager.java	(revision 933222)
+++ bundle/BundleFsPersistenceManager.java	(working copy)
@@ -29,7 +29,6 @@
 import org.apache.jackrabbit.core.persistence.util.ErrorHandling;
 import org.apache.jackrabbit.core.persistence.util.FileSystemBLOBStore;
 import org.apache.jackrabbit.core.persistence.util.NodePropBundle;
-import org.apache.jackrabbit.core.persistence.util.Serializer;
 import org.apache.jackrabbit.core.util.TrackingInputStream;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.id.PropertyId;
@@ -355,16 +354,15 @@
         if (!initialized) {
             throw new IllegalStateException("not initialized");
         }
-        InputStream in = null;
+        DataInputStream din = null;
         try {
             String path = buildNodeReferencesFilePath(null, targetId).toString();
             if (!itemFs.exists(path)) {
                 // special case
                 throw new NoSuchItemStateException(targetId.toString());
             }
-            in = itemFs.getInputStream(path);
-            NodeReferences refs = new NodeReferences(targetId);
-            Serializer.deserialize(refs, in);
+            din = new DataInputStream(itemFs.getInputStream(path));
+            NodeReferences refs = binding.readReferences(din, targetId, this);
             return refs;
         } catch (NoSuchItemStateException e) {
             throw e;
@@ -373,7 +371,7 @@
             BundleFsPersistenceManager.log.error(msg, e);
             throw new ItemStateException(msg, e);
         } finally {
-            IOUtils.closeQuietly(in);
+            IOUtils.closeQuietly(din);
         }
     }
 
@@ -395,8 +393,10 @@
                 itemFs.createFolder(dir);
             }
             OutputStream out = itemFs.getOutputStream(fileName);
-            Serializer.serialize(refs, out);
-            out.close();
+            DataOutputStream dout = new DataOutputStream(out);
+            binding.writeReferences(dout, refs);
+            dout.close();
+            
         } catch (Exception e) {
             String msg = "failed to write " + refs;
             BundleFsPersistenceManager.log.error(msg, e);
Index: pool/BundleDbPersistenceManager.java
===================================================================
--- pool/BundleDbPersistenceManager.java	(revision 933222)
+++ pool/BundleDbPersistenceManager.java	(working copy)
@@ -1163,16 +1163,15 @@
         }
 
         ResultSet rs = null;
-        InputStream in = null;
+        DataInputStream din = null;
         try {
             rs = conHelper.exec(nodeReferenceSelectSQL, getKey(targetId), false, 0);
             if (!rs.next()) {
                 throw new NoSuchItemStateException(targetId.toString());
             }
 
-            in = rs.getBinaryStream(1);
-            NodeReferences refs = new NodeReferences(targetId);
-            Serializer.deserialize(refs, in);
+            din = new DataInputStream(rs.getBinaryStream(1));
+            NodeReferences refs = binding.readReferences(din, targetId, this);
 
             return refs;
         } catch (Exception e) {
@@ -1183,7 +1182,7 @@
             log.error(msg, e);
             throw new ItemStateException(msg, e);
         } finally {
-            IOUtils.closeQuietly(in);
+            IOUtils.closeQuietly(din);
             DbUtility.close(rs);
         }
     }
@@ -1210,7 +1209,9 @@
             ByteArrayOutputStream out =
                     new ByteArrayOutputStream(INITIAL_BUFFER_SIZE);
             // serialize references
-            Serializer.serialize(refs, out);
+            DataOutputStream dout = new DataOutputStream(out);
+            binding.writeReferences(dout, refs);
+            dout.close();
 
             Object[] params = createParams(refs.getTargetId(), out.toByteArray(), true);
             conHelper.exec(sql, params);
Index: pool/BundleFsPersistenceManager.java
===================================================================
--- pool/BundleFsPersistenceManager.java	(revision 933222)
+++ pool/BundleFsPersistenceManager.java	(working copy)
@@ -29,7 +29,6 @@
 import org.apache.jackrabbit.core.persistence.util.ErrorHandling;
 import org.apache.jackrabbit.core.persistence.util.FileSystemBLOBStore;
 import org.apache.jackrabbit.core.persistence.util.NodePropBundle;
-import org.apache.jackrabbit.core.persistence.util.Serializer;
 import org.apache.jackrabbit.core.util.TrackingInputStream;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.id.PropertyId;
@@ -354,16 +353,16 @@
         if (!initialized) {
             throw new IllegalStateException("not initialized");
         }
-        InputStream in = null;
+        DataInputStream din = null;
         try {
             String path = buildNodeReferencesFilePath(null, targetId).toString();
             if (!itemFs.exists(path)) {
                 // special case
                 throw new NoSuchItemStateException(targetId.toString());
             }
-            in = itemFs.getInputStream(path);
-            NodeReferences refs = new NodeReferences(targetId);
-            Serializer.deserialize(refs, in);
+            
+            din = new DataInputStream(itemFs.getInputStream(path));
+            NodeReferences refs = binding.readReferences(din, targetId, this);
             return refs;
         } catch (NoSuchItemStateException e) {
             throw e;
@@ -372,7 +371,7 @@
             BundleFsPersistenceManager.log.error(msg, e);
             throw new ItemStateException(msg, e);
         } finally {
-            IOUtils.closeQuietly(in);
+            IOUtils.closeQuietly(din);
         }
     }
 
@@ -394,8 +393,11 @@
                 itemFs.createFolder(dir);
             }
             OutputStream out = itemFs.getOutputStream(fileName);
-            Serializer.serialize(refs, out);
-            out.close();
+            
+            DataOutputStream dout = new DataOutputStream(out);
+            binding.writeReferences(dout, refs);
+            dout.close();
+
         } catch (Exception e) {
             String msg = "failed to write " + refs;
             BundleFsPersistenceManager.log.error(msg, e);
Index: util/BundleBinding.java
===================================================================
--- util/BundleBinding.java	(revision 933222)
+++ util/BundleBinding.java	(working copy)
@@ -21,6 +21,8 @@
 import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.id.PropertyId;
+import org.apache.jackrabbit.core.persistence.PersistenceManager;
+import org.apache.jackrabbit.core.state.NodeReferences;
 import org.apache.jackrabbit.core.util.StringIndex;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.data.DataStore;
@@ -32,7 +34,9 @@
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.Collection;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.Set;
 import java.math.BigDecimal;
 
@@ -761,4 +765,80 @@
             throw new IOException(msg);
         }
     }
+    
+    /**
+     * Deserializes a <code>NodeReferences</code> from the data input stream.
+     *
+     * @param in the input stream
+     * @param id the id of the nodereference to deserialize
+     * @param pMgr the persistence manager
+     * @return the node references
+     * @throws IOException in an I/O error occurs.
+     */
+    public NodeReferences readReferences(DataInputStream in, NodeId id,
+                                    PersistenceManager pMgr)
+            throws IOException {
+        NodeReferences state = new NodeReferences(id);
+        int count = in.readInt();   // count & version
+        
+        int version = (count >> 24) & 0x0ff;
+        count &= 0x00ffffff;
+        
+        for (int i = 0; i < count; i++) {
+            if (version >= VERSION_3) {
+                state.addReference(readIndexedPropertyId(in));
+            } else {
+                // for backward Serializer compatibility
+                // initially BundlePMs used Serializer instead of BundleBinding by accident
+                state.addReference(PropertyId.valueOf(in.readUTF()));
+            }
+        }
+        return state;
+    }
+
+    /**
+     * Serializes a <code>NodeReferences</code> to the data output stream.
+     *
+     * @param out the output stream
+     * @param state the state to write.
+     * @throws IOException in an I/O error occurs.
+     */
+    public void writeReferences(DataOutputStream out, NodeReferences state)
+            throws IOException {
+        // references
+        Collection<PropertyId> c = state.getReferences();
+        out.writeInt(c.size() | (VERSION_CURRENT << 24)); // count
+        for (Iterator<PropertyId> iter = c.iterator(); iter.hasNext();) {
+            PropertyId propId = iter.next();
+            writeIndexedPropertyId(out, propId);
+        }
+    }
+    
+    /**
+     * Serializes a PropertyId
+     * @param out the output stream
+     * @param id the id
+     * @throws IOException in an I/O error occurs.
+     */
+    private void writeIndexedPropertyId(DataOutputStream out, PropertyId id) throws IOException {
+        out.write(id.getParentId().getRawBytes());
+        writeIndexedQName(out, id.getName());
+    }
+
+    /**
+     * Deserializes a PropertyId
+     * @param in the input stream
+     * @return the property id
+     * @throws IOException in an I/O error occurs.
+     */
+    private PropertyId readIndexedPropertyId(DataInputStream in) throws IOException {
+        byte[] bytes = new byte[16];
+        int pos = 0;
+        while (pos < 16) {
+            pos += in.read(bytes, pos, 16 - pos);
+        }
+        NodeId id = new NodeId(bytes);
+        Name name = readIndexedQName(in);
+        return new PropertyId(id, name);
+    }
 }
Index: util/ItemStateBinding.java
===================================================================
--- util/ItemStateBinding.java	(revision 933222)
+++ util/ItemStateBinding.java	(working copy)
@@ -53,9 +53,14 @@
     public static final int VERSION_2 = 2;
 
     /**
+     * serialization version 3
+     */
+    public static final int VERSION_3 = 3;
+
+    /**
      * current version
      */
-    public static final int VERSION_CURRENT = VERSION_2;
+    public static final int VERSION_CURRENT = VERSION_3;
 
     /**
      * the namespace index
