import java.util.Map;
import org.w3c.dom.DOMImplementation;
-
import org.xml.sax.Locator;
import org.apache.commons.logging.Log;
public class ElementMappingRegistry {
/** logging instance */
- protected Log log = LogFactory.getLog(ElementMappingRegistry.class);
+ private static final Log LOG = LogFactory.getLog(ElementMappingRegistry.class);
/**
* Table mapping element names to the makers of objects
try {
addElementMapping(mapping);
} catch (IllegalArgumentException e) {
- log.warn("Error while adding element mapping", e);
+ LOG.warn("Error while adding element mapping", e);
}
}
public class FOTreeBuilder extends DefaultHandler {
/** logging instance */
- protected Log log = LogFactory.getLog(FOTreeBuilder.class);
+ private static final Log LOG = LogFactory.getLog(FOTreeBuilder.class);
/** The registry for ElementMapping instances */
protected ElementMappingRegistry elementMappingRegistry;
used = true;
empty = true;
rootFObj = null; // allows FOTreeBuilder to be reused
- if (log.isDebugEnabled()) {
- log.debug("Building formatting object tree");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Building formatting object tree");
}
foEventHandler.startDocument();
this.mainFOHandler = new MainFOHandler();
eventProducer.emptyDocument(this);
}
rootFObj = null;
- if (log.isDebugEnabled()) {
- log.debug("Parsing of document complete");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Parsing of document complete");
}
foEventHandler.endDocument();
}
/** {@inheritDoc} */
public void warning(SAXParseException e) {
- log.warn(e.getLocalizedMessage());
+ LOG.warn(e.getLocalizedMessage());
}
/** {@inheritDoc} */
public void error(SAXParseException e) {
- log.error(e.toString());
+ LOG.error(e.toString());
}
/** {@inheritDoc} */
public void fatalError(SAXParseException e) throws SAXException {
- log.error(e.toString());
+ LOG.error(e.toString());
throw e;
}
}
if (currentFObj.getParent() == null) {
- log.debug("endElement for top-level " + currentFObj.getName());
+ LOG.debug("endElement for top-level " + currentFObj.getName());
}
currentFObj = currentFObj.getParent();
}
/** Basic {@link FONode.FONodeIterator} implementation */
- public class FObjIterator implements FONodeIterator {
+ public static class FObjIterator implements FONodeIterator {
private static final int F_NONE_ALLOWED = 0;
private static final int F_SET_ALLOWED = 1;
public class PropertyMaker implements Cloneable {
/** Logger instance */
- private static Log log = LogFactory.getLog(PropertyMaker.class);
+ private static final Log LOG = LogFactory.getLog(PropertyMaker.class);
+
+ private static final boolean IS_LOG_TRACE_ENABLED = LOG.isTraceEnabled();
/** the property ID */
protected int propId;
throws PropertyException {
Property p = null;
- if (log.isTraceEnabled()) {
- log.trace("PropertyMaker.findProperty: "
+ if (IS_LOG_TRACE_ENABLED) {
+ LOG.trace("PropertyMaker.findProperty: "
+ FOPropertyMapping.getPropertyName(propId)
+ ", " + propertyList.getFObj().getName());
}
*/
public Property make(PropertyList propertyList) throws PropertyException {
if (defaultProperty != null) {
- if (log.isTraceEnabled()) {
- log.trace("PropertyMaker.make: reusing defaultProperty, "
+ if (IS_LOG_TRACE_ENABLED) {
+ LOG.trace("PropertyMaker.make: reusing defaultProperty, "
+ FOPropertyMapping.getPropertyName(propId));
}
return defaultProperty;
}
- if (log.isTraceEnabled()) {
- log.trace("PropertyMaker.make: making default property value, "
+ if (IS_LOG_TRACE_ENABLED) {
+ LOG.trace("PropertyMaker.make: making default property value, "
+ FOPropertyMapping.getPropertyName(propId)
+ ", " + propertyList.getFObj().getName());
}
if ((propId & Constants.COMPOUND_MASK) != 0) {
newProp = getSubprop(newProp, propId & Constants.COMPOUND_MASK);
}
- if (!isInherited() && log.isWarnEnabled()) {
+ if (!isInherited() && LOG.isWarnEnabled()) {
/* check whether explicit value is available on the parent
* (for inherited properties, an inherited value will always
* be available)
Property parentExplicit = propertyList.getParentPropertyList()
.getExplicit(getPropId());
if (parentExplicit == null) {
- log.warn(FOPropertyMapping.getPropertyName(getPropId())
+ LOG.warn(FOPropertyMapping.getPropertyName(getPropId())
+ "=\"inherit\" on " + propertyList.getFObj().getName()
+ ", but no explicit value found on the parent FO.");
}