jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From travmik <trav...@gmail.com>
Subject Empty content from any version
Date Mon, 09 Jun 2008 14:11:15 GMT

Hi, all
I have very big problem. Can somebody help me?

I create node:


Node rootNode = session.getRootNode();
Node documentNode = rootNode.addNode("test.txt", "nt:file");
Node resNode = contentNode.addNode("jcr:content", "nt:resource");
resNode.setProperty("jcr:mimeType", "text/plain");
resNode.setProperty("jcr:encoding", "UTF8");
resNode.setProperty("jcr:lastModified", System.currentTimeMillis());
resNode.setProperty("jcr:data", new
ByteArrayInputStream(doc1.getInStream()));
documentNode.addMixin("mix:versionable");
session.save();
documentNode.checkin();


Then i update node like this:


Node documentNode = session.getRootNode().getNode("test.txt");
documentNode.checkout();
Node resNode = contentNode.getNode("jcr:content");
resNode.setProperty("jcr:data", new
ByteArrayInputStream(doc2.getInStream()));
session.save();
documentNode.checkin();


And then i try to get data from content node:


Node node = session.getRootNode().getNode("test.txt");
VersionHistory hist = node.getVersionHistory();
Version vers = hist.getVersion(versionName);
Node frozenNode= vers.getNode("jcr:frozenNode");
Node versionNode = frozenNode.getNode("jcr:content");
InputStream  data = versionNode.getProperty("jcr:data").getStream();

And all properties are setting up, but property with key "jcr:data" is empty
for all versions from versionhistory. Why?? What do i do wrong? 
Many thanks,
Stas
-- 
View this message in context: http://www.nabble.com/Empty-content-from-any-version-tp17733642p17733642.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.


Mime
View raw message