You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Anton Tagunov <at...@mail.cnt.ru> on 2003/04/30 01:54:09 UTC
[PATCH] bug 19452 XSLT processorImpl causes warnings to be fired
I understand that this is quite a young code, so..
19452. XSLT processorImpl causes warnings to be fired
http://issues.apache.org/bugzilla/show_bug.cgi?id=19452
[WARNING] Attempting to release a null component
or
[WARNING] ... (the sence is that ECM goes down while there
are components which have not been released)
[There's an extensive test case in Bugzilla]
--- XSLTProcessorImpl.orig 2003-04-29 23:03:26.000000000 +0400
+++ XSLTProcessorImpl.java 2003-04-30 00:12:42.000000000 +0400
@@ -168,14 +168,22 @@
public void service( final ServiceManager manager )
throws ServiceException
{
- m_manager = manager;
- m_xmlizer = (XMLizer)m_manager.lookup( XMLizer.ROLE );
- m_resolver = (SourceResolver)m_manager.lookup( SourceResolver.ROLE );
-
- if( m_manager.hasService( Store.TRANSIENT_STORE ) )
+ try
{
- m_store = (Store)m_manager.lookup( Store.TRANSIENT_STORE );
+ m_manager = manager;
+ m_xmlizer = (XMLizer)m_manager.lookup( XMLizer.ROLE );
+ m_resolver = (SourceResolver)m_manager.lookup( SourceResolver.ROLE );
+
+ if( m_manager.hasService( Store.TRANSIENT_STORE ) )
+ {
+ m_store = (Store)m_manager.lookup( Store.TRANSIENT_STORE );
+ }
}
+ catch( ServiceException se )
+ {
+ cleanup();
+ throw( se );
+ }
}
/**
@@ -184,21 +192,34 @@
public void initialize()
throws Exception
{
- m_errorHandler = new TraxErrorHandler( getLogger() );
- m_factory = getTransformerFactory( m_transformerFactory );
- m_defaultFactory = m_factory;
+ try
+ {
+ m_errorHandler = new TraxErrorHandler( getLogger() );
+ m_factory = getTransformerFactory( m_transformerFactory );
+ m_defaultFactory = m_factory;
+ }
+ catch( Exception e )
+ {
+ cleanup();
+ throw( e );
+ }
}
/**
* Disposable
*/
- public void dispose()
+ public void dispose()
+ {
+ cleanup();
+ }
+
+ private void cleanup()
{
if ( null != m_manager)
{
- m_manager.release( m_store );
- m_manager.release( m_resolver );
- m_manager.release( m_xmlizer );
+ if ( null != m_store ) m_manager.release( m_store );
+ if ( null != m_resolver) m_manager.release( m_resolver );
+ if ( null != m_xmlizer ) m_manager.release( m_xmlizer );
m_manager = null;
}
m_xmlizer = null;
@@ -218,15 +239,19 @@
m_transformerFactory = params.getParameter( "transformer-factory", null );
if( !m_useStore )
{
- // release the store, if we don't need it anymore
- m_manager.release( m_store );
- m_store = null;
+ if ( null != m_store )
+ {
+ // release the store, if we don't need it anymore
+ m_manager.release( m_store );
+ m_store = null;
+ }
}
else if( null == m_store )
{
final String message =
"XSLTProcessor: use-store is set to true, " +
"but unable to aquire the Store.";
+ cleanup();
throw new ParameterException( message );
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org