geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r524311 - /geronimo/server/trunk/modules/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Holder.java
Date Fri, 30 Mar 2007 23:08:10 GMT
Author: djencks
Date: Fri Mar 30 16:08:09 2007
New Revision: 524311

URL: http://svn.apache.org/viewvc?view=rev&rev=524311
Log:
GERONIMO-3052 Throw exceptions, don't ignore injection problems

Modified:
    geronimo/server/trunk/modules/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Holder.java

Modified: geronimo/server/trunk/modules/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Holder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Holder.java?view=diff&rev=524311&r1=524310&r2=524311
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Holder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/annotation/Holder.java
Fri Mar 30 16:08:09 2007
@@ -107,9 +107,9 @@
         ObjectRecipe objectRecipe = new ObjectRecipe(className);
         objectRecipe.allow(Option.FIELD_INJECTION);
         objectRecipe.allow(Option.PRIVATE_PROPERTIES);
-        objectRecipe.allow(Option.IGNORE_MISSING_PROPERTIES);
         List<Injection> callbackHandlerinjections = getInjections(className);
         if (callbackHandlerinjections != null) {
+            List<NamingException> problems = new ArrayList<NamingException>();
             for (Injection injection : callbackHandlerinjections) {
                 try {
                     String jndiName = injection.getJndiName();
@@ -124,17 +124,14 @@
                         objectRecipe.setProperty(injection.getTargetName(), new StaticRecipe(object));
                     }
                 } catch (NamingException e) {
-//                        log.warn("could not look up ", e);
+                    problems.add(e);
                 }
             }
-        }
-        Object result = objectRecipe.create(classLoader);
-        Map unsetProperties = objectRecipe.getUnsetProperties();
-        if (unsetProperties.size() > 0) {
-            for (Object property : unsetProperties.keySet()) {
-//                log.warning("Injection: No such property '"+property+"' in class "+_class.getName());
+            if (!problems.isEmpty()) {
+                throw new InstantiationException("Some objects to be injected were not found
in jndi: " + problems);
             }
         }
+        Object result = objectRecipe.create(classLoader);
         if (getPostConstruct() != null) {
             try {
                 apply(result, null, postConstruct);



Mime
View raw message