You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Stefan Guggisberg <st...@gmail.com> on 2005/10/17 18:37:42 UTC
Re: PropertyType.REFERENCE and Property.getNode results in exception
On 10/17/05, Alexandru Popescu <th...@gmail.com> wrote:
> Hi!
>
> I am trying to traverse some nodes in a repository. I am facing the following problem:
>
> 1/ a Value has the type PropertyType.REFERENCE (jcr:predecessors)
> 2/ according to the spec I should use the Property.getNode() to retrieve the reference node
>
> Unfortunately this results in the following exception:
>
> javax.jcr.ValueFormatException: /features/mailform/thanks/jcr:predecessors is multi-valued and can
> therefore only be retrieved as an array of values
> at org.apache.jackrabbit.core.PropertyImpl.getNode(PropertyImpl.java:633)
> at org.noco.jcr.SpringEnabledJcrTest.displayPropertyValue(SpringEnabledJcrTest.java:197)
> at org.noco.jcr.SpringEnabledJcrTest.analyzeNode(SpringEnabledJcrTest.java:149)
> at org.noco.jcr.SpringEnabledJcrTest.testSpringLoaded(SpringEnabledJcrTest.java:133)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> ...
>
> Am I doing something wrong?
yep, i'm afraid so;)
from javadoc of Property.getNode():
<quote>
... If this property is multi-valued, this method throws a
ValueFormatException. ...
</quote>
this has been discussed in an earlier thread:
http://thread.gmane.org/gmane.comp.apache.jackrabbit.devel/1709
cheers
stefan
>
> ./alex
> --
> .w( the_mindstorm )p.
>
Re: PropertyType.REFERENCE and Property.getNode results in exception
Posted by Alexandru Popescu <th...@gmail.com>.
#: Stefan Guggisberg changed the world a bit at a time by saying on 10/17/2005 6:37 PM :#
> On 10/17/05, Alexandru Popescu <th...@gmail.com> wrote:
>> Hi!
>>
>> I am trying to traverse some nodes in a repository. I am facing the following problem:
>>
>> 1/ a Value has the type PropertyType.REFERENCE (jcr:predecessors)
>> 2/ according to the spec I should use the Property.getNode() to retrieve the reference node
>>
>> Unfortunately this results in the following exception:
>>
>> javax.jcr.ValueFormatException: /features/mailform/thanks/jcr:predecessors is multi-valued and can
>> therefore only be retrieved as an array of values
>> at org.apache.jackrabbit.core.PropertyImpl.getNode(PropertyImpl.java:633)
>> at org.noco.jcr.SpringEnabledJcrTest.displayPropertyValue(SpringEnabledJcrTest.java:197)
>> at org.noco.jcr.SpringEnabledJcrTest.analyzeNode(SpringEnabledJcrTest.java:149)
>> at org.noco.jcr.SpringEnabledJcrTest.testSpringLoaded(SpringEnabledJcrTest.java:133)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> ...
>>
>> Am I doing something wrong?
>
> yep, i'm afraid so;)
>
> from javadoc of Property.getNode():
> <quote>
> ... If this property is multi-valued, this method throws a
> ValueFormatException. ...
> </quote>
>
> this has been discussed in an earlier thread:
> http://thread.gmane.org/gmane.comp.apache.jackrabbit.devel/1709
>
> cheers
> stefan
>
Excellent answer. Thanks a lot Stefan.
./alex
--
.w( the_mindstorm )p.
>>
>> ./alex
>> --
>> .w( the_mindstorm )p.
>>
>