jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ulrich <For...@gombers.de>
Subject Re: Node.getProperty(String arg0) fails with javax.jcr.PathNotFoundException: jcr:data
Date Sat, 16 Mar 2013 08:29:11 GMT


Am 14.03.2013 um 17:50 schrieb Stefan Guggisberg <stefan.guggisberg@gmail.com>:

> On Thursday, March 14, 2013, Ulrich wrote:
> 
>> When running this code:
>> 
>> 
>> Property jcrdata;
>> for (PropertyIterator pi = fileNode.getProperties(); pi.hasNext(); ) {
>>        Property p = pi.nextProperty();
>>        LOGGER.info("Property is: " + p.getName() + "=" +
>> p.getValue().getString());
>> }
>> jcrdata = fileNode.getProperty("jcr:data");
>> 
>> the for-loop works fine and displays the property "jcr:data" and it's
>> value. But
>> the last line:
>>       Property jcrdata = fileNode.getProperty("jcr:data");
>> fails with "javax.jcr.PathNotFoundException: jcr:data".
> 
> 
> what is the node type of fileNode?
> 
> i assume it's nt:file. nt:file doesn't declare a jcr:data property.
> it declares a jcr:content node which commonly is a nt:resource.
> nt:resource does declare a jcr:data property.
> 
> i.e. fileNode.getNode("jcr:content").getProperty("jcr:data")
> 
> cheers
> stefan
fileNode is the child of a "nt:file"-node and has the node-name "jcr:content". The complete
code would have shown. But this is not the point here. As you can see in the second sample,
the property can be processed for this node, so it is proofed, it is there (and I know it
for sure - I have defined it).
There is something very strange with my repository, I think. The program used to run until
today. Ok, I changed something but not here. I have no clue, how my changes may have affected
the behaviour this way.

Property jcrdata;
for (PropertyIterator pi = fileNode.getProperties(); pi.hasNext(); ) 
     Property p = pi.nextProperty();
     LOGGER.info("Property is: " + p.getName() + "=");
     p.getValue().getString());
     if (p.getName().equals("jcr:data")) 
         jcrdata = p;
}
jcrdata = fileNode.getProperty("jcr:data");

This code also fails in the last line - this proofs that the property is retrieved from the
very same node.

Ulrich

Mime
View raw message