jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexandru Popescu <the.mindstorm.mailingl...@gmail.com>
Subject Re: PropertyType.REFERENCE and Property.getNode results in exception
Date Mon, 17 Oct 2005 17:53:14 GMT
#: 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 <the.mindstorm.mailinglist@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.
>>
> 


Mime
View raw message