ceki 2004/11/22 09:05:13 Modified: src/java/org/apache/joran Interpreter.java src/java/org/apache/joran/action NestComponentIA.java Action.java Log: Minor changes in o.a.joran Revision Changes Path 1.19 +30 -12 logging-log4j/src/java/org/apache/joran/Interpreter.java Index: Interpreter.java =================================================================== RCS file: /home/cvs/logging-log4j/src/java/org/apache/joran/Interpreter.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- Interpreter.java 19 Nov 2004 15:20:06 -0000 1.18 +++ Interpreter.java 22 Nov 2004 17:05:13 -0000 1.19 @@ -17,6 +17,8 @@ package org.apache.joran; import org.apache.joran.action.*; +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; import org.apache.log4j.spi.ErrorItem; import org.xml.sax.Attributes; @@ -72,6 +74,8 @@ Pattern pattern; Locator locator; + Logger logger = LogManager.getLogger(Interpreter.class); + // The entity resolver is only needed in order to be compatible with // XML files written for DOMConfigurator containing the following DOCTYPE // <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> @@ -123,7 +127,7 @@ String errMsg = "no applicable action for <" + tagName + ">, current pattern is [" + pattern+"]"; - //LogLog.warn(errMsg); + logger.warn(errMsg); ec.addError(new ErrorItem(errMsg)); } } @@ -240,28 +244,42 @@ this.ruleStore = ruleStore; } - public void endDocument() { - } +// /** +// * Call the finish methods for all actions. Unfortunately, the endDocument +// * method is not called in case of errors in the XML document, which +// * makes endDocument() pretty damn useless. +// */ +// public void endDocument() { +// Set arrayListSet = ruleStore.getActionSet(); +// Iterator iterator = arrayListSet.iterator(); +// while(iterator.hasNext()) { +// ArrayList al = (ArrayList) iterator.next(); +// for(int i = 0; i < al.size(); i++) { +// Action a = (Action) al.get(i); +// a.endDocument(ec); +// } +// } +// } public void error(SAXParseException spe) throws SAXException { ec.addError(new ErrorItem("Parsing error", spe)); - //LogLog.error( - //"Parsing problem on line " + spe.getLineNumber() + " and column " - //+ spe.getColumnNumber()); + logger.error( + "Parsing problem on line " + spe.getLineNumber() + " and column " + + spe.getColumnNumber(), spe); } public void fatalError(SAXParseException spe) throws SAXException { ec.addError(new ErrorItem("Parsing fatal error", spe)); -// LogLog.error( -// "Parsing problem on line " + spe.getLineNumber() + " and column " -// + spe.getColumnNumber()); + logger.error( + "Parsing problem on line " + spe.getLineNumber() + " and column " + + spe.getColumnNumber(), spe); } public void warning(SAXParseException spe) throws SAXException { ec.addError(new ErrorItem("Parsing warning", spe)); -// LogLog.warn( -// "Parsing problem on line " + spe.getLineNumber() + " and column " -// + spe.getColumnNumber()); + logger.warn( + "Parsing problem on line " + spe.getLineNumber() + " and column " + + spe.getColumnNumber(), spe); } public void endPrefixMapping(java.lang.String prefix) { 1.15 +5 -7 logging-log4j/src/java/org/apache/joran/action/NestComponentIA.java Index: NestComponentIA.java =================================================================== RCS file: /home/cvs/logging-log4j/src/java/org/apache/joran/action/NestComponentIA.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- NestComponentIA.java 19 Nov 2004 15:20:06 -0000 1.14 +++ NestComponentIA.java 22 Nov 2004 17:05:13 -0000 1.15 @@ -20,7 +20,6 @@ import org.apache.joran.Pattern; import org.apache.joran.helper.Option; -import org.apache.log4j.Logger; import org.apache.log4j.config.PropertySetter; import org.apache.log4j.helpers.Loader; import org.apache.log4j.spi.ErrorItem; @@ -36,8 +35,7 @@ * */ public class NestComponentIA extends ImplicitAction { - static final Logger logger = Logger.getLogger(NestComponentIA.class); - + // actionDataStack contains ActionData instances // We use a stack of ActionData objects in order to support nested // elements which are handled by the same NestComponentIA instance. @@ -91,7 +89,7 @@ actionData.inError = true; String errMsg = "No class name attribute in <" + localName + ">"; - logger.error(errMsg); + getLogger().error(errMsg); ec.addError(new ErrorItem(errMsg)); return; @@ -117,7 +115,7 @@ } public void end(ExecutionContext ec, String tagName) { - logger.debug("entering end method"); + getLogger().debug("entering end method"); // pop the action data object pushed in isApplicable() method call // we assume that each this begin @@ -134,10 +132,10 @@ Object o = ec.peekObject(); if (o != actionData.nestedComponent) { - logger.warn( + getLogger().warn( "The object on the top the of the stack is not the component pushed earlier."); } else { - logger.warn("Removing component from the object stack"); + getLogger().warn("Removing component from the object stack"); ec.popObject(); // Now let us attach the component 1.17 +0 -1 logging-log4j/src/java/org/apache/joran/action/Action.java Index: Action.java =================================================================== RCS file: /home/cvs/logging-log4j/src/java/org/apache/joran/action/Action.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- Action.java 17 Nov 2004 17:28:00 -0000 1.16 +++ Action.java 22 Nov 2004 17:05:13 -0000 1.17 @@ -63,7 +63,6 @@ public abstract void end(ExecutionContext ec, String name); - //public abstract void finish(ExecutionContext ec); public String toString() { return this.getClass().getName(); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]