You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by "Srinivas Gannavarapu (JIRA)" <ji...@apache.org> on 2015/10/27 10:00:35 UTC

[jira] [Created] (CMIS-954) getRepositoryInfo always returns available top repository from the list even if the repository id passed into getRepositoryInfo is set to a different repository

Srinivas Gannavarapu created CMIS-954:
-----------------------------------------

             Summary: getRepositoryInfo always returns available top repository from the list even if the repository id passed into getRepositoryInfo is set to a different repository
                 Key: CMIS-954
                 URL: https://issues.apache.org/jira/browse/CMIS-954
             Project: Chemistry
          Issue Type: Bug
          Components: opencmis-client, opencmis-client-bindings
    Affects Versions: OpenCMIS 0.13.0
         Environment: Windows Server 2012/ RHEL, tomcat/ WAS. Open CMIS 0.13.0 / Tip build, IBM FileNet repository 
            Reporter: Srinivas Gannavarapu
            Priority: Critical
             Fix For: OpenCMIS 0.14.0


The issues is in "Apache Chemistry client code" within the jar file "chemistry-opencmis-client-bindings-0.13.0".

- The getRepositoryInfo() on the client side is implemented in the class "RepositoryServiceImpl" (under the package "org.apache.chemistry.opencmis.client.bindings.spi.browser"). JAR file "chemistry-opencmis-client-bindings-0.13.0".
- This method has a snippet which does something unexpected. When the length of the repository infos list is 1, it returns that SOLE repository.

Code Snippet below:

public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
    List repositoryInfos = getRepositoriesInternal(repositoryId);

    if (repositoryInfos.isEmpty()) {
      throw new CmisObjectNotFoundException("Repository '" + repositoryId + "'not found!");
    }

   if (repositoryInfos.size() == 1) {
      return (RepositoryInfo)repositoryInfos.get(0);
    }

    for (RepositoryInfo info : repositoryInfos) {
      if (info.getId() == null)
      {
        continue;
      }
      if (info.getId().equals(repositoryId)) {
        return info;
      }
    }

    throw new CmisObjectNotFoundException("Repository '" + repositoryId + "'not found!");
  }

- So, when the number of repositories in the given domain is just one, it always returns that irrespective what the user has set in the property "org.apache.chemistry.opencmis.session.repository.id"

Proposed solution:
The "if " condition above checking for repositoryInfos.size, which returns the only available repository should be removed. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)