jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r704158 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
Date Mon, 13 Oct 2008 16:36:42 GMT
Author: jukka
Date: Mon Oct 13 09:36:41 2008
New Revision: 704158

URL: http://svn.apache.org/viewvc?rev=704158&view=rev
Log:
JCR-1803: Node.restore() throws java.lang.ClassCastException

Explicitly handle both STRING and REFERENCE (used in Jackrabbit < 1.1, see JCR-487) values
in jcr:frozenUUID. Since we do not automatically upgrade old content, we need to be ready
to handle both types of values.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java?rev=704158&r1=704157&r2=704158&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
Mon Oct 13 09:36:41 2008
@@ -110,7 +110,17 @@
             PropertyState prop = props[i];
             if (prop.getName().equals(NameConstants.JCR_FROZENUUID)) {
                 // special property
-                frozenUUID = UUID.fromString(node.getPropertyValue(NameConstants.JCR_FROZENUUID).getString());
+                InternalValue value =
+                    node.getPropertyValue(NameConstants.JCR_FROZENUUID);
+                // JCR-1803: The value should be a STRING, but older Jackrabbit
+                // versions (< 1.1, see JCR-487) used REFERENCE values. Since
+                // we do not automatically upgrade old content, we need to be
+                // ready to handle both types of values here.
+                if (value.getType() == PropertyType.STRING) {
+                    frozenUUID = UUID.fromString(value.getString());
+                } else {
+                    frozenUUID = value.getUUID();
+                }
             } else if (prop.getName().equals(NameConstants.JCR_FROZENPRIMARYTYPE)) {
                 // special property
                 frozenPrimaryType = node.getPropertyValue(NameConstants.JCR_FROZENPRIMARYTYPE).getQName();



Mime
View raw message