You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2006/05/29 18:56:01 UTC

svn commit: r410118 - in /cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring: AvalonServiceManager.java AvalonServiceSelector.java

Author: cziegeler
Date: Mon May 29 09:56:00 2006
New Revision: 410118

URL: http://svn.apache.org/viewvc?rev=410118&view=rev
Log:
Wrap Spring exceptions in ServiceExceptions

Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/AvalonServiceManager.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/AvalonServiceSelector.java

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/AvalonServiceManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/AvalonServiceManager.java?rev=410118&r1=410117&r2=410118&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/AvalonServiceManager.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/AvalonServiceManager.java Mon May 29 09:56:00 2006
@@ -52,7 +52,12 @@
             throw new ServiceException("AvalonServiceManager",
                                        "Component with '" + role + "' is not defined in this service manager.");
         }
-        return this.beanFactory.getBean(role);
+        try {
+            return this.beanFactory.getBean(role);
+        } catch (BeansException be) {
+            throw new ServiceException("AvalonServiceManager",
+                                       "Exception during lookup of component with '" + role + "'.", be);
+        }
     }
 
     /**

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/AvalonServiceSelector.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/AvalonServiceSelector.java?rev=410118&r1=410117&r2=410118&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/AvalonServiceSelector.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/AvalonServiceSelector.java Mon May 29 09:56:00 2006
@@ -56,7 +56,16 @@
         if ( key == null || key.toString().length() == 0 ) {
             key = this.defaultKey;
         }
-        return this.beanFactory.getBean(this.role + key);
+        if ( !this.isSelectable(key) ) {
+            throw new ServiceException("AvalonServiceSelector",
+                                       "Component with role '" + this.role + "' and key '" + key + "' is not defined in this service selector.");
+        }
+        try {
+            return this.beanFactory.getBean(this.role + key);
+        } catch (BeansException be) {
+            throw new ServiceException("AvalonServiceSelector",
+                                       "Exception during lookup of component with role '" + this.role + "' and key '" + key + "'.", be);
+        }
     }
 
     /**