You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2009/10/29 23:04:34 UTC
svn commit: r831109 -
/geronimo/server/branches/2.2/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
Author: djencks
Date: Thu Oct 29 22:04:33 2009
New Revision: 831109
URL: http://svn.apache.org/viewvc?rev=831109&view=rev
Log:
GERONIMO-4907 Complain about all attempts to set non-existent gbean properties at once
Modified:
geronimo/server/branches/2.2/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
Modified: geronimo/server/branches/2.2/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java?rev=831109&r1=831108&r2=831109&view=diff
==============================================================================
--- geronimo/server/branches/2.2/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java (original)
+++ geronimo/server/branches/2.2/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java Thu Oct 29 22:04:33 2009
@@ -303,18 +303,19 @@
List<String> cstrNames = beanInfo.getConstructor().getAttributeNames();
Class[] cstrTypes = new Class[cstrNames.size()];
for (int i = 0; i < cstrTypes.length; i++) {
- String argumentName = (String) cstrNames.get(i);
+ String argumentName = cstrNames.get(i);
if (referenceIndex.containsKey(argumentName)) {
- Integer index = (Integer) referenceIndex.get(argumentName);
- GBeanReference reference = references[index.intValue()];
+ Integer index = referenceIndex.get(argumentName);
+ GBeanReference reference = references[index];
cstrTypes[i] = reference.getProxyType();
} else if (attributeIndex.containsKey(argumentName)) {
- Integer index = (Integer) attributeIndex.get(argumentName);
- GBeanAttribute attribute = attributes[index.intValue()];
+ Integer index = attributeIndex.get(argumentName);
+ GBeanAttribute attribute = attributes[index];
cstrTypes[i] = attribute.getType();
}
}
ObjectRecipe objectRecipe = new ObjectRecipe(type, cstrNames.toArray(new String[0]), cstrTypes);
+ objectRecipe.allow(Option.IGNORE_MISSING_PROPERTIES);
// set the initial attribute values
Map<String, Object> dataAttributes = gbeanData.getAttributes();
@@ -920,6 +921,10 @@
stateReason = "the service constructor threw an exception. \n" + printException(e);
throw e;
}
+ Map<String, Object> unsetProperties = objectRecipe.getUnsetProperties();
+ if (unsetProperties.size() > 0) {
+ throw new ConstructionException("Error creating gbean of class: " + gbeanInfo.getClassName() + ", attempting to set nonexistent properties: " + unsetProperties.keySet());
+ }
// write the target variable in a synchronized block so it is available to all threads
// we do this before calling the setters or start method so the bean can be called back