Author: ay Date: Thu Dec 22 11:31:44 2011 New Revision: 1222186 URL: http://svn.apache.org/viewvc?rev=1222186&view=rev Log: Merged revisions 1221825 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk
........ r1221825 | ay | 2011-12-21 19:01:07 +0100 (Wed, 21 Dec 2011) | 1 line [CXF-3993] ws-rm's blueprint configuration fails to parse RMAssertion entries ........ Modified: cxf/branches/2.4.x-fixes/ (props changed) cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/RMBPBeanDefinitionParser.java Propchange: cxf/branches/2.4.x-fixes/ ------------------------------------------------------------------------------ svn:mergeinfo = /cxf/trunk:1221825 Propchange: cxf/branches/2.4.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/RMBPBeanDefinitionParser.java URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/RMBPBeanDefinitionParser.java?rev=1222186&r1=1222185&r2=1222186&view=diff ============================================================================== --- cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/RMBPBeanDefinitionParser.java (original) +++ cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/blueprint/RMBPBeanDefinitionParser.java Thu Dec 22 11:31:44 2011 @@ -19,6 +19,8 @@ package org.apache.cxf.ws.rm.blueprint; +import java.util.HashMap; +import java.util.Map; import java.util.logging.Logger; import javax.xml.bind.JAXBContext; @@ -39,7 +41,6 @@ import org.apache.cxf.helpers.DOMUtils; import org.apache.cxf.ws.rm.RMManager; import org.apache.cxf.ws.rm.manager.DeliveryAssuranceType; import org.apache.cxf.ws.rm.manager.DestinationPolicyType; -import org.apache.cxf.ws.rm.manager.ObjectFactory; import org.apache.cxf.ws.rm.manager.SourcePolicyType; import org.osgi.service.blueprint.reflect.Metadata; @@ -53,7 +54,7 @@ public class RMBPBeanDefinitionParser ex private static final Logger LOG = LogUtils.getL7dLogger(RMBPBeanDefinitionParser.class); - private JAXBContext jaxbContext; + private Map<Class<?>, JAXBContext> jaxbContexts = new HashMap<Class<?>, JAXBContext>(); private Class<?> beanClass; @@ -119,7 +120,7 @@ public class RMBPBeanDefinitionParser ex Element data = DOMUtils.getFirstElement(parent); try { - Unmarshaller unmarshaller = getJAXBContext().createUnmarshaller(); + Unmarshaller unmarshaller = getJAXBContext(c).createUnmarshaller(); MutablePassThroughMetadata value = ctx.createMetadata(MutablePassThroughMetadata.class); value.setObject(unmarshaller.unmarshal(data, c).getValue()); bean.addProperty(propertyName, value); @@ -128,10 +129,12 @@ public class RMBPBeanDefinitionParser ex } } - private synchronized JAXBContext getJAXBContext() throws JAXBException { + private synchronized JAXBContext getJAXBContext(Class<?> c) throws JAXBException { + JAXBContext jaxbContext = jaxbContexts.get(c); if (jaxbContext == null) { - jaxbContext = JAXBContext.newInstance(PackageUtils.getPackageName(ObjectFactory.class), - ObjectFactory.class.getClassLoader()); + jaxbContext = JAXBContext.newInstance(PackageUtils.getPackageName(c), + c.getClassLoader()); + jaxbContexts.put(c, jaxbContext); } return jaxbContext; }