geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r393977 - /geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/XBeanXmlBeanDefinitionParser.java
Date Thu, 13 Apr 2006 23:45:37 GMT
Author: dain
Date: Thu Apr 13 16:45:37 2006
New Revision: 393977

URL: http://svn.apache.org/viewcvs?rev=393977&view=rev
Log:
Commited XBEAN-1 XBean is not binary compatible with spring 1.2.7.  Thanks Guillaume Nodet.

Modified:
    geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/XBeanXmlBeanDefinitionParser.java

Modified: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/XBeanXmlBeanDefinitionParser.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/XBeanXmlBeanDefinitionParser.java?rev=393977&r1=393976&r2=393977&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/XBeanXmlBeanDefinitionParser.java
(original)
+++ geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/XBeanXmlBeanDefinitionParser.java
Thu Apr 13 16:45:37 2006
@@ -24,6 +24,7 @@
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.lang.reflect.Method;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Enumeration;
@@ -35,6 +36,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.MutablePropertyValues;
 import org.springframework.beans.factory.BeanDefinitionStoreException;
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.BeanDefinitionHolder;
@@ -266,8 +268,29 @@
     protected void addProperty(BeanDefinitionHolder definition, MappingMetaData metadata,
Element element,
             String localName, String value) {
         String propertyName = metadata.getPropertyName(getLocalName(element), localName);
-        if (propertyName != null)
-            definition.getBeanDefinition().getPropertyValues().addPropertyValue(propertyName,
getValue(value));
+        if (propertyName != null) {
+            try {
+                addPropertyValueMethod.invoke(definition.getBeanDefinition().getPropertyValues(),
+                                              new Object[] { propertyName, getValue(value)
});
+            } catch (Exception e) {
+                throw new RuntimeException("Error adding property definition", e);
+            }
+        }
+    }
+    
+    // Fix Spring 1.2.6 to 1.2.7 binary incompatibility.
+    // The addPropertyValueMethod has changed to return a
+    // value instead of void.
+    // So use reflectiom to handle both cases.
+    private static final Method addPropertyValueMethod;
+    static {
+        try {
+            addPropertyValueMethod = MutablePropertyValues.class.getMethod(
+                        "addPropertyValue",
+                        new Class[] { String.class, Object.class });
+        } catch (Exception e) {
+            throw new RuntimeException("Unable to find MutablePropertyValues:addPropertyValue",
e);
+        }
     }
 
     protected Object getValue(String value) {



Mime
View raw message