Return-Path: X-Original-To: apmail-jackrabbit-users-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7AA21D4B5 for ; Wed, 7 Nov 2012 08:52:54 +0000 (UTC) Received: (qmail 66827 invoked by uid 500); 7 Nov 2012 08:52:54 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 66222 invoked by uid 500); 7 Nov 2012 08:52:47 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 66171 invoked by uid 99); 7 Nov 2012 08:52:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Nov 2012 08:52:46 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of stefan.guggisberg@gmail.com designates 209.85.219.42 as permitted sender) Received: from [209.85.219.42] (HELO mail-oa0-f42.google.com) (209.85.219.42) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Nov 2012 08:52:41 +0000 Received: by mail-oa0-f42.google.com with SMTP id j1so2901601oag.1 for ; Wed, 07 Nov 2012 00:52:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=uUUVKBjNkoKbdbBE7HIqPP2EJg46efu1mYwGYqOophA=; b=l76hWlqk4KY4Azu4C+JD4nRYSDz50NbxXgzchClUnIsH8dGab2KzgkfviZzAYpqKfB cGloFJEd90RXJZTnMvQAt+O7w4Et10wOUiG/8U/iTcq6A3KJWiaya5eGiFiFYkiUeLcI S5pi/NKEUtFM21G6QG4pjQ4GYqd4GnKhs3I/rU+8kr7okUeisi/wtFyhYLPnqtvQ8Rrh B7+ZU78DXiWDeKsLaSnQcQyxpg9rHGAL/QDBzHfL1gGk6Zi/WdTbROQlF+ARQu3Ts5ED AeT/u2edQa1tLrkfHmSC4h6RYCnD4g4LAL7Pn2AXbn+7ppO/E8JLaIWRdb/vtFAzni5m 0epw== MIME-Version: 1.0 Received: by 10.60.14.6 with SMTP id l6mr1486241oec.87.1352278340964; Wed, 07 Nov 2012 00:52:20 -0800 (PST) Received: by 10.76.73.129 with HTTP; Wed, 7 Nov 2012 00:52:20 -0800 (PST) In-Reply-To: <50996E54.6090700@oracle.com> References: <5092EF5B.3040606@oracle.com> <50938A9D.6020208@apache.org> <5093D166.1030503@oracle.com> <50996E54.6090700@oracle.com> Date: Wed, 7 Nov 2012 09:52:20 +0100 Message-ID: Subject: Re: Node property type constraints violated when setting strings From: Stefan Guggisberg To: users@jackrabbit.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org hi jessi, On Tue, Nov 6, 2012 at 9:08 PM, Jessi Abrahams wrote: > Hi Stefan, > > It looks like you were right that I was extending a node type with residu= al > property definitions - I oversimplified the example I gave so it was not > apparent. I've fixed the problematic inheritance and the repository is > validating as expected. Thanks for your help. good to hear and thanks for the feedback. cheers stefan > > Jessi > > > On 11/02/2012 10:42 AM, Stefan Guggisberg wrote: >> >> On Fri, Nov 2, 2012 at 2:57 PM, Jessi Abrahams >> wrote: >>> >>> Hi Michael, >>> >>> Thanks for your response. Based on that spec I would expect that if I >>> tried >>> to assign a value of "abc" then the property would end up being set to >>> false >>> (based on how Java converts strings to booleans). However what I am >>> seeing >>> is the property being assigned a string value of "abc". >> >> that would be a major bug. however, i suppose that your custom node type >> extends a node type containing residual property definitions (such as e.= g. >> nt;unstructured). >> >> you can verify the declaring node type by running something like >> >> Property prop =3D node.setProperty("someBooleanProperty", "abc"); >> System.out.println(PropertyType.nameFromValue(prop.getType())); >> PropertyDefinition def =3D prop.getDefinition(); >> System.out.println(def.getDeclaringNodeType().getName()); >> System.out.println(PropertyType.nameFromValue(def.getRequiredType())); >> >> cheers >> stefan >> >>> Thanks >>> Jessi >>> >>> >>> On 11/02/2012 04:55 AM, Michael D=FCrig wrote: >>>> >>>> >>>> Jessi, >>>> >>>> The repository will try to convert the string to a boolean. See 3.6.4 >>>> Property Type Conversion in JSR 283. >>>> >>>> Michael >>>> >>>> On 1.11.12 21:53, Jessi Abrahams wrote: >>>>> >>>>> Hi, >>>>> I'm new to this list so I apologize if this question has been asked (= I >>>>> tried searching the archives) or if this is not the right place to as= k. >>>>> >>>>> I have a custom node type with a definition like this: >>>>> >>>>> [foo:bar] > mix:lastModified, mix:created, nt:base >>>>> - someBooleanProperty (BOOLEAN) >>>>> >>>>> When I create a node of this type and use any of the setProperty >>>>> methods >>>>> on Node, the repository allows me to set string values (such as "abc"= ) >>>>> for someBooleanProperty even though as far as I understand from the >>>>> type >>>>> definition, only booleans should be allowed. The repository throws a >>>>> ConstraintViolationException (as I would expect) if I try to to set >>>>> someBooleanProperty to any other incorrect (non-boolean) type - but n= ot >>>>> strings. It seems like properties can always be set to a string, >>>>> whether >>>>> or not it's allowed by the node type definition. Is this expected? It >>>>> doesn't seem in line with the spec. >>>>> >>>>> Thanks >>>>> Jessi >>>>> >>>>> >>>>> >>> > >