Index: src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java (revision 703382) +++ src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java (working copy) @@ -151,10 +151,21 @@ throws IOException { NodeReferences state = new NodeReferences(id); int count = in.readInt(); // count & version - // int version = (count >> 24) | 0x0ff; + int version = (count >> 24) & 0x0ff; count &= 0x00ffffff; + for (int i = 0; i < count; i++) { - state.addReference(readPropertyId(in)); // propertyId + if (version >= VERSION_2) { + state.addReference(readIndexedPropertyId(in)); + } + else if (version >= VERSION_1) { + state.addReference(readPropertyId(in)); + } + else { + // for backward Serializer compatibility + // initially BundlePMs used Serializer instead of BundleBinding by accident + state.addReference(PropertyId.valueOf(in.readUTF())); + } } return state; } @@ -173,7 +184,7 @@ out.writeInt(c.size() | (VERSION_CURRENT << 24)); // count for (Iterator iter = c.iterator(); iter.hasNext();) { PropertyId propId = (PropertyId) iter.next(); - writePropertyId(out, propId); + writeIndexedPropertyId(out, propId); } } @@ -461,4 +472,27 @@ Name name = readQName(in); return new PropertyId(new NodeId(uuid), name); } + + /** + * Serializes a PropertyId + * @param out the output stream + * @param id the id + * @throws IOException in an I/O error occurs. + */ + public void writeIndexedPropertyId(DataOutputStream out, PropertyId id) throws IOException { + writeID(out, id.getParentId()); + writeIndexedQName(out, id.getName()); + } + + /** + * Deserializes a PropertyId + * @param in the input stream + * @return the property id + * @throws IOException in an I/O error occurs. + */ + public PropertyId readIndexedPropertyId(DataInputStream in) throws IOException { + UUID uuid = readUUID(in); + Name name = readIndexedQName(in); + return new PropertyId(new NodeId(uuid), name); + } }