geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r771427 - /geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintObjectRecipe.java
Date Mon, 04 May 2009 20:23:31 GMT
Author: gawor
Date: Mon May  4 20:23:31 2009
New Revision: 771427

URL: http://svn.apache.org/viewvc?rev=771427&view=rev
Log:
provide slightly better canCreate method

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintObjectRecipe.java

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintObjectRecipe.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintObjectRecipe.java?rev=771427&r1=771426&r2=771427&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintObjectRecipe.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintObjectRecipe.java
Mon May  4 20:23:31 2009
@@ -239,7 +239,8 @@
             try {
                 instance = match.getMethod().invoke(factoryObj, args.toArray());
             } catch (InvocationTargetException e) {
-                throw new ConstructionException(e);
+                Throwable root = e.getTargetException();
+                throw new ConstructionException(root);
             } catch (Exception e) {
                 throw new ConstructionException(e);
             }
@@ -253,7 +254,8 @@
             try {
                 instance = match.getMethod().invoke(null, args.toArray());
             } catch (InvocationTargetException e) {
-                throw new ConstructionException(e);
+                Throwable root = e.getTargetException();
+                throw new ConstructionException(root);
             } catch (Exception e) {
                 throw new ConstructionException(e);
             }
@@ -266,7 +268,8 @@
             try {
                 instance = match.getConstructor().newInstance(args.toArray());
             } catch (InvocationTargetException e) {
-                throw new ConstructionException(e);
+                Throwable root = e.getTargetException();
+                throw new ConstructionException(root);
             } catch (Exception e) {
                 throw new ConstructionException(e);
             }
@@ -312,6 +315,17 @@
     }
     
     @Override
+    public boolean canCreate(Type type) {
+        if (factoryMethod == null) {
+            return super.canCreate(type);
+        } else {
+            // factory-method was specified, so we're not really sure what type of object
we create
+            // until we actually create it
+            return true;
+        }
+    }
+    
+    @Override
     public List<Recipe> getConstructorRecipes() {
         return getNestedRecipes();
     }



Mime
View raw message