chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1368383 - in /chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi: atompub/RepositoryServiceImpl.java browser/RepositoryServiceImpl.java
Date Thu, 02 Aug 2012 08:41:21 GMT
Author: fmui
Date: Thu Aug  2 08:41:21 2012
New Revision: 1368383

URL: http://svn.apache.org/viewvc?rev=1368383&view=rev
Log:
AtomPub and Browser Client: more robust getRepositoryInfo() handling

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RepositoryServiceImpl.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java?rev=1368383&r1=1368382&r2=1368383&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java
Thu Aug  2 08:41:21 2012
@@ -62,6 +62,14 @@ public class RepositoryServiceImpl exten
     public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension)
{
         List<RepositoryInfo> repositoryInfos = getRepositoriesInternal(repositoryId);
 
+        if (repositoryInfos.size() == 0) {
+            throw new CmisObjectNotFoundException("Repository '" + repositoryId + "'not found!");
+        }
+
+        if (repositoryInfos.size() == 1) {
+            return repositoryInfos.get(0);
+        }
+
         // find the repository
         for (RepositoryInfo info : repositoryInfos) {
             if (info.getId() == null) {
@@ -73,7 +81,7 @@ public class RepositoryServiceImpl exten
             }
         }
 
-        throw new CmisObjectNotFoundException("Repository not found!");
+        throw new CmisObjectNotFoundException("Repository '" + repositoryId + "'not found!");
     }
 
     public TypeDefinition getTypeDefinition(String repositoryId, String typeId, ExtensionsData
extension) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RepositoryServiceImpl.java?rev=1368383&r1=1368382&r2=1368383&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RepositoryServiceImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RepositoryServiceImpl.java
Thu Aug  2 08:41:21 2012
@@ -54,6 +54,14 @@ public class RepositoryServiceImpl exten
     public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension)
{
         List<RepositoryInfo> repositoryInfos = getRepositoriesInternal(repositoryId);
 
+        if (repositoryInfos.size() == 0) {
+            throw new CmisObjectNotFoundException("Repository '" + repositoryId + "'not found!");
+        }
+
+        if (repositoryInfos.size() == 1) {
+            return repositoryInfos.get(0);
+        }
+
         // find the repository
         for (RepositoryInfo info : repositoryInfos) {
             if (info.getId() == null) {
@@ -65,7 +73,7 @@ public class RepositoryServiceImpl exten
             }
         }
 
-        throw new CmisObjectNotFoundException("Repository not found!");
+        throw new CmisObjectNotFoundException("Repository '" + repositoryId + "'not found!");
     }
 
     public TypeDefinition getTypeDefinition(String repositoryId, String typeId, ExtensionsData
extension) {



Mime
View raw message