-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read Document via its DocumentDescriptor #1729
Comments
I tried this as a quick test:
And I used the following in qconsole to insert a test document:
That produced the following output:
Does that look like the same as your test? |
Yes, that is exactly, how I want to use it. Could you verify that the version is set on your descriptor?
Because in my tests the read attempt works fine as long as the version number is -1 (aka "unknown"), but as soon as the version number is a real timestamp the read call no longer gets the document from the database. Here is the code I'm using. It is the same as yours except the null check on the descriptor and some generics.
and I run straight into a NullPointerException:
|
Yup, I just reproduced this by adding this file named
That results in a non-negative-1 version and I get the same error. Digging into it further. |
@ralfhergert I think this is working as designed, per the example at https://docs.marklogic.com/guide/rest-dev/documents#id_37703 . Note step 4 - the document is retrieved with the versionId that matches the one in the database for the document, and so nothing is returned. For the Java Client, that means the Handle object is set to null, and calling I can see an argument for having the Handle object be non-null and |
Thanks for analyzing this issue deeper, @rjrudin . And thanks for the hint towards /src/main/ml-modules/rest-properties.xml file. Yes, here we have the update-policy set to Concerning the REST-API and step 4: I agree, here it is obviously a "read only if modified" call, and the HTTP-304-response is an expected result. But from the perspective of the XmlDocumentManager this behaviour is not obvious. For instance the JavaDoc for Line 246 in 3b625db
My disconnect is, that nothing here in the JavaDoc explains, that the version number in the descriptor suddenly may have an impact, and I might get a null-handle back. Up until now I would say this "only if modified" is not a well established concept in this client. Or is it? I could imagine different solutions:
|
@ralfhergert I think you hit the nail on the head with approach number 1. A colleague and I are looking at this, and it strikes us both that the following two places in the Javadocs (which of course would appear in most IDEs) should make the possibility of a null return value very clear:
We're tracking this internally via ticket MLE-18751 . Thanks for the feedback! |
Hi @rjrudin,
I'm not sure whether this is expected behaviour or whether this is actually a bug:
(Using makrlogic-java-client in version 7.0.0)
Retrievung the DocumentDescriptor of an existing document works as expected:
This DocumentDescriptor has the version of the document set.
Problem is this DocumentDescriptor cannot be used to read the document. Calling:
will just return a null handle.
This is strange as the write call works just fine when using this DocumentDescriptor:
The text was updated successfully, but these errors were encountered: