You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/05/31 23:34:29 UTC
svn commit: r179284 -
/incubator/beehive/branches/v1/m1/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs
Author: ekoneil
Date: Tue May 31 14:34:28 2005
New Revision: 179284
URL: http://svn.apache.org/viewcvs?rev=179284&view=rev
Log:
Fix the service control leak in ServiceControlImpl as per JIRA 775.
BB: self
DRT: Beehive / service control pass
Modified:
incubator/beehive/branches/v1/m1/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs
Modified: incubator/beehive/branches/v1/m1/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs
URL: http://svn.apache.org/viewcvs/incubator/beehive/branches/v1/m1/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs?rev=179284&r1=179283&r2=179284&view=diff
==============================================================================
--- incubator/beehive/branches/v1/m1/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs (original)
+++ incubator/beehive/branches/v1/m1/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs Tue May 31 14:34:28 2005
@@ -447,47 +447,51 @@
private synchronized void initialize() throws Exception {
if (initialized)
return;
- XmlBeanWSDLProcessor wsdlProcessor;
-
ServiceControl.WSDL wsdl = (ServiceControl.WSDL) cbContext
.getControlPropertySet(ServiceControl.WSDL.class);
- if (wsdl != null) {
- logger.debug("read wsdl from: " + wsdl.path());
- InputStream wsdlStream = getWSDLStream(wsdl.path());
-
- if (wsdlStream != null) {
- wsdlProcessor = new XmlBeanWSDLProcessor(wsdlStream);
- } else {
- throw new RuntimeException(
- "No WSDL found at the provided path: " + wsdl.path());
- }
- } else {
+ if(wsdl == null)
throw new RuntimeException("No WSDL annotation found.");
- }
-
- ServiceFactory factory = ServiceFactory.newInstance();
-
- service = factory.createService(wsdlProcessor.getServiceName());
-
- HandlerInfo hInfo = new HandlerInfo();
- hInfo.setHandlerClass(HeaderHandler.class);
-
- TypeMapping tm = service.getTypeMappingRegistry()
- .getDefaultTypeMapping();
- lookupService = new SystemTypeLookupService();
- registrar = new AxisTypeRegistrar(
- (org.apache.axis.encoding.TypeMapping) tm, lookupService);
- configureEndPoint();
+
+ logger.debug("read wsdl from: " + wsdl.path());
+ InputStream wsdlStream = null;
+ try {
+ wsdlStream = getWSDLStream(wsdl.path());
+
+ XmlBeanWSDLProcessor wsdlProcessor;
+ if (wsdlStream != null) {
+ wsdlProcessor = new XmlBeanWSDLProcessor(wsdlStream);
+ } else {
+ throw new RuntimeException(
+ "No WSDL found at the provided path: " + wsdl.path());
+ }
- mWSTM = wsdlProcessor.getObjectModel(lookupService);
+ ServiceFactory factory = ServiceFactory.newInstance();
- portType = new QName(mWSTM.getWsTargetNamespace(), mWSTM.getWsName()); // porttype
- // name
- service.getHandlerRegistry().getHandlerChain(portType).add(hInfo);
+ service = factory.createService(wsdlProcessor.getServiceName());
- initialized = true;
+ HandlerInfo hInfo = new HandlerInfo();
+ hInfo.setHandlerClass(HeaderHandler.class);
+ TypeMapping tm = service.getTypeMappingRegistry()
+ .getDefaultTypeMapping();
+ lookupService = new SystemTypeLookupService();
+ registrar = new AxisTypeRegistrar(
+ (org.apache.axis.encoding.TypeMapping) tm, lookupService);
+ configureEndPoint();
+
+ mWSTM = wsdlProcessor.getObjectModel(lookupService);
+
+ portType = new QName(mWSTM.getWsTargetNamespace(), mWSTM.getWsName()); // porttype
+ // name
+ service.getHandlerRegistry().getHandlerChain(portType).add(hInfo);
+
+ initialized = true;
+ }
+ finally {
+ if(wsdlStream != null)
+ wsdlStream.close();
+ }
}
private String getAlternateOperationName(Method method) {