cziegeler 01/12/14 08:12:14 Modified: src/org/apache/cocoon/transformation TraxTransformer.java Log: Cleaned up TraxTransformer code a little bit and exceptions are now propagated instead of converted to a RuntimeException Revision Changes Path 1.38 +23 -24 xml-cocoon2/src/org/apache/cocoon/transformation/TraxTransformer.java Index: TraxTransformer.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/transformation/TraxTransformer.java,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- TraxTransformer.java 2001/11/15 11:21:09 1.37 +++ TraxTransformer.java 2001/12/14 16:12:14 1.38 @@ -103,7 +103,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a> * @author <a href="mailto:[EMAIL PROTECTED]">Ovidiu Predescu</a> - * @version CVS $Id: TraxTransformer.java,v 1.37 2001/11/15 11:21:09 cziegeler Exp $ + * @version CVS $Id: TraxTransformer.java,v 1.38 2001/12/14 16:12:14 cziegeler Exp $ */ public class TraxTransformer extends AbstractTransformer implements Transformer, Composable, Recyclable, Configurable, Cacheable, Disposable { @@ -154,33 +154,35 @@ child = conf.getChild("use-request-parameters"); this.useParameters = child.getValueAsBoolean(false); this._useParameters = this.useParameters; - getLogger().debug("Use parameters is " + this.useParameters + " for " + this); child = conf.getChild("use-cookies"); this.useCookies = child.getValueAsBoolean(false); this._useCookies = this.useCookies; - getLogger().debug("Use cookies is " + this.useCookies + " for " + this); child = conf.getChild("use-browser-capabilities-db"); this.useBrowserCap = child.getValueAsBoolean(false); this._useBrowserCap = this.useBrowserCap; - getLogger().debug("Use browser capabilities is " + this.useBrowserCap + " for " + this); child = conf.getChild("use-session-info"); this.useSessionInfo = child.getValueAsBoolean(false); this._useSessionInfo = this.useSessionInfo; - getLogger().debug("Use session info is " + this.useSessionInfo + " for " + this); - child = conf.getChild("xslt-processor-role"); String xsltRole = child.getValue(XSLTProcessor.ROLE); - getLogger().debug("Use XSLTProcessor of role " + xsltRole); - try { - this.xsltProcessor = (XSLTProcessor)this.manager.lookup(xsltRole); - } catch(Exception e) { - throw new ConfigurationException("Cannot load XSLT processor", e); - } + if (this.getLogger().isDebugEnabled() == true) { + this.getLogger().debug("Use parameters is " + this.useParameters + " for " + this); + this.getLogger().debug("Use cookies is " + this.useCookies + " for " + this); + this.getLogger().debug("Use browser capabilities is " + this.useBrowserCap + " for " + this); + this.getLogger().debug("Use session info is " + this.useSessionInfo + " for " + this); + this.getLogger().debug("Use XSLTProcessor of role " + xsltRole); + } + + try { + this.xsltProcessor = (XSLTProcessor)this.manager.lookup(xsltRole); + } catch (ComponentException e) { + throw new ConfigurationException("Cannot load XSLT processor", e); + } } } @@ -190,8 +192,9 @@ */ public void compose(ComponentManager manager) throws ComponentException { this.manager = manager; - getLogger().debug("Looking up " + XSLTProcessor.ROLE); - getLogger().debug("Looking up " + Browser.ROLE); + if (this.getLogger().isDebugEnabled() == true) { + getLogger().debug("Looking up " + Browser.ROLE); + } this.browser = (Browser) manager.lookup(Browser.ROLE); } @@ -211,11 +214,16 @@ this.objectModel = objectModel; this.inputSource = resolver.resolve(src); xsltProcessor.setSourceResolver(resolver); - getLogger().debug("Using stylesheet: '"+this.inputSource.getSystemId()+"' in " + this + ", last modified: " + this.inputSource.getLastModified()); _useParameters = par.getParameterAsBoolean("use-request-parameters", this.useParameters); _useBrowserCap = par.getParameterAsBoolean("use-browser-capabilities-db", this.useBrowserCap); _useCookies = par.getParameterAsBoolean("use-cookies", this.useCookies); _useSessionInfo = par.getParameterAsBoolean("use-session-info", this.useSessionInfo); + if (this.getLogger().isDebugEnabled() == true) { + this.getLogger().debug("Using stylesheet: '"+this.inputSource.getSystemId()+"' in " + this + ", last modified: " + this.inputSource.getLastModified()); + } + + /** Get a Transformer Handler */ + this.transformerHandler = this.xsltProcessor.getTransformerHandler(inputSource); } /** @@ -269,15 +277,6 @@ * Set the <code>XMLConsumer</code> that will receive XML data. */ public void setConsumer(XMLConsumer consumer) { - - /** Get a Transformer Handler */ - try { - transformerHandler - = xsltProcessor.getTransformerHandler(inputSource); - } catch (Exception e){ - getLogger().error("Problem in getTransformer:", e); - throw new RuntimeException("Problem in getTransformer:" + e.getMessage()); - } HashMap map = getLogicSheetParameters(); if (map != null) {
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]