Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 69259 invoked from network); 13 Oct 2008 16:37:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Oct 2008 16:37:03 -0000 Received: (qmail 894 invoked by uid 500); 13 Oct 2008 16:37:04 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 790 invoked by uid 500); 13 Oct 2008 16:37:03 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 781 invoked by uid 99); 13 Oct 2008 16:37:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Oct 2008 09:37:03 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Oct 2008 16:36:05 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8993C23888A4; Mon, 13 Oct 2008 09:36:42 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@jackrabbit.apache.org From: jukka@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081013163642.8993C23888A4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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();