Hi,

Could you find a way to reproduce the problem a standalone code
without code specific to you? For instance in a unit test? Then we can
easily investigate and fix this if there's really a bug.

Florent


On Tue, Sep 14, 2010 at 7:25 PM, Francois-Denis Gonthier
<[email protected]> wrote:
> Hello all,
>
> I've hitting a weird problem with my plugin code. I am sometimes finding that 
> a document's parent doesn't exist when accessed by its IdRef but exists when 
> accessed by its PathRef. I say that it happens sometimes because if I debug 
> slow enough, I eventually find no such consistency problem. This points to a 
> race condition problem.
>
> Here is some code snippets which illustrate my problem. The following code 
> doesn't work.
>
> protected NuxeoMessageManager getMessageManager(DocumentModel targetDoc) {
>  DocumentRef parentRef;
>
>  parentRef = targetDoc.getParentRef();
>  try {
>    if (sysSession.getCoreSession().exists(parentRef) {
>      // Won't enter the if clause.
>  ...
>
> The following works:
>
> protected NuxeoMessageManager getMessageManager(DocumentModel targetDoc) {
>  DocumentRef parentRef;
>  String docPathStr = targetDoc.getPathAsString();
>  Path docPath = Path.createFromAbsolutePath(docPathStr)
>  Path parentPath = docPath.removeLastSegments(1);
>  PathRef parentPathRef = new PathRef(parentPath.toString());
>
>  try {
>    if (sysSession.getCoreSession().exists(parentPathRef) {
>      // This will work.
>  ...
>
> I can live with the second technique but until I understand what is going on, 
> I can only consider this to be a workaround. I'm using the 
> DocumentModel.getParentRef() at some other place so understanding this 
> problem is important to me.
>
> --
> François-Denis Gonthier
> Programmeur/analyste
> 819-780-8955 #1128                http://www.revolutionlinux.com/
>

-- 
Florent Guillaume, Director of R&D, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

Reply via email to