Chemistry
  1. Chemistry
  2. CMIS-609

Crash when at the end of iterating through GetChildren() in DotCMIS

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: DotCMIS 0.5
    • Fix Version/s: DotCMIS 0.5
    • Component/s: dotcmis
    • Labels:
      None
    • Environment:

      Visual Studio 9.0 (2008)

      Description

      I'm trying to build a client for connecting to SharePoint via CMIS using DotCMIS.

      in my code
      IFolder rootFolder = session.GetRootFolder();
      IEnumerable<ICmisObject> children = rootFolder.GetChildren();
      List<ICmisObject> childrenList = children.ToList();

      an internal server error is thrown when creating the list of ICmisObjects.

      Each of the objects in the library is retrieved successfully. However, in the call to CollectionEnumerator.MoveNext() after the last object is retrieved, SkipOffset == items.Count, which causes IncrementPage() to be called. Ultimately, the HttpWebResponse response = (HttpWebResponse)conn.GetResponse() call in Client.Impl.HttpUtils fails, throwing an error, presumably because there is no subsequent page of items.

      Here is the request url that is built

      {http://<site>/_vti_bin/cmis/rest/b8520585-9fbe-49fc-a523-2da2ab4e16ab?getChildren&folderID=-1&includeAllowableActions=true&includeRelationships=none&includePathSegment=true&maxItems=100&skipCount=1}

      I tested the same code using the Groovy connector in the workbench:

      Folder rootFolder = session.getRootFolder();
      ItemIterable<CmisObject> children = rootFolder.getChildren();
      List<CmisObject> childrenList = children.toList();

      and it works fine.

        Activity

        Hide
        Matthew Rutledge-Taylor added a comment -

        This is the url that is built when I point my client to the OpenCMIS InMemory Repository (http://localhost:8080/inmemory/atom)

        {http://localhost:8080/inmemory/atom/A1/children?id=100&includeAllowableActions=true&includeRelationships=none&includePathSegment=true&maxItems=100&skipCount=5}

        I'm wondering if my issue relates to the cached link that is retrieved from the binding. That is, when communicating with SharePoint the getChildren request is what is retrieved during the IncrementPage() call, whereas it is a children request when communicating to the in memory repository.

        Show
        Matthew Rutledge-Taylor added a comment - This is the url that is built when I point my client to the OpenCMIS InMemory Repository ( http://localhost:8080/inmemory/atom ) {http://localhost:8080/inmemory/atom/A1/children?id=100&includeAllowableActions=true&includeRelationships=none&includePathSegment=true&maxItems=100&skipCount=5} I'm wondering if my issue relates to the cached link that is retrieved from the binding. That is, when communicating with SharePoint the getChildren request is what is retrieved during the IncrementPage() call, whereas it is a children request when communicating to the in memory repository.
        Hide
        Florian Müller added a comment -

        First of all, SharePoint shouldn't return an error but an empty list if there are no more items. But that's nothing we can change.

        The .NET and Java code do exactly the same thing and DotCMIS seems to work fine against the OpenCMIS InMemory repository and Alfresco. In other words, I cannot reproduce this problem.
        Could you provide a stack trace and some more details about the error message?

        Show
        Florian Müller added a comment - First of all, SharePoint shouldn't return an error but an empty list if there are no more items. But that's nothing we can change. The .NET and Java code do exactly the same thing and DotCMIS seems to work fine against the OpenCMIS InMemory repository and Alfresco. In other words, I cannot reproduce this problem. Could you provide a stack trace and some more details about the error message?
        Hide
        Matthew Rutledge-Taylor added a comment - - edited

        Here is the call stack.
        DotCMIS.dll!DotCMIS.Binding.AtomPub.AbstractAtomPubService.Read(DotCMIS.Binding.Impl.UrlBuilder url =

        {<moss-server>/sites/CMIS1/_vti_bin/cmis/rest/d7f6a28f-6a82-4221-9344-5f527ff93e5f?getChildren&folderID=-1&includeAllowableActions=true&includeRelationships=none&includePathSegment=true&maxItems=100&skipCount=1}

        ) Line 436 C#
        DotCMIS.dll!DotCMIS.Binding.AtomPub.NavigationService.GetChildren(string repositoryId = "d7f6a28f-6a82-4221-9344-5f527ff93e5f", string folderId = "-1", string filter = null, string orderBy = null, bool? includeAllowableActions = true, DotCMIS.Enums.IncludeRelationshipsFlag? includeRelationships = None, string renditionFilter = null, bool? includePathSegment = true, long? maxItems = 100, long? skipCount = 1, DotCMIS.Data.Extensions.IExtensionsData extension = null) Line 1050 + 0x10 bytes C#
        DotCMIS.dll!DotCMIS.Client.Impl.Folder.GetChildren.AnonymousMethod(long maxNumItems = 100, long skipCount = 1) Line 1252 + 0x352 bytes C#
        DotCMIS.dll!DotCMIS.Client.Impl.PageFetcher<DotCMIS.Client.ICmisObject>.FetchNextPage(long skipCount = 1) Line 563 + 0x38 bytes C#
        DotCMIS.dll!DotCMIS.Client.Impl.AbstractEnumerator<DotCMIS.Client.ICmisObject>.IncrementPage() Line 539 + 0x3e bytes C#
        DotCMIS.dll!DotCMIS.Client.Impl.CollectionEnumerator<DotCMIS.Client.ICmisObject>.MoveNext() Line 622 + 0xd bytes C#
        Cogniva.CMIS.wfTest.exe!Cogniva.CMIS.wfTest.Form1.btnConnect_Click(object sender =

        {Text = "Connect"}

        , System.EventArgs e =

        {X = 29 Y = 26 Button = Left}

        ) Line 56 + 0x14 bytes C#
        Cogniva.CMIS.wfTest.exe!Cogniva.CMIS.wfTest.Program.Main() Line 18 + 0x28 bytes C#

        The error is: CmisRuntimeException 'Internal Server Error'

        I've tested my code against two different MOSS2010 servers, each with the CMIS connector installed. And, yes, I don't have any issues connecting to the OpenCMIS InMemory rep either.

        Show
        Matthew Rutledge-Taylor added a comment - - edited Here is the call stack. DotCMIS.dll!DotCMIS.Binding.AtomPub.AbstractAtomPubService.Read(DotCMIS.Binding.Impl.UrlBuilder url = {<moss-server>/sites/CMIS1/_vti_bin/cmis/rest/d7f6a28f-6a82-4221-9344-5f527ff93e5f?getChildren&folderID=-1&includeAllowableActions=true&includeRelationships=none&includePathSegment=true&maxItems=100&skipCount=1} ) Line 436 C# DotCMIS.dll!DotCMIS.Binding.AtomPub.NavigationService.GetChildren(string repositoryId = "d7f6a28f-6a82-4221-9344-5f527ff93e5f", string folderId = "-1", string filter = null, string orderBy = null, bool? includeAllowableActions = true, DotCMIS.Enums.IncludeRelationshipsFlag? includeRelationships = None, string renditionFilter = null, bool? includePathSegment = true, long? maxItems = 100, long? skipCount = 1, DotCMIS.Data.Extensions.IExtensionsData extension = null) Line 1050 + 0x10 bytes C# DotCMIS.dll!DotCMIS.Client.Impl.Folder.GetChildren.AnonymousMethod(long maxNumItems = 100, long skipCount = 1) Line 1252 + 0x352 bytes C# DotCMIS.dll!DotCMIS.Client.Impl.PageFetcher<DotCMIS.Client.ICmisObject>.FetchNextPage(long skipCount = 1) Line 563 + 0x38 bytes C# DotCMIS.dll!DotCMIS.Client.Impl.AbstractEnumerator<DotCMIS.Client.ICmisObject>.IncrementPage() Line 539 + 0x3e bytes C# DotCMIS.dll!DotCMIS.Client.Impl.CollectionEnumerator<DotCMIS.Client.ICmisObject>.MoveNext() Line 622 + 0xd bytes C# Cogniva.CMIS.wfTest.exe!Cogniva.CMIS.wfTest.Form1.btnConnect_Click(object sender = {Text = "Connect"} , System.EventArgs e = {X = 29 Y = 26 Button = Left} ) Line 56 + 0x14 bytes C# Cogniva.CMIS.wfTest.exe!Cogniva.CMIS.wfTest.Program.Main() Line 18 + 0x28 bytes C# The error is: CmisRuntimeException 'Internal Server Error' I've tested my code against two different MOSS2010 servers, each with the CMIS connector installed. And, yes, I don't have any issues connecting to the OpenCMIS InMemory rep either.
        Hide
        Florian Müller added a comment -

        I have added an extra check that may or may not fix it. Please grab the latest code and try again.

        Show
        Florian Müller added a comment - I have added an extra check that may or may not fix it. Please grab the latest code and try again.
        Hide
        Matthew Rutledge-Taylor added a comment -

        I am not encountering any errors any longer. Thanks so much!

        Show
        Matthew Rutledge-Taylor added a comment - I am not encountering any errors any longer. Thanks so much!
        Hide
        Florian Müller added a comment -

        Thanks for reporting!

        Show
        Florian Müller added a comment - Thanks for reporting!

          People

          • Assignee:
            Florian Müller
            Reporter:
            Matthew Rutledge-Taylor
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development