jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Guggisberg <stefan.guggisb...@gmail.com>
Subject Re: Node.getProperty(String arg0) fails with javax.jcr.PathNotFoundException: jcr:data
Date Fri, 15 Mar 2013 09:08:47 GMT
On Thursday, March 14, 2013, UMAIL wrote:

>
>
> Am 14.03.2013 um 17:50 schrieb Stefan Guggisberg <
> stefan.guggisberg@gmail.com <javascript:;>>:
>
> > 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.


if you can provide a self-contained test case including your changes i'll
have a look. otherwise there's not much i can do.

cheers
stefan


> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message