jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-1707) Node.setProperty(String, String, PropertyType.UNDEFINED) might fail unexpectedly for multiple prop. defs
Date Wed, 06 Aug 2008 14:40:44 GMT

    [ https://issues.apache.org/jira/browse/JCR-1707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12620270#action_12620270
] 

Stefan Guggisberg commented on JCR-1707:
----------------------------------------

i tried the following:

            Node tst = root.addNode("jcr-1707", "Test");
            Property p = tst.setProperty("foo", "bar", PropertyType.UNDEFINED);
            System.out.println(PropertyType.nameFromValue(p.getType()));

the console output was "String", as expected.

i further tried this:

            Node tst = root.addNode("jcr-1707", "Test");
            tst.addMixin("mix:referenceable");
            Property p = tst.setProperty("foo", tst);
            System.out.println(PropertyType.nameFromValue(p.getType()));

the console output was "Reference", again as expected.

could you please provide a simple test case which demonstrates the issue?

> Node.setProperty(String, String, PropertyType.UNDEFINED) might fail unexpectedly for
multiple prop. defs
> --------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-1707
>                 URL: https://issues.apache.org/jira/browse/JCR-1707
>             Project: Jackrabbit
>          Issue Type: Bug
>    Affects Versions: core 1.4.5
>            Reporter: Tobias Bocanegra
>
> Assume you have a node type defined with 2 property defs with the same name but different
types, eg:
> [Test] > nt:base
>   - foo (string) mandatory
>   - foo (reference) mandatory
> when setting this property with: Node.setProperty("foo", "bar", PropertyType.UNDEFINED)
it might throw a "javax.jcr.ValueFormatException: not a valid UUID format"  
> because 'bar' is not valid uuid. imo, a matching property def for the given value should
be used.
> otoh, it could also give unexpected results the other way around, e.g. if a uuid is passed
but the string-def is used first. so the string property def should be tried last.
> the workaround is of course to specify a property type or to use setProperty(String,
String)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message