Closed GoogleCodeExporter closed 8 years ago
Thanks for the detailed report. It sounds like in your implementation of
Document the property is consumed
by the call to findProperty. It should not be. The Connector Manager is free to
retrieve properties multiple
times.
The SharePoint connector uses metadata and URL feeds, so it can't be as
completely broken as you describe.
There is a comment in the API documentation for the Document class that
"Important: a Property object
obtained by calling findProperty(String) is invalidated by the next call to
findProperty(String)." This is not a
requirement on the connector implementation, but on the Connector Manager.
There is a similar restriction
for DocumentList. Together, they are intended to allow the connector
implementation to implement the
DocumentList, Document and Property interfaces in the same class, and avoid
extraneous instances of the
Document and Property implementation classes. It's a restriction on the
Connector Manager that the Property
object returned by findProperty must not be used again after the next call to
findProperty, because it may now
refer to a different property. The underlying Document property should still
exist.
I don't think that any of the core connectors actually take advantage of this
provision. They all have Document
implementations that contain the properties in some repository-specific manner,
and then create new
Property instances for each findProperty call. For examples, see
http://code.google.com/p/google-enterprise-connector-
manager/source/browse/trunk/projects/connector-
manager/source/javatests/com/google/enterprise/connector/jcr/JcrDocument.java
in the core Connector Manager project, or the SharePoint implementation at
http://code.google.com/p/google-enterprise-connector-
sharepoint/source/browse/trunk/projects/sharepoint/source/java/com/google/enterp
rise/connector/sharep
oint/client/SPDocument.java
Unless you have more details, or a different explanation of the problem, I'm
going to mark this bug as invalid.
Original comment by jl1615@gmail.com
on 6 May 2008 at 12:20
[deleted comment]
Thanks for the fast reply! I have directly stored the document properties in my
SPI
implementation. So the Properties are delivered call by reference and the SPI
value
object is lost, after the call of nextValue();
I understood the way to avoid this issue after having a look at the
JcrDocument. I
will change my implementation. As I suppose that other people may make the same
mistakes you may add some comment to the API documentation for the Document.
In my opinion something like "deliver call by value" would be more easy to
understand.
Original comment by andree.j...@googlemail.com
on 6 May 2008 at 9:51
I'll accept this as a documentation bug. I agree that the requirement for
multiple accesses should be more clear.
Original comment by jl1615@gmail.com
on 6 May 2008 at 6:19
Original comment by jl1615@gmail.com
on 6 May 2008 at 10:22
We should also document more clearly that findProperty might be called with
property names that are not
returned by getPropertyNames, and that null should be returned in that case,
rather than throwing an exception.
Alternatively, we could modify the connector manager to check the property
names before calling findProperty,
but I don't like that as much.
Original comment by jl1615@gmail.com
on 15 Jul 2008 at 7:28
Original comment by Brett.Mi...@gmail.com
on 19 Nov 2008 at 12:44
Original comment by jl1615@gmail.com
on 12 Jan 2009 at 3:47
Original issue reported on code.google.com by
andree.j...@googlemail.com
on 5 May 2008 at 9:40