polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [1/4] polygene-java git commit: Throw MissingRepositoryException if the type has not been registered.
Date Sun, 03 Dec 2017 06:08:08 GMT
Repository: polygene-java
Updated Branches:
  refs/heads/develop 6eaa8d47b -> 8f8e8dc45


Throw MissingRepositoryException if the type has not been registered.


Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/b7de62e6
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/b7de62e6
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/b7de62e6

Branch: refs/heads/develop
Commit: b7de62e6d58cca889cef2f707e9cb76ec110f8a1
Parents: 6eaa8d4
Author: niclas <niclas@hedhman.org>
Authored: Sat Nov 25 10:04:15 2017 +0800
Committer: niclas <niclas@hedhman.org>
Committed: Sat Nov 25 10:04:15 2017 +0800

----------------------------------------------------------------------
 .../library/restlet/repository/RepositoryLocator.java       | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7de62e6/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/repository/RepositoryLocator.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/repository/RepositoryLocator.java
b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/repository/RepositoryLocator.java
index 452ca4e..09d6b04 100644
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/repository/RepositoryLocator.java
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/repository/RepositoryLocator.java
@@ -50,8 +50,13 @@ public interface RepositoryLocator
         @Override
         public <T extends HasIdentity> CrudRepository<T> find(Class<T>
entityType )
         {
-            //noinspection unchecked
-            return repositories.get( entityType );
+            @SuppressWarnings( "unchecked" )
+            CrudRepository<T> repository = repositories.get( entityType );
+            if( repository == null )
+            {
+                throw new MissingRepositoryException( entityType );
+            }
+            return repository;
         }
     }
 }


Mime
View raw message