Throw ServiceException and return null for service factory circularity. (FELIX-2693)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1033554 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java b/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
index 6ec6ee4..4bbf780 100644
--- a/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
+++ b/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
@@ -246,8 +246,10 @@
                 // We don't allow cycles when we call out to the service factory.
                 if (o.equals(Thread.currentThread()))
                 {
-                    throw new IllegalStateException(
-                        "ServiceFactory.getService() resulted in a cycle.");
+                    throw new ServiceException(
+                        "ServiceFactory.getService() resulted in a cycle.",
+                        ServiceException.FACTORY_ERROR,
+                        null);
                 }
 
                 // Otherwise, wait for it to be freed.