[Jboss-cvs] JBossAS SVN: r56937 - branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Sep 18 09:50:12 EDT 2006
Author: adrian at jboss.org
Date: 2006-09-18 09:50:09 -0400 (Mon, 18 Sep 2006)
New Revision: 56937
Modified:
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceJBXBValueMetaData.java
Log:
Set the mbean's context classloader when parsing JBossXB attributes.
This is so it can find schema's like:
resource:schema/...
Modified: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceJBXBValueMetaData.java
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceJBXBValueMetaData.java 2006-09-18 13:23:19 UTC (rev 56936)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceJBXBValueMetaData.java 2006-09-18 13:50:09 UTC (rev 56937)
@@ -68,11 +68,24 @@
// Get the attribute element content in a parsable form
StringBuffer buffer = ServiceConfigurator.getElementContent(getElement());
- // Parse the attribute element content
- SchemaBindingResolver resolver = SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- StringReader reader = new StringReader(buffer.toString());
- Object bean = unmarshaller.unmarshal(reader, resolver);
- return bean;
+ Thread current = Thread.currentThread();
+ ClassLoader oldTcl = current.getContextClassLoader();
+ ClassLoader cl = valueContext.getClassloader();
+ if (cl != null)
+ current.setContextClassLoader(cl);
+ try
+ {
+ // Parse the attribute element content
+ SchemaBindingResolver resolver = SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ StringReader reader = new StringReader(buffer.toString());
+ Object bean = unmarshaller.unmarshal(reader, resolver);
+ return bean;
+ }
+ finally
+ {
+ if (cl != null)
+ current.setContextClassLoader(oldTcl);
+ }
}
}
More information about the jboss-cvs-commits
mailing list